开发者

Reading and playing sound in Octave on Fedora12

开发者 https://www.devze.com 2023-02-13 12:17 出处:网络
I wouldlike to read a wav file and play it in octave. I am using octave 3.4.0 on fedora 12. This is my code -

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"

  1. Then I tried

    [audio_samples,fs]开发者_运维技巧 = wavread("myaudio.wav"); playsound (audio_samples);

To this I get following from octave -

error: Invalid call to playaudio.

  1. 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);
0

精彩评论

暂无评论...
验证码 换一张
取 消