Configure Xonar Essence STX II sound card

Dear all,

we have a pretty stubborn new sound card we do not manage to configure properly for duplex and capture mode for unclear reasons. I do not really have an idea where to start debugging, thus, any recommendation would be appreciated.

The card is an Asus Xonar Essence STX II 7.1. We selected this card as the Alsa webpage reported Linux-compatibility. The system is a standard HP ProDesk 600 G5 MT running a fresh install of Ubuntu Linux 18.04 including all available updates and kernel 5.3.0-28-lowlatency, Octave 4.2.2 and latest Psychtoolbox (3.0.16, Jan 30, 2020). No obvious problems with Psychtoolbox besides sound.

Calling InitializePsychSound(0 or 1, doesn’t matter) and h = PsychPortAudio(‘GetDevices’) gives eight times this error message:

Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_asa.c’, line: 924

and a structure with 6 audio devices. I did not find any useful information with respect to this error message anywhere.

Opening the device selected by PsychPortAudio by default ([]) in stereo in playback mode selects the “front”-device. Playback and BasicSoundOutputDemo work without any obvious problems (even if requesting very low latencies < 5ms).

Trying to open the default device ([]; mono or stereo doesn’t matter) for capture or duplex results in the following error message (same for BasicSoundInputDemo):

PTB-INFO: Choosing deviceIndex 1 [front] as default input audio device.
Error in function Open: Usage error
Audio input requested, but there isn’t any audio input device available or you provided a deviceid for something else than an input device!

Indeed, “front”-device only has output channels. There are, however, three other devices with input channels available: “sysdefault”, “pulse”, and “default”

The structure returned by PsychPortAudio(‘GetDevices’) indicates reasonable latencies (LowInputLatency and LowOutputLatency both 0.0087075) for “pulse” and “default” devices. However, when trying to select any of these two devices manually and capture sound, Octave becomes completely unresponsive (and has to be killed) and CPU load goes to 100%. In capture mode Octave already hangs after PsychPortAudio(‘Start’). In duplex mode a small amount of audiodata is returned once and Octave hangs after PsychPortAudio(‘Stop’). Manually specifying other sampling rates or latencies does not change the problem. Audacity does record from the “default”-device without apparent problems (but not after killing hanging Octave; pulseaudio has to be restarted first).

If manually selecting “sysdefault”, capture and duplex mode work but only with high latencies (21 ms for capture and 64 ms for duplex mode, manually specifying suggestedLatency = 0.064 when opening the device otherwise there are massive artifacts). However, we would like to achieve considerably lower latencies in duplex mode.

I would be very grateful for any hint how to properly configure the card for lower latencies in duplex mode.

Thank you!
Andreas

What’s the debug output at PsychPortAudio(‘Verbosity’, 10)?

The reason default and pulse hangs is because default is the default device, an alias for pulse on a default Ubuntu setup i think, and so both default and pulse actually try to use the PulseAudio sound server - which is quite unsuitable for properly timed audio, and so PsychPortAudio actually suspends the sound server while it is running – Accessing the suspended server ends in a hang.

You can disable the auto-suspend via
PsychPortAudio(‘EngineTunables’ , [], [], [], 0);

Dear Mario,

What’s the debug output at PsychPortAudio(‘Verbosity’, 10)?

Please find the output below. There was no extra output when playing or recording sound.

Thank you for the explanation why “default” and “pulse” devices hang. I would not want to use them any longer because I meanwhile noticed that both, playback and capture through these devices (and also “sysdefault”) are always resampled to 16 bit, 48 kHz at hardware level (as reported in /proc/asound/card0/pcm0p/sub0/hw_params) for all sound applications (PortAudio based as well as Alsa based).

However, after some hours of tinkering I now might have found a workaround. If I add a device with fixed pcm format S32_LE in /etc/asound.conf this device appears in Psychtoolbox and can be used without apparent problems at very short latencies as expected.

pcm.device{
format S32_LE
type hw
card 0
device 0
}

Psychtoolbox does still not select this device by default neither for playback nor for capture or duplex mode despite it is apparently the most suitable device. Rather, it is still reported that not any input device was available. Could this be possibly changed somehow? This would make the setup less prone for improper usage.

