How to output audio signal/data signal via speakers using Matlab?

Status
Not open for further replies.

chihwt2003

Newbie level 6
Joined
Jul 7, 2005
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,399
Hi,

Does anyone knows how to output audio signal (sine wave) or data signal aquired out from a speaker using Mathlab?

Thanks
 

Mathlab - Sound

Do you mean MATLAB?

Here's how to read a wav file and play it. You can substitute your sample array for the wavread function.
wavplay(wavread('soundfile.wav'), 22050);

The word MATLAB means "matrix laboratory".
 

Re: Mathlab - Sound

Thanks. However, what I want is to output the signal after sampling out a data waveform using simulink, not importing wave file or any other audio file to play.
 

Mathlab - Sound

I don't know anything about simulink, but if it outputs an array of data points, then you can substitute it for the wavread function.

mydata = sin(1:10000);
wavplay(mydata, 22050);
 

Re: Mathlab - Sound

you can use either "wav" file output or the "sound" command
if it is a simple simulation, like outputting a sine wave you can use the sound command.
to know the attributes iof the command go to the command window in matlab and type " >>help sound"
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…