Setting up a new audio rig

Hi,

I want to build up a new setup for auditory experiments. I am currently working with windows and Matlab. I intended to buy the Tascam us20X20 audio interface. The problem is that the us20X20 does not support the WASAPI driver, it supports only the following drivers: USB Audio Class 2.0, ASIO 2.0, WDM (MME), MIDI. Is there any workaround for the use of the ASIO driver?
Another option is to switch to Linux,. Here there is another problem, the us20x20 (as any other multi-channel audio interface I found) does not officially support Linux. Is there a way to know in advance if it will work under Linux?

What are your specific needs? The more specific you are, the more likely somebody can answer your questions.

I think WASAPI should work with any Windows audio device, as it utilizes the same drivers as WDMKS or MME. Only ASIO is special in that it needs special drivers from the card manufacturer.

The workaround for the ASIO driver would be to download the portaudio
source code yourself from portaudio.com, and find the instructions on how to download the ASIO SDK and build your own version of libportaudio_x64.dll with ASIO and put that into the Psychtoolbox folder, so it gets used by our PsychPortAudio driver instead of the standard portaudio_x64.dll we ship. Then our driver would enumerate potential ASIO sound cards and provide the basic functionality that is not specific to ASIO - our driver does no longer contain ASIO support, but if the underlying portaudio dll does, then our driver won’t know or care that this is an ASIO card, and there aren’t legal problems or license obligations for us, only for you as the end user.

“USB Audio Class 2.0” (UAC2) support means that at least the basics should work with any operating system that has UAC 2.0 drivers, which is at least current Linux, Windows-10, the iToy operating systems, and probably macOS. UAC-2 support is also implied by statements like “works without need to install any drivers” (because that simply means it uses the OS builtin UAC drivers) or “works with iPad, …” - i think the iToys only support UAC compliant external USB audio hardware.

So it should also work on Linux, and googling for Tascam and Linux suggests it does via UAC2, as does searching customer reviews for the Tascam on Amazon for “Linux”. At least the basics. Seems they have a proprietary Windows only setup app, but once setup on Windows, the device retains the settings for use on Linux et al.

You can never be sure if a device works for your specific use until you try or find something/somebody on the internet that uses it in exactly the same way. But simply googling Productname + Linux usually will give you an impression wrt. Linux compatibility. There’s also websites like alsamatrix, or https://linuxmusicians.com which focus on more pro use of sound cards under Linux. And i think we had some multi-channel sound cards mentioned on the forum which do work well on Linux.

Ideally people would create suitable entries on our Wiki to collect wisdom instead of it being unorganized on the forum…

-mario

Update:

I got my Tascam us20X20 audio interface today. The sound card indeed does not work using the WASAPI driver. It works using the windows MME driver but with only 2 of the output channels (out of ten). I tried to use a virtual machine with Ubuntu, but again it worked with only 2 of the output channels. The solution I found so far is to use the Matlab Audio toolbox, which supports ASIO, and to use the psychtoolbox only for timing.
I did not try to build my own version of libportaudio_x64.dll.

The setup purpose is to record a sound from a source while delivering different sounds from multiple speakers.

Thanks for the help, Mario.

Ehud

That’s surprising that the card would not work with WASAPI. What was the error output?

Note that running Ubuntu in a VM will do nothing for you, it needs to run on the hardware, otherwise you likely won’t use the Linux drivers for much of anything, and lose most of the Linux advantage.

How can you use PTB for timing if it is not in control of audio timing at all?
-mario

  1. This is the available devices I see:


    This is the error I get:
    painput = PsychPortAudio(‘Open’ ,7);
    Error in function Open: Usage error
    Audio output requested, but there isn’t any audio output device available or you provided a deviceid for something else than an output device!
    Trying using the ‘MME’ driver does work.

  2. The only reference I found about using the Tascam us20X20 on Linux states it does not work well:
    https://linuxmusicians.com/viewtopic.php?f=6&t=15591&p=70409#p70409

  3. I thinking of using the [GetSecs] function just before I start the recording to estimate the timing.

