我使用以下设置使用AVAudioRecorder以.mp3格式录制音频文件.
NSDictionary *recordSettings = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithFloat: 44100.0],AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatMPEGLayer3],AVFormatIDKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithInt: AVAudioQualityMax],AVEncoderAudioQualityKey,nil];
Run Code Online (Sandbox Code Playgroud)
但不能用这些记录.我搜索了很多但是没能得到一些相关的帖子.有些帖子说这是不可能的.如果不可能那么为什么呢?请回答.
我在http://developer.apple.com/library/ios/#documentation/MusicAudio/Reference/CoreAudioDataTypesRef/Reference/reference.html#//apple_ref/doc/找到了不同值的列表(音频数据格式)UID/TP40004488
音频数据格式标识符音频数据格式的标识符,用于AudioStreamBasicDescription结构.
kAudioFormatLinearPCM ='lpcm',
kAudioFormatAC3 ='ac-3',
kAudioFormat60958AC3 ='cac3',
kAudioFormatAppleIMA4 ='ima4',
kAudioFormatMPEG4AAC ='aac',
kAudioFormatMPEG4CELP ='celp',
kAudioFormatMPEG4HVXC ='hvxc',
kAudioFormatMPEG4TwinVQ ='twvq',
kAudioFormatMACE3 ='MAC3',
kAudioFormatMACE6 ='MAC6',
kAudioFormatULaw ='ulaw',
kAudioFormatALaw ='alaw',
kAudioFormatQDesign ='QDMC',
kAudioFormatQDesign2 ='QDM2',
kAudioFormatQUALCOMM ='Qclp',
kAudioFormatMPEGLayer1 ='.mp1',
kAudioFormatMPEGLayer2 ='.mp2',
kAudioFormatMPEGLayer3 ='.mp3',
kAudioFormatTimeCode ='时间',
kAudioFormatMIDIStream ='midi',
kAudioFormatParameterValueStream ='apvs',
kAudioFormatAppleLossless ='alac'
kAudioFormatMPEG4AAC_HE ='aach',
kAudioFormatMPEG4AAC_LD ='aacl',
kAudioFormatMPEG4AAC_ELD ='aace',
kAudioFormatMPEG4AAC_HE_V2 ='aacp',
kAudioFormatMPEG4AAC_Spatial ='aacs',
kAudioFormatAMR ='samr',
kAudioFormatAudible ='AUDB',
kAudioFormatiLBC ='ilbc',
kAudioFormatDVIIntelIMA = 0x6D730011,
kAudioFormatMicrosoftGSM = 0x6D730031,
kAudioFormatAES3 ='aes3'
但是,我不认为我们可以使用所有提到的格式(例如mp3).
任何人都可以帮助我使用AVAudioRecorder录制声音支持的格式吗?
谢谢.