Don't know the specifics, but in principle yes, you have to setup a buffer in order to do that, so there will be an overall delay associated when doing processing.
I recommend implementing real-time algorithms on something like a Ti DSP though, or using bash/shell scripts to run a processing algorithm.
In short, you might want to switch to C/C++ for real-time processing!
thanks Mr. Sebestian. We have recorded the heart beat sounds from heart but could not be processed immediately. Hence we need to have a matlab code to receive the audio, at the same time that should be processed.
For most of the solutions, the DSP Toolbox is required. There is however an alternative: the large time-frequency toolbox (LTFAT).
Download the LTFAT (http://ltfat.sourceforge.net/) and in the download directory type
ltfatstart
Then start the block-processing demo with:
demo_blockproc_basicloop('playrec');
It will record a signal from the input and play it to the output - in real-time. By modifying a copy of this demo, you can add your own algorithms. There are also other demos, simple type demo_block and hit TAB for further suggestions...
then you call "record" function to initialize the recording, and with the propieties TimerFcn, and TimerPeriod, you manage other function to process the audio in real time
I concur with Ahmed and Juan. If your processing doesn't have to be true real time, such as on the order of milliseconds, the DAQ toolbox should work for you.
Just be aware that unless you use the MATLAB real-time processing tools, which require Simulink (e.g. Real Time Windows Target), any routines you make with the DAQ toolbox will be subject to system interrupts that will limit how fast and how reliably you can process your data stream.
I doubt you can really do a REAL-TIME processing. There will always be a delay, particularly under MATLAB, as even Steven has stated above. If you are serious about the REAL-TIME performance I would suggest you to GIVE A SERIOUS THOUGHT to DSP hardware. Yet, there will be a delay but you will have a BETTER CONTROL on the overall processing than to keep guessing and playing around in optimizing your algorithms to achieve that real-time effect.
You may use MatLab simulink for on-line (not real time) acquisition and processing of the signal. The data acquisition tool box in maltab has the analog signal acquisition.
You can acquire signal through matlab (signal will be first recorded, than you will be able to access them) using following code:
a=audiorecorder(1000 (fs),24(bits),1(channels));
record(a);
(create some time gap, via loops or other methods)
I suggest you look at the playrec utility for matlab:
www.playrec.co.uk
This allows interface to the PortAudio library. It's relatively easy to use, and you probably would be surprised how easily you can interface to audio. You can also use ASIO with playrec, which is recommended over other APIs, if you're using Windows.
You could look at the demo scripts from the LTFAT (http://ltfat.sourceforge.net). The block-processing scripts like demo_blockproc_basicloop show how to do audio processing in real-time in Matlab.