So the reason that doesn’t work is user error: Because you opened device 7 which only exposes the 20 input channels but zero output channels, but didn’t specify the ‘opMode’ parameter 2 a la painput = PsychPortAudio(‘Open’ ,7, 2); to request audio capture only. If omitted, that parameter defaults to 1 for playback only – difficult to do on a device without output channels…

That said, the fact that device 6 “Speakers US 20x20” only lists 2 output channels doesn’t bode well for multi-channel playback other than stereo… I wonder if this is some WASAPI bug, or something that can be configured somewhere in Windows or on your Tascam?

This more recent post from March 2019 on the Ardour (a DAW Digital audio workstation software) user forum…

…suggests it works with direct ALSA access, which is exactly what our PsychPortAudio driver needs. Both posts suggest the JACK audio server had some problems with that device, but while PsychPortAudio can use the JACK audio server, by default we use ALSA for more low-level access, so those potential JACK problems don’t matter.

I’d give it a try, but with Linux as a dual-boot, not in a VM. You could even boot Linux from a Live system, e.g., Ubuntu with boot option “Try without installation” or how it is called. Then in the live session you can “sudo apt install octave-psychtoolbox-3” to install a basic and somewhat outdated PTB for Octave, fire up octave and see if PsychPortAudio etc. recognize the sound card in a meaningful way. Obviously rebooting the machine will lose everything you do in the live session, but for a quick test it would probably be good enough.

That’s the way to hell if you care about audio timing, exactly the way you should not ever do audio timing.

-mario

As another specimen of multi-channel soundcard that supposedly works well with Linux, according to this thread…

The MOTU Ultralite AVB is also a multi-channel soundcard which is USB 2 audio class compliant and reported to work well under Linux. The nice thing about this card is that it also runs a web-server to which one can connect via regular wifi/ethernet and then control every aspect of the device from any web browser.

Looking at MOTU’s website, many of their products seem to be USB audio class compliant and so should work with Linux.

-mario

Hi,

I am working on a Haptics experiment using Matlab and ESI Gigaport HD+ 8 output USB audio interface which is connected to voice coils. I am currently facing a similar issue. Before the windows 10 update, all was working and we were receiving both the intended auditory and haptics output from the voice coils. However, after the update, I only receive auditory output from the voice coils. The issue seems that WASPI is for vibration and MME is for sound. In Matlab, the MME driver is automatically being selected for the motors. Is there a way to configure WASPI driver for a particular USB output port?

Best,
Rishi

A soundcard doesn’t know anything about audio output vs. haptic output, that’s just in how you wire motors to audio output channels.

You can select any of those listed devices by their deviceIndex, thereby selecting how PsychPortAudio channels for a given PsychPortAudio('Open', deviceIndex, ...); map to output channels on your GigaportHD+ sound card.

For any more advice from myself you’d need to buy priority support. A quick google search showed that this soundcard seems to be supported in 8 channel output mode on Linux at 16 bit precision with 44.1 kHz sampling rate, so that is one possible way to solve those issues permanently if Windows should be unwilling to cooperate.

-mario

Hi Mario,
We understand that the soundcard doesn’t know anything about the haptics vs audio. We just wanted to provide you some context. The issue is that when we select the WASPI index, the psychportaudio automatically selects MME for the particular channel. The other day when we selected the WASPI device index it just failed to compile. I am attaching the compilation error we get after selecting the WASPI device index. I am not sure about the lab budget, but please send us more details about priority support.

Best regards,
Rishi

Error using PsychPortAudio
Usage:

pahandle = PsychPortAudio(‘Open’ [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][, suggestedLatency][,
selectchannels][, specialFlags=0]);

Error in Animal_all (line 49)
pahandle1 = PsychPortAudio(‘Open’, 11, 1, 1, freq, nrchannels);%5

Error in Animal4_new (line 14)
Animal_all(params,0.5,“L”,animal);%0.012

Error in doSaltationTest4_new (line 34)
Animal4_new(params,Timecond,animal)

Error in Run_Saltation4 (line 22)
history=doSaltationTest4_new(params, history);

Priority support is explained at the top of this forum, on our webpage, and in help PsychPaidSupportAndServices.
-mario