有没有一种简单的方法可以在Mac上(以编程方式)使用(也许使用QTKit)将mp3转换为wav? 我看过 SoundConvert 示例,但说实话我只是不明白它:P 我需要它将它传递给 libofa 进行音频指纹识别...
最佳答案
我找到了!我把它留在这里,有人可能会发现它有用。
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
}
关于cocoa - 以编程方式将 mp3 解码为 wav 的简单方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4561566/