How to play array as sound in Simulink?

4 ビュー (過去 30 日間)
Zeljko Tomicevic
Zeljko Tomicevic 2018 年 1 月 12 日
回答済み: Abhishek Ballaney 2018 年 1 月 12 日
Hello, There is sound(y,Fs) function in Matlab to play array in audio device. In my case y is one dimensional array long 10000 and Fs = 2000. I can not use Audio Device Writer block in Simulink since it has minimum limitation of Fs = 8000. In Simulink I have to use User defined block with sound(y,Fs) function with coder.extrinsic('sound'), but function does not work in .exe file made from Simulink model (simulation model works). Question is how to play y array as sound? y array is made from 0 and 1, so if there is an event of interest there should be heard an impulse from the speaker.
function fcn(u)
coder.extrinsic('sound');
sound(u,2000);
This works in simulation but not in .exe. What is the substitute for sound() in Simulink? Best

回答 (1 件)

Abhishek Ballaney
Abhishek Ballaney 2018 年 1 月 12 日
https://in.mathworks.com/help/audio/gs/real-time-audio-in-simulink.html

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by