cmaddex
cmaddex

Reputation: 23

Listening to waveforms

In Matlab I want to hear the differences between what two waveforms sound like. What is the function used to listen to audio in Matlab? For example I have two waveforms from a file

wav1 = wavread('audio1.wav');
wav2 = wavread('audio2.wav');

how am I able to play these waveforms over my speakers?

Upvotes: 2

Views: 154

Answers (3)

banebane
banebane

Reputation: 1

You should try sound(wav1, 22050). Of course, if you need higher sample rate, you can always change it. You could use just sound(wav1) - however, you should always specify sample rate in order to make sure you hear the waveform properly.

Upvotes: 0

Curtis Eugene Maddex
Curtis Eugene Maddex

Reputation: 91

The Matlab command to play a waveform is the sound command. it is used like so:

sound(wav1,F1);
sound(wav2,F2);

where F1 and F2 are the frequency used in playback. you can obtain the frequency from an audio file using your same wavread command thusly:

[wav1,F1,Nbits1] = wavread('audio1.wav');

where Nbits1 is the number of data points in the audio file.

Upvotes: 4

plesiv
plesiv

Reputation: 7028

Check out sound and soundsc functions.

Upvotes: 2

Related Questions