Filter löschen
Filter löschen

problem reading wav file

15 Ansichten (letzte 30 Tage)
DOORYODHUN AHKU
DOORYODHUN AHKU am 5 Apr. 2021
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 Kommentar
DOORYODHUN AHKU
DOORYODHUN AHKU am 5 Apr. 2021
Thank you very much Walter. Thats help.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 5 Apr. 2021
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.

Weitere Antworten (1)

Krishna bharath Gali
Krishna bharath Gali am 20 Apr. 2024
How to upload the audio file

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by