Re: Converting wav to mp3
Re: Converting wav to mp3
- Subject: Re: Converting wav to mp3
- From: Robert Martin <email@hidden>
- Date: Wed, 13 Dec 2006 07:56:26 -0500
NSTask is a good way to go - Like Andrew says, just copy the tool
into your app's bundle and set the task path to [[NSBundle mainBundle]
pathForResource:@"lame" ofType:nil].
To get a 'quick and dirty' progress indicator working, use LAME's --
disptime n option (2 or 3 secs interval works well) and provide a
fileHandle for reading standardError (which is where LAME will send
its output). Just parse the standardError string you'll get from the
fileHandle's availableData (in a loop) to get the percentage completed.
Because mp3 conversions take quite a bit of time, you might want to
consider putting the whole conversion process on a separate thread,
so you can support 'Cancel' and avoid the spinning ball.
On Dec 13, 2006, at 7:16 AM, Andrew Farmer wrote:
On 13 Dec 06, at 02:33, David Brennan wrote:
I am tring to convert a wav file to mp3. I have found the LAME
library, but don't know how to use it in Cocoa. Is there any examples
of how to do this, or should I use a different library.
You may be better off packaging the lame command-line tool with
your program and launching it with NSTask. Parsing the output will
be a bit tricky, but you don't have to worry as much about
threading this way. Also, it's a lot easier to install a new
version of the executable than it is to upgrade the library.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden