Reputation: 3583
Is there an easy way to convert mp3s to wavs on a mac (programmatically) with (maybe with QTKit)? I've seen the SoundConvert example but to be honest I just don't understand it :P I need it to pass it to libofa for audio fingerprinting...
Upvotes: 0
Views: 862
Reputation: 3583
I found it! I leave it here, somebody might find it useful.
NSError *error = nil;
NSString *inputFile = [NSString stringWithFormat:@"./in.mp3"];
NSString *outputFile = [NSString stringWithFormat:@"./out.wav"];
QTMovie *movie = [QTMovie movieWithFile:inputFile error:&error];
if (error) {
#warning handle errors
}
NSDictionary *exportAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], QTMovieExport,
[NSNumber numberWithLong:kQTFileTypeWave], QTMovieExportType, nil];
if (![movie writeToFile:outputFile withAttributes:exportAttributes]) {
#warning handle errors
}
Upvotes: 2