How do I connect my ASIO sound card to Matlab??

42 visualizaciones (últimos 30 días)
Wilmer Flores
Wilmer Flores el 26 de Oct. de 2021
Editada: Walter Roberson el 30 de Oct. de 2021
Hello,
I am trying to get my Zoom F8n sound card to connect with matlab via USB. Using the Audio Tool Box functions, I am able to see the ID numbers and names of the I/O devices. However, when I allocate the I/O devices in matlab. The sound wav file does not play through my output device. The following is my setup, I have PC (Matlab V2018a) connected via USB to the Zoom. A output channel on the zoom is connected 3.5mm to my amplifier. What is the reason for the audio not to play through the Zoom f8n output audio?
My script is attached to this post for reference.
I have downloaded ASIO drivers for Zoom F8n and can view it in the I/O device list. But I cannot play or record audio from the setup decribed above. Any help would be much appreciated. Please let me know if you any other information maybe required.
Thanks

Respuestas (1)

jibrahim
jibrahim el 26 de Oct. de 2021
Editada: jibrahim el 26 de Oct. de 2021
Hi Wilmer,
You should be able to use the ASIO sound card with the objects in Audio toolbox: audioDeviceWriter, audioDeviceReader, and audioPlayerRecorder
  3 comentarios
Jimmy Lapierre
Jimmy Lapierre el 27 de Oct. de 2021
Hi Wilmer,
Above, you have created the reader and writer objects. You now need to call these in a loop to play and record the audio, frame by frame.
If your goal is to simultaniously play an audio file and record the microphone, you could use an "async buffer", which will allow you to read the audio frame by frame. This will load an audio file into the buffer:
[x,fs] = audioread('FunkyDrums-48-stereo-25secs.mp3'); % example audio file
ab = dsp.AsyncBuffer(size(x,1)); % create a buffer large enough for the file
write(ab,x(:,1)); % use only the left channel
To play this audio in a loop, lets say the first 5 seconds, you can proceed as follows:
for ii=1:round(5*48e3/1024)
xframe = read(ab,1024); % read a 1024-sample frame from the buffer
outZoom(xframe); % write/play to the audio device
end
After that, you can add the recorder (inZoom) to the loop, and any processing or visualization you need, such as a timescope.
Keep in mind that this is using two different devices with their own sample rate clocks. If you were to run this loop for hours, this could become an issue (imagine one device was really running at 48,000.1 Hz and the other at 47,999.9 Hz, at some point you would need to fill in or drop samples). Ideally, you'd have one I/O device with both the microphone and the loudspeaker connected to it, and then you could use audioPlayerRecorder.
Also note that full-duplex ASIO device names are different, if you want to list those, you must specify the driver as ASIO first:
devicesOut = getAudioDevices(audioDeviceWriter('Driver','ASIO')).'
outZoom = audioDeviceWriter(48000,'Driver','ASIO','Device',devicesOut{2});
Wilmer Flores
Wilmer Flores el 30 de Oct. de 2021
Editada: Walter Roberson el 30 de Oct. de 2021
Hello Jimmy,
Thanks for the information!
So I followed up with the audioPlayerRecorder function. I attempted to add my ASIO device. However, upon executing the following lines of code.
playRec = audioPlayerRecorder;
devices = getAudioDevices(playRec)
It returned {'No full-duplex audio device detected'}.
When I execute
info = audiodevinfo()
'Primary Sound Capture Driver (Windows DirectSound)' 'Windows DirectSound' 0
'Microphone (ZOOM F Series Multi Track Audio) (Windows DirectSound)' 'Windows DirectSound' 1
'Microphone Array (Realtek(R) Audio) (Windows DirectSound)' 'Windows DirectSound' 2
I see this for audioDeviceReader and audioDeviceWriter. The ID numbers and naming convention for audiodevicewriter is slightly different. My ASIO is the ZOOM F Series Multi Track Audio. I can select it for both audioDeviceReader and audioDeviceWriter. But only for a Driver: 'Windows DirectSound'. When I attempt to do
inZoom = audioDeviceReader(48000,1024,'NumChannels',1,'Driver','ASIO','Device','Microphone (ZOOM F Series Multi Track Audio)').
Audio Reader Device Properties
shows the following:
Driver: 'ASIO'
Device: 'No audio input device detected'
NumChannels: 1
SamplesPerFrame: 1024
SampleRate: 48000
Advanced
BitDepth: '24-bit integer'
ChannelMappingSource: 'Auto'
OutputDataType: 'double'
I get the feeling this device may not be a full-duplex ASIO device. Is this true? Or am I incorrectly applying 'Driver', 'ASIO' to the functions?

Iniciar sesión para comentar.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by