problem reading wav file

10 ビュー (過去 30 日間)
DOORYODHUN AHKU
DOORYODHUN AHKU 2021 年 4 月 5 日
回答済み: Krishna bharath Gali 2024 年 4 月 20 日
hi,
I created a folder in drive C on users. I copied the audio file .wav in it. i opened live Editor and did Alt/enter to create a text area and typed 'Assignment'. I then pressed Ctrl S to save it as 'Assignment _task' mlx onto the 'Assignment' folder in C. both the audio file and Mxs file appeared on matlab's 'my folder'. I then pressed Alt/enter to get into Code area. In Code area, i typed 'audioread('the wav file') and pressed Ctrl /enter. I came out with error as follows:
The file type is not supported
Error in audioread (line 136)
[y, Fs] = readaudio (filename, range, datatype);
my question are 1./ of how can i get the 'range' and know the 'datatype'?2./ why it said 'audioread>readaudio and error in 'audioread' 3./ am i supposed to get x and Fs and rows and column?
Can anyone help me of how to read the audio please?
thank you
D.A
  1 件のコメント
DOORYODHUN AHKU
DOORYODHUN AHKU 2021 年 4 月 5 日
Thank you very much Walter. Thats help.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2021 年 4 月 5 日
of how can i get the 'range' and know the 'datatype'?
The code for audioread() says
if nargin < 2
range = [1 inf];
datatype = 'double';
elseif nargin < 3 && ischar(range)
datatype = range;
range = [1 inf];
elseif nargin < 3
datatype = 'double';
end
You are not passing in anything other than the file name, so nargin < 2 so it is going to default to range [1 inf] and datatype 'double' .
That is, it is going to default to reading all of the file, and to returning the data as values in the range -1 <= x <= 1
Unless you have special requirements, those are the defaults that you want.
why it said 'audioread>readaudio and error in 'audioread'
The file type is not supported
Did you use a file name ending in .wav ? Did you use the .wav extension as part of the file name when you did the audioread() -- you should.
Also, some .wav files are not supported on some systems, as they require audio encoding schemes that are not supported on the system. You can see https://superuser.com/questions/72302/how-do-i-find-out-the-audio-format-of-a-wav-file/72340 for information on how to inquire about what audio encoding system the file is designed for.

その他の回答 (1 件)

Krishna bharath Gali
Krishna bharath Gali 2024 年 4 月 20 日
How to upload the audio file

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by