[linux-audio-dev] Sound file format detection?

Erik de Castro Lopo mle+la at mega-nerd.com
Mon Oct 3 13:15:38 UTC 2005


Mario Lang wrote:

> Hi.
> 
> My little time-compressing audio player yatm currently supports 3 different
> audio formats, ogg and speex via the xiph libraries, and mpeg via libmad.
> I currently just blindly try to launch the decoder for either ogg, speex or
> mp3 in series.  SO if the first fails, I try the second, and so on. Which
> kinda works but is a bit ugly.  I'd like to add flac support at some point,
> which would make this even more ugly.
> Additionally, libsndfile support wouldnt be that bad either, so, I am
> wondering, is there a reliable way to detect a audio streams file
> format just given some bits of the header?

For the vast majority of file formats yes.

>  So that I could set the
> appropriate decoder algorithm based on that analysis?  Or is
> there actually a library one step higher level than libsndfile which
> does generic audioformat to PCM?

Isn't that what libsndfile does?

BTW, the latest release of libsndfile supports FLAC via the same API 
as all the other formats.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
Spammer:     Any of you guys looking for a permanent position in Scotland?
Kaz Kylheku: No, I'm looking for a thug in Scotland who might be interested
             in beating up off-topic Usenet spammers, on a pro bono basis.



More information about the Linux-audio-dev mailing list