Audio File Type Recognition Question
  Home FAQ Contact Sign in
microsoft.public.win32.programmer.directx.audio only
 
Advanced search
POPULAR GROUPS

more...

microsoft ... directx.audio Profile…
 Up
Audio File Type Recognition Question         


Author: Yaerek
Date: Jul 22, 2008 01:45

Hi. I'm writing an application that has to load/play audio files. It has to
run on XP/Vista (and Mac OS X) Question is, how to recognize a type of audio
file we're loading? Basically, I want to know what kind of audio file I got
in order to properly handel it (mp3, wav, wma, aac, au). I understand I can
"recognize" a file type based on its extension, however that does not
guarantee what's inside; wav container can store several different formats.
How to recognize which one I'm facing? Should it only be based on file
extension?
2 Comments
Re: Audio File Type Recognition Question         


Author: Shugo_Ishida
Date: Jul 22, 2008 07:10

Hi.
You might want to recognize after you read some bytes from an audio file.
For example, Wav format file has "RIFF" at head.
Also, MP3 format file has frame headers consist of 4 bytes which contains 12
bits as synchronous signal. (0xfff)

I unknown detail of wma, aac and au formats.
Thislink might help you.
ASF spec:
http://www.microsoft.com/windows/windowsmedia/forpros/format/asfspec.aspx
Show full article (1.08Kb)
no comments
Re: Audio File Type Recognition Question         


Author: Alessandro Angeli
Date: Jul 22, 2008 17:56

From: "Yaerek"
> Hi. I'm writing an application that has to load/play
> audio files. It has to run on XP/Vista (and Mac OS X)
> Question is, how to recognize a type of audio file we're
> loading? Basically, I want to know what kind of audio
> file I got in order to properly handel it (mp3, wav, wma,
> aac, au). I understand I can "recognize" a file type
> based on its extension, however that does not guarantee
> what's inside; wav container can store several different
> formats. How to recognize which one I'm facing? Should it
> only be based on file extension?

As Shugo told you, there is no generic way: you need to read
the beginning of the file ad try to make sense of it
comparing its contents to a list of templates of each type
you plan on supporting. This is exactly what e.g. DirectShow
does when asked to find a source filter.
Show full article (1.93Kb)
no comments