How to record an audio from the Microphone block in simulink and save it to file on Raspberry Pi, or even do this on MATLAB

1 Ansicht (letzte 30 Tage)
This the block but how to save the output of it on raspberry pi NOT on host computer thanks.

Antworten (1)

Aravind
Aravind am 12 Mär. 2025
To save the recorded audio on the Raspberry Pi, you can use the "To File" block from the Simulink library. Add this block to your model and connect the output of the "From Microphone" block to the input of the "To File" block. The "To File" block will store the signals from its input into a MAT file. Configure this block to specify the file path where you want to save the audio data, such as /home/pi/audio_recordings/output.mat. Ensure this directory exists on your Raspberry Pi, or create it beforehand. Refer to the following documentation for more information on the “To File” block: https://www.mathworks.com/help/simulink/slref/tofile.html.
Next, deploy the model to the Raspberry Pi by configuring the hardware settings in Simulink to match your Raspberry Pi’s network details, including IP address, username, and password. Use the "Deploy to Hardware" feature to transfer and run the model on the Raspberry Pi. The model will run independently, capturing audio through the microphone and saving it directly to the specified file path on the Raspberry Pi’s storage.
For more information on configuring and deploying a Simulink model to Raspberry Pi hardware, you can refer to these documentation pages:
  1. Getting started with deployment onto Raspberry Pi - https://www.mathworks.com/help/simulink/supportpkg/raspberrypi_ref/getting-started-with-raspberry-pi-hardware.html
  2. An example explaining MAT file logging with deployment onto Raspberry Pi - https://www.mathworks.com/help/simulink/supportpkg/raspberrypi_ref/mat-file-logging-on-raspberry-pi-hardware.html
The captured audio will be stored in a MAT file, which you can later convert to other audio formats like WAV using MATLAB. For instructions on converting MAT files to WAV, see the following MATLAB answer: https://www.mathworks.com/matlabcentral/answers/306487-convert-mat-files-to-wav.
I hope this answers your question.

Kategorien

Mehr zu Raspberry Pi Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by