Still not sure what the actual problem is. My first guess was that it could be related to the PortAudio library as also Audacity does not allow to select the more appropriate devices (“hw” etc.) available in Alsa (aplay, arecord). But not sure.

Thanks a lot for your help! Best
Andreas

PTB-INFO: Trying to suspend potentially running PulseAudio server… … status 0
Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924
Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924
Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924
Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924
Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924
Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924
Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
PTB-DEBUG: PortAudio says: Cannot connect to server socket err = Datei oder Verzeichnis nicht gefunden
PTB-DEBUG: PortAudio says: Cannot connect to server request channel
PTB-DEBUG: PortAudio says: jack server is not running or cannot be
started
PTB-DEBUG: PortAudio says: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
PTB-DEBUG: PortAudio says: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
PTB-INFO: Using modified PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4

PTB-INFO: New audio device 0 with handle 0 opened as PortAudio stream:
PTB-INFO: For 2 channels Playback: Audio subsystem is ALSA, Audio device name is sysdefault
PTB-INFO: For 2 channels Capture: Audio subsystem is ALSA, Audio device name is sysdefault
PTB-INFO: Real samplerate 48000.000000 Hz. Input latency 21.333333 msecs, Output latency 21.333333 msecs.

PTB-INFO: Closing handle 0.
PTB-INFO: Trying to resume potentially suspended PulseAudio server… … status 0

1 Like

