简体   繁体   中英

read/write an online .wav file in matlab?

I am currently working on a signal processing lab for school that requires me to download and analyze a .wav file. I was wondering if there was a way to wavread() or wavwrite() a URL so I don't have to re-download the audio file every-time I move to a new computer or send the code to the members of my group?

All the files can be found here .
And this is the url for one of the .wav files: http://www.soe.uoguelph.ca/webfiles/sgregori/Audio/speech.wav

I have tried urlread() and urlwrite() but to be honest I don't quite understand what to do with the html coding. I have also tried:

[x,fs]=wavread('http://www.soe.uoguelph.ca/webfiles/sgregori/Audio/speech.wav');

but ended up with the error:

Error using wavread (line 67)
Invalid Wave File. Reason: Cannot open file.

I am also using the student version of Matlab so maybe that is the issue?

Any help would be greatly appreciated!

Thank you.

This should work:

urlwrite('http://www.soe.uoguelph.ca/webfiles/sgregori/Audio/speech.wav','s1.wav');

This saves a file s1.wav to the directory you work on. Then line

[x,fs]=wavread('s1');

should work fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM