problem reading wav file
18 views (last 30 days)
Show older comments
DOORYODHUN AHKU
on 5 Apr 2021
Answered: Krishna bharath Gali
on 20 Apr 2024
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
[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
Accepted Answer
Walter Roberson
on 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.
0 Comments
More Answers (1)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!