Glad you found a solution. That’s the correct way to override such things. You can also name it something like pcm.asusXonar { … or something descriptive instead of pcm.device {

The auto-selection of input device had a bug in PsychPortAudio, as i discovered now (https://github.com/kleinerm/Psychtoolbox-3/commit/44908bcdacc541bdbf7c53aa55b31d31d4df91ed). It worked by accident, because the only sound cards i had for testing for the last six years were two cheap USB soundcards and the built in HDA audio chips of a couple of laptops and computers. I haven’t touched a dedicated not-dirt-cheap sound card in quite a while. These HDA chips do playback and capture on the same device, so this bug didn’t happen here.

Apart from that, the selection of default device by Portaudio is not especially clever. It just gets the list of available devices from ALSA and chooses the first one with at least one output or input channel for playback/capture. On top of that, PsychPortAudio’s default device selection filters out devices (by name-matching) which look like they are either related to Pulseaudio (because of the hang problem) or audio over DisplayPort or HDMI, as most people probably don’t want to output sound via their graphics cards/monitors by default if there is also a dedicated sound card or a builtin standard sound chip. There’s still room for improvement here.

It is a bit puzzling how ALSA exposes the capture devices for your card by default. Maybe the output of the “alsa-info” command would be useful. Also the output from PsychPortAudio(‘GetDevices’)

You can also name it something like pcm.asusXonar { … or something
descriptive instead of pcm.device {

Yes, admittedly, „device“ is not an optimally distinctive name. Meaningful
variable names have never been my strong point :slight_smile:

It is a bit puzzling how ALSA exposes the capture devices for your card by default. Maybe the output of the “alsa-info” command would be useful. Also the output from PsychPortAudio(‘GetDevices’)

Please find the output of alsa-info and PsychPortAudio(‘GetDevices’) below.

Thank you! Best,
Andreas

upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.4.64
!!################################

!!Script ran on: Tue Feb 18 12:11:45 UTC 2020


!!Linux Distribution
!!------------------

Ubuntu 18.04.4 LTS \n \l DISTRIB_ID=Ubuntu DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS" NAME="Ubuntu" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.4 LTS" UBUNTU_CODENAME=bionic


!!DMI Information
!!---------------

Manufacturer:      HP
Product Name:      HP ProDesk 600 G5 MT
Product Version:
Firmware Version:  R02 Ver. 02.03.01


!!Kernel Information
!!------------------

Kernel release:    5.3.0-40-lowlatency
Operating System:  GNU/Linux
Architecture:      x86_64
Processor:         x86_64
SMP Enabled:       Yes


!!ALSA Version
!!------------

Driver version:     k5.3.0-40-lowlatency
Library version:    1.1.3
Utilities version:  1.1.3


!!Loaded ALSA modules
!!-------------------

snd_virtuoso


!!Sound Servers on this system
!!----------------------------

Pulseaudio:
     Installed - Yes (/usr/bin/pulseaudio)
     Running - Yes


!!Soundcards recognised by ALSA
!!-----------------------------

0 [IIH6           ]: AV200 - Xonar STX II+H6
                     Asus Virtuoso 100 at 0x3000, irq 18


!!PCI Soundcards installed in the system
!!--------------------------------------

01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
03:00.0 Parallel controller: SUNIX Co., Ltd. Multiport serial controller
05:04.0 Multimedia audio controller: C-Media Electronics Inc CMI8788 [Oxygen HD Audio]


!!Advanced information - PCI Vendor/Device/Subsystem ID's
!!-------------------------------------------------------

01:00.1 0403: 1002:aab0
	Subsystem: 103c:aab0

05:04.0 0401: 13f6:8788
	Subsystem: 1043:85f4


!!Modprobe options (Sound related)
!!--------------------------------

snd_pcsp: index=-2
snd_usb_audio: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
snd_usb_audio: index=-2
snd_usb_caiaq: index=-2
snd_usb_ua101: index=-2
snd_usb_us122l: index=-2
snd_usb_usx2y: index=-2
snd_cmipci: mpu_port=0x330 fm_port=0x388
snd_pcsp: index=-2
snd_usb_audio: index=-2


!!Loaded sound module options
!!---------------------------

!!Module: snd_virtuoso
	enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
	id : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	index : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1


!!ALSA Device nodes
!!-----------------

crw-rw----+ 1 root audio 116,  6 Feb 18 13:11 /dev/snd/controlC0
crw-rw----+ 1 root audio 116,  3 Feb 18 13:11 /dev/snd/pcmC0D0c
crw-rw----+ 1 root audio 116,  2 Feb 18 13:11 /dev/snd/pcmC0D0p
crw-rw----+ 1 root audio 116,  5 Feb 18 13:11 /dev/snd/pcmC0D1c
crw-rw----+ 1 root audio 116,  4 Feb 18 13:11 /dev/snd/pcmC0D1p
crw-rw----+ 1 root audio 116,  1 Feb 18 13:11 /dev/snd/seq
crw-rw----+ 1 root audio 116, 33 Feb 18 13:11 /dev/snd/timer

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root  60 Feb 18 13:11 .
drwxr-xr-x 3 root root 200 Feb 18 13:11 ..
lrwxrwxrwx 1 root root  12 Feb 18 13:11 pci-0000:05:04.0 -> ../controlC0


!!ALSA configuration files
!!------------------------

!!System wide config file (/etc/asound.conf)

pcm.asusXonar{
       format S32_LE
       type hw
       card 0
       device 0
}


!!Aplay/Arecord output
!!--------------------

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: IIH6 [Xonar STX II+H6], device 0: Multichannel [Multichannel]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 0: IIH6 [Xonar STX II+H6], device 1: Digital [Digital]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****
card 0: IIH6 [Xonar STX II+H6], device 0: Multichannel [Multichannel]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 0: IIH6 [Xonar STX II+H6], device 1: Digital [Digital]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

!!Amixer output
!!-------------

!!-------Mixer controls for card 0 [IIH6]

Card hw:0 'IIH6'/'Asus Virtuoso 100 at 0x3000, irq 18'
 Mixer name	: 'AV200'
 Components	: 'PCM1792A CS5381 AV200'
 Controls      : 26
 Simple ctrls  : 16
Simple mixer control 'Master',0
 Capabilities: pvolume pswitch pswitch-joined
 Playback channels: Front Left - Front Right - Rear Left - Rear Right - Front Center - Woofer - Side Left - Side Right
 Limits: Playback 135 - 255
 Mono:
 Front Left: Playback 214 [66%] [-20.50dB] [on]
 Front Right: Playback 214 [66%] [-20.50dB] [on]
 Rear Left: Playback 226 [76%] [-14.50dB] [on]
 Rear Right: Playback 226 [76%] [-14.50dB] [on]
 Front Center: Playback 215 [67%] [-20.00dB] [on]
 Woofer: Playback 215 [67%] [-20.00dB] [on]
 Side Left: Playback 215 [67%] [-20.00dB] [on]
 Side Right: Playback 215 [67%] [-20.00dB] [on]
Simple mixer control 'Headphones Impedance',0
 Capabilities: penum
 Items: '< 32 ohms' '32-64 ohms' '64-300 ohms' '300-600 ohms'
 Item0: '64-300 ohms'
Simple mixer control 'Line',0
 Capabilities: cswitch cswitch-joined
 Capture channels: Mono
 Mono: Capture [off]
Simple mixer control 'Mic',0
 Capabilities: cvolume cvolume-joined cswitch cswitch-joined
 Capture channels: Mono
 Limits: Capture 0 - 31
 Mono: Capture 31 [100%] [12.00dB] [on]
Simple mixer control 'Mic Boost (+20dB)',0
 Capabilities: pswitch pswitch-joined
 Playback channels: Mono
 Mono: Playback [off]
Simple mixer control 'Mic Source',0
 Capabilities: cenum
 Items: 'Mic Jack' 'Front Panel'
 Item0: 'Mic Jack'
Simple mixer control 'IEC958',0
 Capabilities: pswitch pswitch-joined
 Playback channels: Mono
 Mono: Playback [off]
Simple mixer control 'IEC958 Loopback',0
 Capabilities: pswitch pswitch-joined
 Playback channels: Mono
 Mono: Playback [off]
Simple mixer control 'IEC958 Validity Check',0
 Capabilities: cswitch cswitch-joined
 Capture channels: Mono
 Mono: Capture [off]
Simple mixer control 'Aux',0
 Capabilities: cvolume cswitch cswitch-joined
 Capture channels: Front Left - Front Right
 Limits: Capture 0 - 31
 Front Left: Capture 0 [0%] [-34.50dB] [off]
 Front Right: Capture 0 [0%] [-34.50dB] [off]
Simple mixer control 'Analog Input Monitor',0
 Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 Playback channels: Mono
 Limits: Playback 0 - 1
 Mono: Playback 1 [100%] [0.00dB] [off]
Simple mixer control 'Analog Output',0
 Capabilities: enum
 Items: 'Speakers' 'Headphones' 'FP Headphones'
 Item0: 'Headphones'
Simple mixer control 'DAC Filter',0
 Capabilities: penum
 Items: 'Sharp Roll-off' 'Slow Roll-off'
 Item0: 'Sharp Roll-off'
Simple mixer control 'De-emphasis',0
 Capabilities: pswitch pswitch-joined
 Playback channels: Mono
 Mono: Playback [off]
Simple mixer control 'Digital Input Monitor',0
 Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 Playback channels: Mono
 Limits: Playback 0 - 1
 Mono: Playback 1 [100%] [0.00dB] [off]
Simple mixer control 'Stereo Upmixing',0
 Capabilities: enum
 Items: 'Front' 'Front+Surround' 'Front+Surround+Back'
 Item0: 'Front'


!!Alsactl output
!!--------------

--startcollapse--
state.IIH6 {
	control.1 {
		iface MIXER
		name 'Master Playback Volume'
		value.0 214
		value.1 214
		value.2 226
		value.3 226
		value.4 215
		value.5 215
		value.6 215
		value.7 215
		comment {
			access 'read write'
			type INTEGER
			count 8
			range '135 - 255'
			dbmin -6000
			dbmax 0
			dbvalue.0 -2050
			dbvalue.1 -2050
			dbvalue.2 -1450
			dbvalue.3 -1450
			dbvalue.4 -2000
			dbvalue.5 -2000
			dbvalue.6 -2000
			dbvalue.7 -2000
		}
	}
	control.2 {
		iface MIXER
		name 'Master Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.3 {
		iface MIXER
		name 'Stereo Upmixing'
		value Front
		comment {
			access 'read write'
			type ENUMERATED
			count 1
			item.0 Front
			item.1 Front+Surround
			item.2 Front+Surround+Back
		}
	}
	control.4 {
		iface MIXER
		name 'IEC958 Playback Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.5 {
		iface PCM
		device 1
		name 'IEC958 Playback Default'
		value '0482000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access 'read write'
			type IEC958
			count 1
		}
	}
	control.6 {
		iface PCM
		device 1
		name 'IEC958 Playback Con Mask'
		value '3eff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.7 {
		iface PCM
		device 1
		name 'IEC958 Playback PCM Stream'
		value '0482000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access 'read write inactive'
			type IEC958
			count 1
		}
	}
	control.8 {
		iface PCM
		device 1
		name 'IEC958 Capture Mask'
		value ffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.9 {
		iface PCM
		device 1
		name 'IEC958 Capture Default'
		value '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.10 {
		iface MIXER
		name 'IEC958 Loopback Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.11 {
		iface MIXER
		name 'IEC958 Validity Check Capture Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.12 {
		iface MIXER
		name 'Analog Input Monitor Playback Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.13 {
		iface MIXER
		name 'Analog Input Monitor Playback Volume'
		value 1
		comment {
			access 'read write'
			type INTEGER
			count 1
			range '0 - 1'
			dbmin -600
			dbmax 0
			dbvalue.0 0
		}
	}
	control.14 {
		iface MIXER
		name 'Digital Input Monitor Playback Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.15 {
		iface MIXER
		name 'Digital Input Monitor Playback Volume'
		value 1
		comment {
			access 'read write'
			type INTEGER
			count 1
			range '0 - 1'
			dbmin -600
			dbmax 0
			dbvalue.0 0
		}
	}
	control.16 {
		iface MIXER
		name 'Mic Capture Volume'
		value 31
		comment {
			access 'read write'
			type INTEGER
			count 1
			range '0 - 31'
			dbmin -3450
			dbmax 1200
			dbvalue.0 1200
		}
	}
	control.17 {
		iface MIXER
		name 'Mic Capture Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.18 {
		iface MIXER
		name 'Mic Boost (+20dB)'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.19 {
		iface MIXER
		name 'Mic Source Capture Enum'
		value 'Mic Jack'
		comment {
			access 'read write'
			type ENUMERATED
			count 1
			item.0 'Mic Jack'
			item.1 'Front Panel'
		}
	}
	control.20 {
		iface MIXER
		name 'Line Capture Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.21 {
		iface MIXER
		name 'Aux Capture Volume'
		value.0 0
		value.1 0
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 31'
			dbmin -3450
			dbmax 1200
			dbvalue.0 -3450
			dbvalue.1 -3450
		}
	}
	control.22 {
		iface MIXER
		name 'Aux Capture Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.23 {
		iface MIXER
		name 'Analog Output'
		value Headphones
		comment {
			access 'read write'
			type ENUMERATED
			count 1
			item.0 Speakers
			item.1 Headphones
			item.2 'FP Headphones'
		}
	}
	control.24 {
		iface MIXER
		name 'Headphones Impedance Playback Enum'
		value '64-300 ohms'
		comment {
			access 'read write'
			type ENUMERATED
			count 1
			item.0 '< 32 ohms'
			item.1 '32-64 ohms'
			item.2 '64-300 ohms'
			item.3 '300-600 ohms'
		}
	}
	control.25 {
		iface MIXER
		name 'DAC Filter Playback Enum'
		value 'Sharp Roll-off'
		comment {
			access 'read write'
			type ENUMERATED
			count 1
			item.0 'Sharp Roll-off'
			item.1 'Slow Roll-off'
		}
	}
	control.26 {
		iface MIXER
		name 'De-emphasis Playback Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
}
--endcollapse--


!!All Loaded Modules
!!------------------

Module
amdgpu
amd_iommu_v2
gpu_sched
nls_iso8859_1
intel_rapl_msr
intel_rapl_common
x86_pkg_temp_thermal
intel_powerclamp
coretemp
kvm_intel
kvm
irqbypass
snd_virtuoso
snd_oxygen_lib
mei_hdcp
snd_mpu401_uart
crct10dif_pclmul
crc32_pclmul
snd_pcm
ghash_clmulni_intel
snd_seq_midi
snd_seq_midi_event
snd_rawmidi
snd_seq
aesni_intel
snd_seq_device
aes_x86_64
crypto_simd
snd_timer
cdc_ether
cryptd
radeon
glue_helper
intel_cstate
intel_rapl_perf
hp_wmi
usbnet
snd
serio_raw
sparse_keymap
ttm
r8152
wmi_bmof
drm_kms_helper
joydev
input_leds
soundcore
mii
drm
parport_serial
i2c_algo_bit
mei_me
fb_sys_fops
syscopyarea
sysfillrect
sysimgblt
mei
ucsi_acpi
typec_ucsi
intel_pch_thermal
ie31200_edac
typec
mac_hid
acpi_pad
sch_fq_codel
parport_pc
ppdev
parport
ip_tables
x_tables
autofs4
hid_logitech_hidpp
hid_logitech_dj
hid_generic
usbhid
hid
nvme
psmouse
ahci
e1000e
nvme_core
libahci
wmi
video


!!ALSA/HDA dmesg
!!--------------

[    0.198159] ACPI: Added _OSI(Linux-Dell-Video)
[    0.198160] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.198160] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)

[    0.283184] ACPI: Power Resource [PG00] (on)
[    0.283651] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.PEG0.HDAU._STA.M097], AE_NOT_FOUND (20190703/psargs-330)
[    0.283657] No Local Variables are initialized for Method [_STA]
[    0.283657] No Arguments are initialized for method [_STA]
[    0.283659] ACPI Error: Aborting method \_SB.PCI0.PEG0.HDAU._STA due to previous error (AE_NOT_FOUND) (20190703/psparse-531)
[    0.289509] ACPI: Power Resource [USBC] (on)

[    0.339563] pci 0000:04:00.0:   bridge window [io  0x3000-0x3fff]
[    0.339693] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.PEG0.HDAU._STA.M097], AE_NOT_FOUND (20190703/psargs-330)
[    0.339699] No Local Variables are initialized for Method [_STA]
[    0.339699] No Arguments are initialized for method [_STA]
[    0.339700] ACPI Error: Aborting method \_SB.PCI0.PEG0.HDAU._STA due to previous error (AE_NOT_FOUND) (20190703/psparse-531)
[    0.342098] ACPI: EC: interrupt unblocked

[    0.373520] system 00:00: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.373559] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.PEG0.HDAU._STA.M097], AE_NOT_FOUND (20190703/psargs-330)
[    0.373565] No Local Variables are initialized for Method [_STA]
[    0.373566] No Arguments are initialized for method [_STA]
[    0.373567] ACPI Error: Aborting method \_SB.PCI0.PEG0.HDAU._STA due to previous error (AE_NOT_FOUND) (20190703/psparse-531)
[    0.373887] system 00:01: [io  0x1800-0x18fe] has been reserved

