如何在录制mp3格式的音频文件? [英] How to record an audio file in .mp3 format?

查看:320
本文介绍了如何在录制mp3格式的音频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下设置使用AVAudioRecorder录制音频文件中的mp3格式。

I am using the following settings for recording audio file in .mp3 format using AVAudioRecorder.

NSDictionary *recordSettings = [[NSDictionary alloc] initWithObjectsAndKeys:

                                        [NSNumber numberWithFloat: 44100.0],AVSampleRateKey,
                                        [NSNumber numberWithInt: kAudioFormatMPEGLayer3],AVFormatIDKey,
                                        [NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
                                        [NSNumber numberWithInt: AVAudioQualityMax],AVEncoderAudioQualityKey,nil];

但无法与这些记录。
我搜索了很多本,但没有能够得到一些相关的职位。
一些帖子说,这是不是possible.If其不可能的,那么,为什么这样呢?
请回答。

But not able to record with these. I searched a lot for this but wasn't able to get some relevant post. Some posts say that it is not possible.If its not possible then why so? Please answer.

推荐答案

问题是 kAudioFormatMPEGLayer3 这是不被支持的 AVAudioRecorder

The Problem is kAudioFormatMPEGLayer3 which is not supported by AVAudioRecorder.

另外,您可以使用 kAudioFormatAppleIMA4 为您记录的目的。

Alternatively you can use kAudioFormatAppleIMA4 for your recording purpose.

最后,您可以编写自己的编码逻辑转换 kAudioFormatAppleIMA4 MP3 格式。

Finally you can write your own encoding logic to convert kAudioFormatAppleIMA4 in to MP3 Format.

录制目的的其它支持的编码是

The other supported encoding for Recording purpose are

kAudioFormatMPEG4AAC   
kAudioFormatAppleLossless  
kAudioFormatAppleIMA4   
kAudioFormatiLBC 
kAudioFormatULaw 
kAudioFormatLinearPCM 

有关更多信息,你可以参考<一个href=\"http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder\">this帖子左右。

For more info you can refer to this post of SO.

这篇关于如何在录制mp3格式的音频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