2013-04-09 65 views
1

我想将声音录制在我的iPhone应用程序中,但我只能以某种特定的格式录制它。如何以mp3格式录制 我已经搜索了很多,但找不到解决如何在iPhone中以mp3格式录制声音

我发现AVRecorder不会支持MP3录音,即使有iTunes中许多应用程序,以记录MP3格式

我怎样才能做到这一点,请帮助me..thanks提前

+0

首先尝试搜索Internet:http://stackoverflow.com/questions/10314510/how-to-record-audio-as-mp3-file-by-using-avaudiorecorder,http://stackoverflow.com/questions/ 10549023/iphone-app-recording-audio-in-mp3,http://stackoverflow.com/questions/4871940/how-to-record-an-audio-file-in-mp3-format,http:// stackoverflow。 com/questions/1005598 /正在寻找一种方式来编码-iPhone- – CRDave 2013-04-09 10:45:52

+1

记录的文件是.caf文件格式。录制后必须将.caf转换为.mp3文件格式。 – Tirth 2013-04-09 10:53:38

+0

@iAmbitious如何将.caf转换为.mp3 – 2013-04-09 11:27:40

回答

2

Here是你的问题的解决方案。

此演示程序由apple开发,适用于mp3格式的音频录制。我已经开发了一个应用程序(BRL App)使用此演示。

这是苹果开发人员开发的非常有用的演示。

+0

与帖子链接有问题,他们有时可以删除:'(但谷歌不知道 – TommyBs 2016-07-08 14:29:09

0

的NSString * path = [[NSBundle mainBundle] pathForResource:@ \“mp3Header \”ofType:@ \“mp3 \”];

NSMutableData * audioData = [[NSMutableData alloc] initWithContentsOfFile:path];

int samples = 22050;

uint8_t dataToRecord [samples];

int x;

为(X = 0; X <样本; X ++){

// populate the \"dataToRecord\" array with audio data. // 

}

[audioData对appendBytes:(常量无效*)dataToRecord长度:样品];

// Get path to documents folder and set a file name // 

[audioData writeToFile:pathToFile atomically:YES];

相关问题