[    2.599038] [drm] PCIE gen 3 link speeds already enabled
[    2.628982] snd_virtuoso 0000:05:04.0: enabling device (0100 -> 0101)
[    2.633088] [drm] PCIE GART of 2048M enabled (table at 0x00000000001D6000).

ans =

 scalar structure containing the fields:

   DeviceIndex = 0
   HostAudioAPIId =  8
   HostAudioAPIName = ALSA
   DeviceName = sysdefault
   NrInputChannels =  128
   NrOutputChannels =  128
   LowInputLatency =  0.021333
   HighInputLatency =  0.021333
   LowOutputLatency =  0.021333
   HighOutputLatency =  0.021333
   DefaultSampleRate =  48000

ans =

 scalar structure containing the fields:

   DeviceIndex =  1
   HostAudioAPIId =  8
   HostAudioAPIName = ALSA
   DeviceName = front
   NrInputChannels = 0
   NrOutputChannels =  8
   LowInputLatency = -1
   HighInputLatency = -1
   LowOutputLatency =  0.0086848
   HighOutputLatency =  0.034830
   DefaultSampleRate =  44100

ans =

 scalar structure containing the fields:

   DeviceIndex =  2
   HostAudioAPIId =  8
   HostAudioAPIName = ALSA
   DeviceName = surround71
   NrInputChannels = 0
   NrOutputChannels =  8
   LowInputLatency = -1
   HighInputLatency = -1
   LowOutputLatency =  0.0086848
   HighOutputLatency =  0.034830
   DefaultSampleRate =  44100

