How do I connect my ASIO sound card to Matlab??
42 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
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
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
el 30 de Oct. de 2021
Editada: Walter Roberson
el 30 de Oct. de 2021
Ver también
Categorías
Más información sobre Audio and Video Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!