How to audiowrite a soundfile from m4a to wav?
조회 수: 16 (최근 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!