ans =

 scalar structure containing the fields:

   DeviceIndex =  3
   HostAudioAPIId =  8
   HostAudioAPIName = ALSA
   DeviceName = pulse
   NrInputChannels =  32
   NrOutputChannels =  32
   LowInputLatency =  0.0087075
   HighInputLatency =  0.034830
   LowOutputLatency =  0.0087075
   HighOutputLatency =  0.034830
   DefaultSampleRate =  44100

ans =

 scalar structure containing the fields:

   DeviceIndex =  4
   HostAudioAPIId =  8
   HostAudioAPIName = ALSA
   DeviceName = asusXonar
   NrInputChannels =  2
   NrOutputChannels =  8
   LowInputLatency =  0.0087075
   HighInputLatency =  0.034830
   LowOutputLatency =  0.0086848
   HighOutputLatency =  0.034830
   DefaultSampleRate =  44100

ans =

 scalar structure containing the fields:

   DeviceIndex =  5
   HostAudioAPIId =  8
   HostAudioAPIName = ALSA
   DeviceName = dmix
   NrInputChannels = 0
   NrOutputChannels =  2
   LowInputLatency = -1
   HighInputLatency = -1
   LowOutputLatency =  0.021333
   HighOutputLatency =  0.021333
   DefaultSampleRate =  48000

