Error using audioDatastore/read (line 25)

5 views (last 30 days)
Zihui Cai
Zihui Cai on 3 Mar 2021
Commented: Walter Roberson on 29 Jun 2021
I have run my program on my MacBook (R2020a), there is no such error, however, after i copied my whole program to another Windows computer (R2019a) there is a error message for Error using audioDatastore/read (line 25)
Error using audioDatastore/read (line 25)
File could not be read due to an unexpected error. Reason: File contains data in an unknown format.
However, the audio files in the folder are all in .wav format.
Could you please help to check what's wrong with this?

Answers (1)

Walter Roberson
Walter Roberson on 3 Mar 2021
Wav files permit a number of different codecs (algorithms for encoding data). The software used to decode is sort of like a plug-in, not necessarily present unless installed. Your Mac has the kind of codec software needed to read the files, but the other computer does not.
Sometimes it is easiest to use VLC to examine the file to find out the signature of the codec, which is a 4-letter code that indicates which codec is needed.
  10 Comments
Abdul Gaffar
Abdul Gaffar on 29 Jun 2021
audioread produces the same error as follows:
Error using audioread (line 104)
File could not be read due to an unexpected error. Reason: File contains data in an unknown format.
Error in Audio_Plot (line 5)
[y, Fs] = audioread('splat.wav'); % y samples from audio with Fs sampling frequency in [Hz].
Walter Roberson
Walter Roberson on 29 Jun 2021
Please use a tool to identify the CODEC for your .wav file. You can find several listed at https://superuser.com/questions/72302/how-do-i-find-out-the-audio-format-of-a-wav-file/72340
Personally I find VLC to be useful to have around, so that is what I use.
Also, which operating system are you using?

Sign in to comment.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!