Re: How to use this AudioFile info thing?
Re: How to use this AudioFile info thing?
- Subject: Re: How to use this AudioFile info thing?
- From: Brian Willoughby <email@hidden>
- Date: Thu, 5 May 2005 13:12:41 -0700
[ Your previous post implied that there are file formats of which you can only
[ determine the duration by "parsing the entire file". This is never required
[ for WAVE or AIFF, or for any sane soundfile format, because the length in
[ sample frames can be directly got from the header (at the beginning of the
[ file, we hope!).
This is not precisely true.
WAVE does not include the duration in the format "header" chunk - you must
compute the duration from the length of the sound data chunk, divided by the
average bytes per second (or a combination of channels, rate, and sample size).
AIFF does include the frame count in the common "header" chunk, but some
programs create AIFF with conflicting values compared to the sound data chunk
length. Obviously, those files are not valid, but the Finder seems to get the
duration correct.
Neither of the above require "reading" the entire file, but they do require
"parsing" the entire file. As chunk-based formats, both RIFF/WAVE and
FORM/AIFF make (almost) no guarantees about the order of chunks. Therefore, it
is often true that every chunk must be read. I'm not sure if this is what is
meant by "parsing the entire file" but I couldn't help being pedantic and
pointing out that there is no "header" per se in either format, at least not in
the sense of traditional file headers (which occur only at the head of the
file, as the term implies).
Brian Willoughby
Sound Consulting
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden