I am currently working with windows and Matlab2021b.
I want to use mode 3 for simultaneous capture and playback of sound.
This is my code:
pahandle = PsychPortAudio(‘Open’, [20,19], 3, 0, 48000, [8, 8]);
I want to use device 20 and 19 for playback and capture.
And this is the error:
Error in function Open: Wrong size argument supplied
Discrepancy between a specified and supplied argument:
Specified Argument Description:
minimum M: 1
maximum M: 1
minimum N: 1
maximum N: 1
minimum P: 1
maximum P: 1
Provided Argument Description:
number of dimensions: 2
I think the problem is with “deviceid”,but I don’t know how to correct it.Could you tell me what is the right syntax?Thank you very much!
Yes, ‘deviceid’ - if specified - must be one device index in the current PsychPortAudio implementation, so unless the same deviceid number refers to a device that can both playback and capture, you can’t use full-duplex on one PsychPortAudio handle, but you’d need to ‘Open’ two separate devices, one only for capture, one only for playback. Cfe. DelayedSoundFeedbackDemo.m.
In your case, given the device list, you can’t do full-duplex as no deviceId has both non-zero NrInputChannels and non-zero NrOutputChannels.
Also, as you are trying to choose a WDM-KS device, I have to warn you that the underlying libportaudio library dll for MS-Windows does not implement any audio timestamping at all for WDM-KS, only for MME (which has very high latency and inaccurate timestamps) or WASAPI. Any
PsychPortAudio('Start', ... call with a non-zero start time would hang, other time-based scheduling functions or stop functions or timestamp related/dependent functions would hang. Iow. Use of WDM-KS is only good for very few basic use cases atm.