I am very fond of Psychtoolbox. I commend the writers for maintaining this invaluable tool.
The psychtest I am having trouble with is the AudioFeedbackLatencyTest( )
%%% version function AudioFeedbackLatencyTest(roundtrip, trigger, deviceid, nrtrials, freq, freqout, fullduplex, runmode)
I need to test one specific deviceID using AudioFeedbackLatencyTest( ) because it is the one I use in an experiment but any attempt to specify device id results in errors
using any of the following commands (Selection of errors produced: (small exert … denotes lapse))
AudioFeedbackLatencyTest(0, 0.1, 6, [], [], [],[],0)>>>
AudioFeedbackLatencyTest([], 0.1, 6, [], [], [],[],0) >>>
AudioFeedbackLatencyTest([], 0.1, [6 6], [], [], [],[],[]) >>>
AudioFeedbackLatencyTest(1, 0.1, [6 6], [], [], [],[],[]) >>>
*************** command line output **************
>> AudioFeedbackLatencyTest(0, 0.1, [6 6], [], [], [],[],[])
Using runmode 1.
PTB-DEBUG: PortAudio says: before paHostApiInitializers[0].
PTB-DEBUG: PortAudio says: Device 18 has realtime alias
PTB-DEBUG: PortAudio says: Interface 18, Name: H
PTB-DEBUG: PortAudio says: FilterNew: Creating filter 'HD Audio Line in'
...
PTB-DEBUG: PortAudio says: PinNew: Creating pin 1:
PTB-DEBUG: PortAudio says: PinNew: Not source/sink
PTB-DEBUG: PortAudio says: PinNew: Error -9996
PTB-DEBUG: PortAudio says: Filter (WaveRT) created with 1 valid pins (total I/Os: 1)
PTB-DEBUG: PortAudio says: after paHostApiInitializers[2].
PTB-INFO: Using modified PortAudio V19.6.0-devel, revision unknown
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!
Error using PsychPortAudio
Usage:
pahandle = PsychPortAudio('Open' [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][,
suggestedLatency][, selectchannels][, specialFlags=0]);
Error in AudioFeedbackLatencyTest (line 377)
pahandlerec = PsychPortAudio('Open', indeviceid, 2, 2, freq);
*************** command line output **************
“Device N” in output does not match output from PsychPortAudio(‘GetDevices’) e.g., device name HD Audio Line in belows to device Id 22 (Var below)
*************** VARIABLE **************
0 2 'Microsoft Sound Mapper - Input' 'MME'
0 2 'Microphone (Sound Blaster AE-9)' 'MME'
0 2 'Digital Audio (S/PDIF) (Sound B' 'MME'
0 6 'What U Hear (Sound Blaster AE-9' 'MME'
0 2 'Aux (Sound Blaster AE-9s)' 'MME'
2 0 'Microsoft Sound Mapper - Output' 'MME'
6 0 'Speakers (Sound Blaster AE-9)' 'MME'
2 0 'Digital Audio (S/PDIF) (High De' 'MME'
2 0 'Digital Audio (S/PDIF) (Sound B' 'MME'
6 0 'Speakers (Sound Blaster AE-9)' 'Windows WASAPI'
2 0 'Digital Audio (S/PDIF) (High Definition Audio Device)' 'Windows WASAPI'
2 0 'Digital Audio (S/PDIF) (Sound Blaster AE-9s)' 'Windows WASAPI'
0 2 'Microphone (Sound Blaster AE-9)' 'Windows WASAPI'
0 2 'Digital Audio (S/PDIF) (Sound Blaster AE-9s)' 'Windows WASAPI'
0 2 'What U Hear (Sound Blaster AE-9)' 'Windows WASAPI'
0 2 'Aux (Sound Blaster AE-9s)' 'Windows WASAPI'
2 0 'SPDIF Out (HD Audio SPDIF out)' 'Windows WDM-KS'
6 0 'Speakers (Sound Blaster Speaker/Headphone)' 'Windows WDM-KS'
0 2 'Microphone (Sound Blaster Microphone)' 'Windows WDM-KS'
0 6 'What U Hear (Sound Blaster What U Hear)' 'Windows WDM-KS'
2 0 'SPDIF Out (HD Audio SPDIF out)' 'Windows WDM-KS'
0 2 'Digital Audio (S/PDIF) (HD Audio Digital in)' 'Windows WDM-KS'
0 2 'Line In (HD Audio Line in)' 'Windows WDM-KS'
*************** VARIABLE **************
Even so, there doesnt appear to be any latency measures returned in the command line output.
Using >>> AudioFeedbackLatencyTest() >>> without any arguments returns basic info from Device info above and does not appear to give any other timing test
*************** command line output **************
AudioFeedbackLatencyTest()
Using runmode 1.
PTB-DEBUG: PortAudio says: before paHostApiInitializers[0].
PTB-DEBUG: PortAudio says: after paHostApiInitializers[0].
PTB-DEBUG: PortAudio says: before paHostApiInitializers[1].
PTB-DEBUG: PortAudio says: WASAPI: device idx: 00
PTB-DEBUG: PortAudio says: WASAPI: ---------------
PTB-DEBUG: PortAudio says: WASAPI:0| name[Speakers (Sound Blaster AE-9)]
PTB-DEBUG: PortAudio says: WASAPI:0| form-factor[1]
PTB-DEBUG: PortAudio says: WASAPI:0| def.SR[48000] max.CH[6] latency{hi[0.010000] lo[0.003000]}
PTB-DEBUG: PortAudio says: WASAPI: device idx: 01
…
PTB-DEBUG: PortAudio says: PinNew: Error -9996
PTB-DEBUG: PortAudio says: Filter (WaveRT) created with 1 valid pins (total I/Os: 1)
PTB-DEBUG: PortAudio says: after paHostApiInitializers[2].
PTB-INFO: Using modified PortAudio V19.6.0-devel, revision unknown
PTB-DEBUG: PortAudio says: WASAPI: IAudioClient2 set properties: IsOffload = 0, Category = 0, Options = 1
PTB-DEBUG: PortAudio says: wFormatTag =WAVE_FORMAT_EXTENSIBLE
PTB-DEBUG: PortAudio says: SubFormat =KSDATAFORMAT_SUBTYPE_PCM
PTB-DEBUG: PortAudio says: Samples.wValidBitsPerSample =24
PTB-DEBUG: PortAudio says: dwChannelMask =0x3
PTB-DEBUG: PortAudio says: nChannels =2
PTB-DEBUG: PortAudio says: nSamplesPerSec =48000
PTB-DEBUG: PortAudio says: nAvgBytesPerSec=384000
PTB-DEBUG: PortAudio says: nBlockAlign =8
PTB-DEBUG: PortAudio says: wBitsPerSample =32
PTB-DEBUG: PortAudio says: cbSize =22
PTB-DEBUG: PortAudio says: WASAPI::OpenStream(input): framesPerUser[ 480 ] framesPerHost[ 480 ] latency[ 10.00ms ] exclusive[ YES ] wow64_fix[ NO ] mode[ EVENT ]
PTB-INFO: New audio device -1 with handle 0 opened as PortAudio stream:
PTB-INFO: For 2 channels Capture: Audio subsystem is Windows WASAPI, Audio device name is Microphone (Sound Blaster AE-9)
PTB-INFO: Real samplerate 48000.000000 Hz. Input latency 10.000000 msecs, Output latency 0.000000 msecs.
PTB-DEBUG: PortAudio says: WASAPI: IAudioClient2 set properties: IsOffload = 0, Category = 0, Options = 1
PTB-DEBUG: PortAudio says: WASAPI ERROR HRESULT: 0x8889000A : AUDCLNT_E_DEVICE_IN_USE
[FUNCTION: CreateAudioClient FILE: c:\users\lab\portaudio\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 3069}]
PTB-DEBUG: PortAudio says: WASAPI ERROR PAERROR: -9996 : Invalid device
[FUNCTION: ActivateAudioClientInput FILE: c:\users\lab\portaudio\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 3179}]
PTB-DEBUG: PortAudio says: WASAPI ERROR PAERROR: -9996 : Invalid device
[FUNCTION: OpenStream FILE: c:\users\lab\portaudio\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 3368}]
PTB-ERROR: Failed to open audio device -1. PortAudio reports this error: Invalid device
INTERNAL PSYCHTOOLBOX ERROR
error: PsychError_system
general description: Error reported by a system call
specific description: Failed to open PortAudio audio device.
module name: PsychPortAudio
subfunction call: Open
file name: COMMON\PSYCHPORTAUDIO\PsychPortAudio.c
function name: PSYCHPORTAUDIOOpen
line number: 2888
Error using PsychPortAudio
See error message printed above.
Error in AudioFeedbackLatencyTest (line 384)
pahandleout = PsychPortAudio(‘Open’, outdeviceid, 2, 2, freq)
*************** command line output **************
Any assistance in this would be greatly appreciated. Details of system below.
PsychtoolboxVersion 3.0.15
Hardware setup:
I have a desktop (OS windows 10) - running MATLAB 2018b
Audio hardware is SoundBlaster (Creative SB/SBX AE series ASIO) connected via mini HDMI to the soundcard in the custom desktop (Sound Blaster AE-9 - Ultimate PCI-E Sound Card and DAC with Xamp Discrete Headphone Amplification and Audio Control Module - Creative Labs (United States))
audio cable conects to front 1/4 sterio plug
Tried:
- output [microphone jack or headphone jack] > soundcard rear red aux in out
- output [microphone jack ] > audio control module (red/white aux in)
Relevant driver versions (audio):
Aux (Sound Blaster AE-9s) 10.0.19041.1 (12/6/2019)
Digital Audio (S/PDIF) (High Definition Audio Device) 10.0.19041.1 (12/6/2019)
Digital Audio (S/PDIF) (Sound Blaster AE-9s) 10.0.19041.1 (12/6/2019)
Digital Audio (S/PDIF) (Sound Blaster AE-9s) 10.0.19041.1 (12/6/2019)
Microphone (Sound Blaster AE-9) 10.0.19041.1 (12/6/2019)
Speakers (Sound Blaster AE-9) 10.0.19041.1 (12/6/2019)
What U Hear (Sound Blaster AE-9) 10.0.19041.1 (12/6/2019)
High Definition Audio Device 10.0.19041.264 (5/9/2020)
NVIDIA High Definition Audio 1.3.38.21 (6/21/2019)
Sound Blaster AE-9 6.0.105.58 (3/23/2021)
Sound Blaster AE-9s 6.0.105.58 (3/23/2021)
Sound Blaster Audio Controller 6.0.105.58 (3/23/2021)