Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

read/write an online .wav file in matlab?

Tags:

html

url

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.

like image 480
Jhogg Avatar asked Dec 14 '25 17:12

Jhogg


1 Answers

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

like image 114
bla Avatar answered Dec 17 '25 07:12

bla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!