wavwrite- wave file must be a string?

2 views (last 30 days)
Brishna
Brishna on 14 Sep 2011
I am a newbie to matlab. I am trying to create a simple sound using matlab, just as practice for a project. I first created a vector(y) and made that a sound using:
sound(y,96000)
Now i am trying to convert this sound to .wav using
wavwrite(y,Fs,filename)
wavwrite(y,96000,f).
I created the a the function f to be the "filename".
but when i comman wavwrite(y,96000,f), it keeps giving me an error of: "wave file must be a string".
I believe f is the wavefile. I am not really sure what kind of file or function that needs and what does it mean for a wave file to be a string. I have been googling for a little while now and no luck.
If any of you could help, that would be greatly appreciated.
Thanks

Answers (1)

Walter Roberson
Walter Roberson on 14 Sep 2011
I do not understand your sentence, "I created the a the function f to be the "filename"."
Example of use:
f = 'mysound.wav';
wavwrite(y,96000,f);

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!