MATLAB Answers

Raspberry Pi Simulink DAQ problem with ALSA Audio Capture block

6 ビュー (過去 30 日間)
Graziano Ullucci
Graziano Ullucci 2014 年 3 月 5 日
コメント済み: JUN WANG 2018 年 6 月 8 日
Hallo, I need to read and work into a matlab code block with the data coming from the ALSA Audio Capture block inside Simulink frame. I'm using Matlab r2013a and matlab r2013b, with raspberry Pi Simulink libraries.
That's because i need to develope a special audio analysis.
So my question is: How can I read the stream of data coming from the "Raspberry Pi Audio Capture" block, and modify them before to "plot" or "record" the modified data into a file?
And how to plot such a kind of data in a streaming plot?
And how to record such a kind of data into a file?
Thank you!

  1 件のコメント

Graziano Ullucci
Graziano Ullucci 2014 年 6 月 11 日
I already have an USB soundcard working on RaspberryPi. I've been able to "plot" the data stream with the SDL video display on the HDMI raspberry pi monitor. It's easy you only have to saturate the RapberryPi CPU calculation capability to do that with your own "handmade plot function"!!! Very "GOOD". About all the commands that starts with "h=raspberry"..... they doesn't work ON RASPBERRY !!! You are supposed to know that!!! they work on the host PC that WILL NOT BE USED IN THE FINAL PROJECT !!!!

サインインしてコメントする。

回答 (2 件)

Murat Belge
Murat Belge 2014 年 3 月 17 日
Raspberry Pi has no built-in audio recording device. You need to attach a USB soundcard to your Raspberry Pi to record audio.
If you want to visualize audio data in MATLAB, I would suggest you first record it to a file in Raspberry Pi and bring it into MATLAB for analysis. You can then use this data in a Simulink model to perfect your algorithm. To record data from an attached soundcard:
>> h = raspberrypi >> h.execute('arecord -d 10 sound.wav') >> h.getFile('sound.wav')
You can then read the captured data in MATLAB using wave reader. You can also use the recorded data in Simulink using 'From Multimedia File' block in DSP System Toolbox. Once you perfected your algorithm, you can use the 'ALSA Audio Capture' block to realize your algorithm in real-time on Raspberry Pi.

  1 件のコメント

JUN WANG
JUN WANG 2018 年 6 月 8 日
Hi I have an USB external soundcard to my Rasp, how do I listen to it's microphone?

サインインしてコメントする。


Siriphat
Siriphat 2014 年 6 月 13 日
Hello, I understand that in order to show the plot through HDMI monitor, one needs to write own plot function to display using SDL video. Is it like implementing the code in the function in Matlab function toolbox in Simulink? But I understand that SDL video accept the input in YUV/RGB uint8 format. How could one do that? Could you please clarify this?
Thank you very much in advance.

  2 件のコメント

Graziano Ullucci
Graziano Ullucci 2014 年 6 月 13 日
I've sent you an email with the best help I can. have a Nice day :-)
Siriphat
Siriphat 2014 年 6 月 13 日
Thank you very much.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by