I would like to read a wav file and play it in octave. I am using octave 3.4.0 on fedora 12. This is my code -
1.
[audio_samples,fs] = wavread("myaudio.wav"); sound(audio_samples,fs);
To this octave complained that "Sound function is not implemented"
Then I tried
[audio_samples,fs]开发者_运维技巧 = wavread("myaudio.wav"); playsound (audio_samples);
To this I get following from octave -
error: Invalid call to playaudio.
- Upon some preliminary debugging for #2 above I see that playaudio(x) function first checkswhether x is a vector or not. For me this check is failing, because I see that isvector(audio_samples) returns zero. My question to experts is - "how can I convert (typecast) my variable audio_samples, to be a vector so that my playaudio function works ?
Wavread should return a matrix with one column per audio channel. To listen to the first channel, you could therefore call:
playaudio(audio_samples(:,1), fs);
精彩评论