How do I convert a .wav file to a .matlab file using wavread?

조회 수: 58 (최근 30일)
Angela Burgess
Angela Burgess 2019년 8월 15일
댓글: Star Strider 2019년 8월 15일
Can anyone help please? I am trying to use wavread to convert .wav to .matfiles but I am getting a message saying "undefined function or variable 'wavread'.
For example one of my named sound files: y = wavread('barber-s-01-t1.wav')
Or is there another way of converting to .mat files?
Any suggestions would be much appreciated.
Thanks in advance.

답변 (1개)

Star Strider
Star Strider 2019년 8월 15일
The wavread function was deprecated a while ago. Use the audioread function (R2012b and later versions) instead.
  댓글 수: 2
Angela Burgess
Angela Burgess 2019년 8월 15일
Thank you.
So I typed this: [y,Fs] = audioread('barber-s-01-t1.wav') which seemed to work.
Then how do i actually convert or save it to a .mat file?
Sorry if I seem completely cluless (because I am!). I am trying to get some understanding of Matlab!
Star Strider
Star Strider 2019년 8월 15일
My pleasure.
Create a name for the output file (I call it ‘soundfile.mat’ here), then save ’y’ and ‘Fs’ to your .mat file:
save('soundfile.mat', 'y', 'Fs')
You need to save ‘Fs’ (and any metadata as well) to it. In your workspace, ‘y’ will exist as a one- or two-column double array, and ‘Fs’ as a scalar.
Also, when you read it, load it into a variable to create a structure. You can then rename any parts of it to whatever variable names you want, not necessarily the variable names that exist in the .mat file. See: Load List of Variables into Structure Array

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Standard File Formats에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by