Decoding compressed to LPCM
Decoding compressed to LPCM
- Subject: Decoding compressed to LPCM
- From: Aurélien Ammeloot <email@hidden>
- Date: Mon, 21 Apr 2008 14:48:48 +0100
Hi,
I'm basically looking forward to decode any kind of supported
compressed audio (well, at least aac and mp3) and writing a LPCM
(.wav) file from it.
I really don't get it.
I'm working with ExtAudioFile, but I can't figure out how to set the
decoder correctly.
This is, so far, how I proceed. It is loosely based on Apple's
"ConvertFile" example, but I'm afraid the documentation and the sample
code still don't help me get it, so it's basically "blind coding"...
1. Open original audio file in ExtAudioFileRef (works).
2. Create an AudioStreamBasicDescription
3. Set the AudioStreamBasicDescription (9 fields) manually for linear
PCM 44100 16bits stereo. Any other way to do that ?
4. Set the the original audiofile's "client format" to the
AudioStreamBasicDescription created above
5. Creating a new ExtAudioFile at destination with the
AudioStreamBasicDescription created above as format.
6. Creating buffers and copying frames. (same loop as sample code)
So it outputs a file which occupies, I presume, the right size on the
hard disk (approx 10 MB per minute of sound) but is not playable, or
sometimes a 4 kilobyte file.
What did I not understand in the process above ? What is / are the
missing steps ?
Is there any higher-level way to achieve this ? All I really need is
programmatically convert compressed audio to WAV, no fuss, no fancy,
like anyone would do with iTunes or Quicktime Player. Or like other
APIs would convert PNG to JPG images with a single line of code. I
don't want to access channels or frames individually. Quicktime API
maybe ?
This starts being quite a bummer actually there is no real step-by-
step tutorial available for such tasks that some non audio specialists
might want to do.
Thanks for any help,
Aurélien _______________________________________________
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