Forums

Why can Matlab wavread() not read AAC .wav reference files?

Started by larr...@yahoo.com November 23, 2005
I try to use wavread() function to open/read .wav reference files for
AAC (MPEG-2 AAC) compliance test provided by ISO/MPEG (ISO/IEC
13818-4). But I got the error message "Data compression format (Format
#65534) is not supported". However, there is no problem for Adobe
Audition and Microsoft Windows Media Player to open and play them. I'd
appreciate it if anybody could tell me the reason why Matlab cannot
open them and the method to fix it. I'm using Matlab Version 7 and
release R14.

larry_allen_ca@yahoo.com wrote:
> I try to use wavread() function to open/read .wav reference files for > AAC (MPEG-2 AAC) compliance test provided by ISO/MPEG (ISO/IEC > 13818-4). But I got the error message "Data compression format (Format > #65534) is not supported". However, there is no problem for Adobe > Audition and Microsoft Windows Media Player to open and play them. I'd > appreciate it if anybody could tell me the reason why Matlab cannot > open them and the method to fix it. I'm using Matlab Version 7 and > release R14. >
type help wavread in matlab to find the answer ;) ps: just open it with audition and save as a microsoft pcm wav file
The comments in wavread.m include:
"% NOTE: This file reader only supports Microsoft PCM data format."

That should be a clue that wavread.m provides only limited capabilities
(PCM format) in reading .wav files.  The RIFF (.wav) file format
provides for many different data compression formats, but wavread.m
doesn't handle such formats.  The fact that Audition and WMP support
AAC is useful, but irrelevant to MATLAB.  You'll need to implement AAC
decompression yourself or find another MATLAB implementation that does;
a quick search of MATLAB Central fails to show any such.  Good luck!

I have used the wavread() function hundred times if not thousands of
times for several years. But I don't understand why I cannot use it to
open MPEG-2 AAC reference compliance test sequences provided by
ISO/IEC.

Using Audition to save as Microsoft .wav or .pcm is an alternative
solution to the problem. But it is not convenient since I'd like to use
Matlab script to test hundreds of test sequences.

For my understanding, the RIFF .wav file format is just PCM data plus
header (I've generated .wav files using C/C++ code myself). There is no
any data compression. What are "different data compression formats"?
I'm confused. And I still don't understand why wavread() function
cannot open it!

Ah, that's where your understanding is incomplete.  PCM is only one of
many forms in which audio data may be stored in such a file.  Other
forms are A-law and mu-law 8-bit logarithmic compression, several ADPCM
algorithms, A-law and mu-law 8-bit logarithmic compression, and others.
 I don't have a comprehensive reference for .WAV file format, but you
could start with http://www.sonicspot.com/guide/wavefiles.html, and try
googling for others.

I don't know for a fact that AAC compression is present, or what kind
of compression is used in the files you are attempting to read, but
wavread()'s error message results from interpreting the Format (fmt)
chunk in the file and finding a compression code (65534) that it can't
handle.  Perhaps you should seek further information on the file format
for those files you wish to use.


larry_allen_ca@yahoo.com wrote:
> I have used the wavread() function hundred times if not thousands of > times for several years. But I don't understand why I cannot use it to > open MPEG-2 AAC reference compliance test sequences provided by > ISO/IEC.
There has to be code in the function to handle the type. I had to add my own code to wavread() and wavwrite() to get support for single precision IEEE floating point .wav files. The wavread() and wavwrite() functions are there in source form for you to debug and modify to handle the type that you are giving it. That presupposes that you know the format of what you are giving it and can program Matlab. Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
I misspoke when I assumed above that your .WAV file was AAC-compressed.
 I've recently learned that the symptom you reported, "Data compression
format (Format
#65534) is not supported", indicates that the file's format is
WAVE_FORMAT_EXTENSIBLE, which apparently is a newer format for
multi-channel data and data with >16 bits per sample.

I don't know all the details, but I've found some info at:
  http://hul.harvard.edu/jhove/wave-hul.html
  http://www.ambisonic.net/mulchaud.html

The more important information in previous replies, however, stands:
wavread()'s capabilities for file format are very limited, and
WAVE_FORMAT_EXTENSIBLE is beyond what it can do.

Jerry Wolf wrote:

> I misspoke when I assumed above that your .WAV file was AAC-compressed. > I've recently learned that the symptom you reported, "Data compression > format (Format > #65534) is not supported", indicates that the file's format is > WAVE_FORMAT_EXTENSIBLE, which apparently is a newer format for > multi-channel data and data with >16 bits per sample. > > I don't know all the details, but I've found some info at: > http://hul.harvard.edu/jhove/wave-hul.html > http://www.ambisonic.net/mulchaud.html > > The more important information in previous replies, however, stands: > wavread()'s capabilities for file format are very limited, and > WAVE_FORMAT_EXTENSIBLE is beyond what it can do. >
Matlab m files to read and write this are available from: http://acoustics.aau.dk/~sc/matlab/wavex.html I have only head about these today, and have yet to try them out. Hopefully they will work in Octave too, which is as close as I can get to matlab! Richard Dobson