Re: Quicktime Audio Extraction
Re: Quicktime Audio Extraction
- Subject: Re: Quicktime Audio Extraction
- From: Jens Alfke <email@hidden>
- Date: Tue, 25 Oct 2005 08:50:20 -0700
On 25 Oct '05, at 8:06 AM, nugen wrote: I use Quicktime to load mp3/aac files and extract audio in PCM format for using it in my application. I tried to use different things in quicktime (MovieAudioExtractionFillBuffer/SoundConverterFillBuffer/PutMovieIntoTypedHandle) and find out that the most efficient is SoundConverterFillBuffer. It needs 6s to 10s to decompress datas for a 8mn track (depending on the hardware). When i launch Quicktime Player and load the same mp3, it is instantly available and playable wherever i play the track (beginning or end).
An audio player isn't going to decode the whole file ahead of time. Instead it decodes on the fly as it plays. Typically a background thread reads the file and decodes into a small fixed-size buffer, while the audio thread reads from the buffer. The reader thread just needs to keep ahead of the player thread so there are always samples available to play.
The CoreAudio SDK has sample code showing how to do this -- see the CAAudioFileStreamer class in PublicUtilities. If you're on 10.4 (Tiger) there's a built-in AudioUnit that plays files, which makes the code much simpler -- see the PlayFile.cpp sample.
What is your app trying to do with the audio? If all you need to do is play MP3s, the high-level QuickTime APIs are probably the simplest to use, especially QTKit on Tiger. You can write a basic audio player in less than half a page of code with QTKit, and the developer docs have a tutorial showing you how to do exactly that.
--Jens |
_______________________________________________
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