ans =

 scalar structure containing the fields:

   DeviceIndex =  6
   HostAudioAPIId =  8
   HostAudioAPIName = ALSA
   DeviceName = default
   NrInputChannels =  32
   NrOutputChannels =  32
   LowInputLatency =  0.0087075
   HighInputLatency =  0.034830
   LowOutputLatency =  0.0087075
   HighOutputLatency =  0.034830
   DefaultSampleRate =  44100

Thanks. Nothing there that’s suspicious. Anyway…

Could you try the PsychPortAudio.mexa64 from my master branch:

https://github.com/kleinerm/Psychtoolbox-3/raw/master/Psychtoolbox/PsychBasic/PsychPortAudio.mexa64

Apart from other unrelated refinements, i hope it will at least select the proper capture card by default now, ie. when [] is set as deviceIndex.

Your solution might also be a good thing to put somewhere on our Wiki, as an example on how to resolve such issues, if you feel inclined.

Dear Mario,

Could you try the PsychPortAudio.mexa64 from my master branch:

https://github.com/kleinerm/Psychtoolbox-3/raw/master/Psychtoolbox/PsychBasic/PsychPortAudio.mexa64

Sorry for the delay. I have tested PsychPortAudio.mex from Octave3Linux64 subdirectory. Indeed the correct device is now selected for capture. There are two additional lines of output in verbose mode:

