Jhogg
Jhogg

Reputation: 109

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.

Upvotes: 3

Views: 1596

Answers (1)

bla
bla

Reputation: 26069

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

Upvotes: 4

Related Questions