Re: Advice on encoding possibilities
Re: Advice on encoding possibilities
- Subject: Re: Advice on encoding possibilities
- From: William Stewart <email@hidden>
- Date: Mon, 26 Apr 2004 11:41:14 -0700
On 23/04/2004, at 11:36 PM, Zuhayr Khan wrote:
>
Hi,
>
>
I want to write an application that takes an MP3 file and splits in
>
into multiple MP3 files whenever there's a gap of silence in the
>
audio.
>
>
I want to use CoreAudio to do this, but in my first few bits of
>
exploratory programming I'm finding some issues. I'm not sure if it's
>
that I'm not hitting the API correctly, or that there are limitations.
>
>
The way I'm anticipating this program working is:
>
>
* build an AUGraph
>
* hook up input file with an MP3->LPCM AudioConverter
>
* hook up and create first MP3 output file
>
* read in chunks of the MP3 file and convert them to LPCM
>
* have an AudioUnit that senses the gaps in the LPCM and returns fake
>
EOF
>
* have the output file flushed and closed off and a new one created
>
* repeat for the remainder of the MP3
>
>
The first problem I'm getting is while I can get AudioFile to create
>
me a nice new MP3 file, I can't get/configure an AudioConverter to
>
convert from LPCM to MP3. I'm guessing this is because there isn't a
>
Codec in the system that will do LPCM->MP3.
Yes that's correct. You'd have to start with an MP3 file.
>
I'm not wedded to the idea of doing the gap detection against LPCM -
>
but I'm assuming this is the way to do that kind of thing - obviously
>
if there's some cleverness that means I don't have to convert, then so
>
much the better.
>
>
Listing my available Audio Components, I saw there was an LPCM->AAC so
>
I thought I'd give that a try (I figured that maybe it being an MP4
>
format it might then allow me to do an MP3 to MP4 somehow else) -
>
however, while I can get a AudioConverter for LPCM->AAC, AudioFile
>
won't create me a file - I think this is possibly a red herring, but
>
thought I'd mention it.
It will for AAC - have a look at the afconvert code in the new Audio
File tools. That will create an adts file for AAC from LPCM.
>
>
I think I've understood from the CoreAudio docs and other sources that
>
an AudioConverter effectively wraps a Codec - am I right? And if so;
>
if there isn't an LPCM->MP3 facility available right now should I be
>
looking to write or get hold of a LPCM->MP3 Codec?
Yes.
>
>
I think in other postings I've heard suggestion that some conversions
>
are not supported right now; is there a schedule for other Codecs?
>
>
I think the only other question I have is about Multi-Threading.
>
Looking though some of the CoreAudio example code I see quite a bit of
>
Multi-Threading especially in PlayAudioFile and DiskWriterAUGraph. I
>
understand the need for these apps to be multi-threaded, but wanted to
>
understand in general the idea behind having multi-threaded code in
>
CoreAudio-based apps.
I'd recommend having a look at the new audio file tools... but
essentially the reasoning behind these are all the same. You can't do
file I/O on the same thread that you are doing audio I/O to a device
(the HAL's I/O thread)..because the HAL's I/O thread is running on a
tight schedule, and file I/O can block (thus causing you to miss your
deadline).
>
As my application is very much an offline processing application, do I
>
need to go with the multi-threaded way of working, or should I be able
>
to do my processing all in one thread? (I don't mind writing
>
Multi-Threaded code and I see that CoreAudio has nice support for it -
>
but I just want to understand whether it's a necessity of the API or
>
just of certain apps).
Not really - in an off-line case you can do it all single threaded (the
auprocess does just this where it takes an audio file and processes its
contents through an Audio Unit - also in the audio file tools project).
Bill
>
>
Sorry it's such a big bundle of questions, any help on this from
>
anybody would be very much appreciated.
>
>
Thanks in advance,
>
>
Zuhayr
>
>
--
>
>
Zuhayr Khan
>
>
_________________________________________________________________
>
It's fast, it's easy and it's free. Get MSN Messenger today!
>
http://www.msn.co.uk/messenger
>
_______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
Do not post admin requests to the list. They will be ignored.
>
>
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
________________________________________________________________________
__
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.