PTB-INFO: Choosing deviceIndex 4 [asusXonar] as default input audio device.
PTB-DEBUG: Probed PaAlsaStream struct is from patched portaudio with portmixer.patch (Ubuntu style).
PTB-INFO: Applying paUtilFixedHostBufferSize workaround for pure half-duplex capture mode.

Your solution might also be a good thing to put somewhere on our Wiki, as an example on how to resolve such issues, if you feel inclined.

I would be happy to add some information on the Wiki. Unfortunately I do not yet really have an idea what the issue actually is and how to know when the approach is appropriate. I just have a vague idea that Alsa and PortAudio appear to fail successfully negotiating available bit depths/rates.

Thanks. Nothing there that’s suspicious. Anyway…

On our other/older stimulation setups basically all devices listed for example by aplay -L (see below for new card) also appear as available devices in PsychPortAudio with “hw”-devices sorted to the beginning and therefore selected by default.

Is there any way to debug why the “hw”-devices are apparently missing in PortAudio-applications with this card (nothing relevant in dmesg/syslog)?

Thank you! Best
Andreas

default
   Playback/recording through the PulseAudio sound server
null
   Discard all samples (playback) or generate zero samples (capture)
pulse
   PulseAudio Sound Server
sysdefault:CARD=IIH6
   Xonar STX II+H6, Multichannel
   Default Audio Device
front:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   Front speakers
surround21:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   4.0 Surround output to Front and Rear speakers
surround41:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   Direct sample mixing device
dmix:CARD=IIH6,DEV=1
   Xonar STX II+H6, Digital
   Direct sample mixing device
dsnoop:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   Direct sample snooping device
dsnoop:CARD=IIH6,DEV=1
   Xonar STX II+H6, Digital
   Direct sample snooping device
hw:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   Direct hardware device without any conversions
hw:CARD=IIH6,DEV=1
   Xonar STX II+H6, Digital
   Direct hardware device without any conversions
plughw:CARD=IIH6,DEV=0
   Xonar STX II+H6, Multichannel
   Hardware device with all software conversions
plughw:CARD=IIH6,DEV=1
   Xonar STX II+H6, Digital
   Hardware device with all software conversions