Clear Filters
Clear Filters

How can I save a matrix of multichannel audio.

2 views (last 30 days)
I'm trying to record audio from an 8 channel USB audio interface (Scarlett 18i20). I need to sample the audio at 48kHz and for about 4 or 5 seconds. So, I saw the dsp.AudioRecorder function and thought it could be the solution to my needs. But I dont seem to find the way to make it work for me. The parameters that can be changed in this object are the sample rate, the frame size, the queue size, the type of output and the buffer size. The best I get is a repetition of the same frame for 5 seconds:
t1= dsp.AudioRecorder('SampleRate',48000,'SamplesPerFrame',4096,'NumChannels',8,'QueueDuration',2);
disp('Speak into microphone now');
pause(1);
tic;
while toc < 5,
test1= [test1;step(t1)];
end
release(t1);
disp('Recording complete');
Any help would be greatly appreciated.

Answers (1)

Dinesh Iyer
Dinesh Iyer on 11 Aug 2015
From your description, it is not clear what is the behaviour that you are getting. The dsp.AudioRecorder is the exact function to use for recording multi-channel audio and I have used it in my applications successfully.
A few things to note. 1. You have not selected a device name and so the default device is being chosen and your scarlett card might not be the default device. Either explicitly set the device name property or use the Windows Device Manager and change the default device.
2. You are using a Scarlet device which alsso has an ASIO driver. So, you probably need to set the Host API preferences to ASIO using the MATLAB Preferences Panel. By default on Windows, the Host API used is DirectSound and for these devices, the multiple channels are exposed as stereo-pairs.
I think doing (2) should fix your issue. The only thing to now check is that the scarlett usb supports 48K sample rate.
Hope this helps.
Dinesh

Categories

Find more on Applications in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!