I setup a simple simulink circuit consisting of a sine wave generator, a speaker ('to audio device' - block), a microphone ('from audio device' - block) and a 'To workspace' - block. The purpose is to play the sinus trough my loudspeaker, recording it AT THE SAME TIME with my microphone and then write the recorded signal to the MATLAB workspace. This all goes well but when I plot the recorded signal in MATLAB I get alternating zero - sine wave - zero - sine wave - zero - and so on... This while I expect a continuous (noisy) sine wave...
What could be the problem? I'm working under Linux. Maybe it is because of the linux scheduler which gives both tasks (play & record) alternating some processor time. Has anybody a solution?
Thanks
Subject: Simulink: playing and recording audio at the same time
Finally I found the solution by myself after searching for more then a week. Matlab is using the open source library "portaudio" (http://www.portaudio.com/) for the "to/from audio devices". Originally this library is compiled for the linux "open sound system" (OSS) driver while I was using ALSA. So you have to download the source code for portaudio from the website, compile it and then copy the library into your matlab install directory (matlab_install_dir/bin/glnx86).
Procedure:
- Download and unpack portaudio source code
- In portaudio dir type:
./configure && make
make install
(The driver you are using will automatically be found)
- Copy libportaudio.so to matlab_install_dir/bin/glnx86
Subject: Simulink: playing and recording audio at the same time
Finally I found the solution by myself after searching for more then a week. Matlab is using the open source library "portaudio" (http://www.portaudio.com/) for the "to/from audio devices". Originally this library is compiled for the linux "open sound system" (OSS) driver while I was using ALSA. So you have to download the source code for portaudio from the website, compile it and then copy the library into your matlab install directory (matlab_install_dir/bin/glnx86).
Procedure:
- Download and unpack portaudio source code
- In portaudio dir type:
./configure && make
make install
(The driver you are using will automatically be found)
- Copy libportaudio.so to matlab_install_dir/bin/glnx86
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.