How to audiowrite a soundfile from m4a to wav?
23 次查看(过去 30 天)
显示 更早的评论
Hello!
I want to write an audiofile from m4a to wav? I thought it was easy, but I miss something I guess..
This is what I'm doing:
load hoi.m4a
filename='hoi.wav'
audiowrite(filename, y, Fs)
This is what the help function says, but what am I supposed to fill in on y and Fs?
Thanks!
0 个评论
采纳的回答
Geoff Hayes
2016-7-5
m4AFilename = 'hoi.m4a';
[y,Fs] = audioread(m4AFilename);
wavFilename = 'hoi.wav';
audio write(wavFilename,y,Fs);
Try the above and see what happens!
3 个评论
Geoff Hayes
2016-7-7
Laura - presumably it isn't working because you haven't defined the y and Fs and so the line
audiowrite(filename, y, Fs);
fails. Is that correct? If so, then you need to define them
y = getaudiodata(r);
Fs = get(r,'SampleRate');
更多回答(1 个)
Thorsten
2016-7-5
Use audioread to read the m4a. audioread returns y and Fs, and you can pass these to audio write:
[y, Fs] = audioread('hoi.m4a');
audiowrite('hoi.wav', y, Fs)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!