Real Time Audio

I want to acquire data from soundcard, filter it and send it back to the soundcard.. Sampling frequency is 44100Hz and filter is a cascaded notch filter.. I have tried various combinations of the TimerFcn and SamplesAcquired Fcn and the best possible latency is around 300ms.. And can the data which is taken as a chunk of samples and filtered separately each chunk by chunk using the 'filter(Hd,x)' command be applied as a continuous streamed data to the filter and take continuous output from it ?? Is any such functionality available ?? How can i make this system as realtime as possible ??

Answers (1)

Daniel Shub
Daniel Shub on 5 Apr 2012

0 votes

This question has been asked and answered a number of times.
> < <http://www.mathworks.com/matlabcentral/answers/13761-streaming-sound-in-realtime> href=""<http://www.mathworks.com/matlabcentral/answers/3858-simultaneous-recording-and-reprodction-of-a-file-in-matlab</a>> href=""<http://www.mathworks.com/matlabcentral/answers/13146-can-we-access-the-audio-while-recording-online-using-matlab</a>>
For playing dynamic stimuli see href=""<http://www.mathworks.com/matlabcentral/answers/14108-real-time-sound-loop-playing</a>>
The summary is that with standard MATLAB it is difficult. The DAQ toolbox on Windows gives you a fighting chance. Your best bet is to go with a port audio implementation. I suggest psychtoolbox.
Assuming a reasonable computer and filtering, port audio should let you get close to 10 ms latency with only an occasional dropped frame.

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Tags

Asked:

on 5 Apr 2012

Community Treasure Hunt

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

Start Hunting!