Re: usage of afconvert with NSTask
Re: usage of afconvert with NSTask
- Subject: Re: usage of afconvert with NSTask
- From: tahome izwah <email@hidden>
- Date: Tue, 19 Oct 2010 16:18:35 +0200
Why bother - use miniAIFF
(http://www.dspdimension.com/admin/miniaiff/) or the ExtAudioFile
classes from the Dirac2 LE iPhone project at
http://www.dspdimension.com/download/
Disclaimer: I am not affiliated with that web site or it's owner, but
I perused these examples a couple of times for my own projects and
found them to be very helpful.
--th
2010/10/14 email@hidden <email@hidden>:
> Hi,
> I want to use the afconvert utility to convert files to aifc inside of my
> application using NSTask.
> In the terminal it works with :
> afconvert /Users/book/Desktop/test.wav -d BEI24
> /Users/book/Desktop/test.aifc
> In Xcode I have a problem with the arguments, I get messages like:
> " missing argument to '-d' option"
> "Couldn't infer file format from data format 1 ch, 0 Hz, 'lpcm'
> (0x0000000E) 24-bit big-endian signed integer"
> "Error: Couldn't open input file (-43)"
> Can anybody please tell me how to set up the arguments correctly ?
> Or does somebody have a working example ?
> Thank you
> Karsten
>
> -(void) aifcgenerator
> {
> PathName = [paths objectAtIndex:0]; // Pathname and path are global
> NSTask *aifctask = [[[NSTask alloc] init] autorelease];
>
> [aifctask setStandardOutput: [NSPipe pipe]];
> [aifctask setStandardError: [aifctask standardOutput]];
> [aifctask setLaunchPath:@"/usr/bin/afconvert"];
> [aifctask setArguments:
> [NSArray arrayWithObjects:
> @"-d",
> @"BEI24",
> @"F32@44100",
> PathName,
> nil
> ]
> ];
> [aifctask launch];
> NSData *data =[[NSData alloc] init];
> data = [[[aifctask standardOutput] fileHandleForReading] availableData];
> [data writeToFile:derPfad atomically:NO];
> [aifctask terminate];
> [aifctask release];
> }
>
> afconvert help:
> Usage:
> afconvert [option...] input_file [output_file]
> Options may appear before or after the direct arguments. If output_file
> is not specified, a name is generated programmatically and the file
> is written into the same directory as input_file.
> afconvert input_file [-o output_file [option...]]...
> Output file options apply to the previous output_file. Other options
> may appear anywhere.
> _______________________________________________
> 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
>
_______________________________________________
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