我想在我的iPhone应用程序中录制声音,但我只能以某些特定格式录制。如何以mp3格式录制 我搜索了很多,但找不到解决方案
我发现AVRecorder不支持mp3录制,即使iTunes中有很多以mp3格式录制的应用
我怎样才能做到这一点,请帮助我......提前谢谢
答案 0 :(得分:2)
答案 1 :(得分:0)
NSString * path = [[NSBundle mainBundle] pathForResource:@ \“mp3Header \”ofType:@ \“mp3 \”];
NSMutableData * audioData = [[NSMutableData alloc] initWithContentsOfFile:path];
int samples = 22050;
uint8_t dataToRecord [samples];
int x;
for(x = 0; x< samples; x ++){
// populate the \"dataToRecord\" array with audio data. //
}
[audioData appendBytes:(const void *)dataToRecord length:samples];
// Get path to documents folder and set a file name //
[audioData writeToFile:pathToFile atomically:YES];