iOS Wav语音文件和acc文件的设置

本来用的aac 格式,可是后台管理系统windows不能播放 就自己又改,本来想着还要其他框架 就去各种搜索最后是这么解决的
wav 格式只需要这么设置AVAudioRecorder 他的参数
recorderSettingsDict = [[NSMutableDictionary alloc] initWithCapacity:10];

NSNumber *formatObject;


formatObject = [NSNumber numberWithInt: kAudioFormatLinearPCM];
[recorderSettingsDict setObject:formatObject forKey: AVFormatIDKey];//ID
[recorderSettingsDict setObject:[NSNumber numberWithFloat:8000.0] forKey: AVSampleRateKey];//采样率
[recorderSettingsDict setObject:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];//通道的数目,1单声道,2立体声
[recorderSettingsDict setObject:[NSNumber numberWithInt:12800] forKey:AVEncoderBitRateKey];//解码率
[recorderSettingsDict setObject:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];//采样位
[recorderSettingsDict setObject:[NSNumber numberWithInt: AVAudioQualityHigh] forKey: AVEncoderAudioQualityKey];

aac 的参数
录音设置
recorderSettingsDict =[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kAudioFormatMPEG4AAC],AVFormatIDKey,
[NSNumber numberWithInt:1000.0],AVSampleRateKey,
[NSNumber numberWithInt:2],AVNumberOfChannelsKey,
[NSNumber numberWithInt:8],AVLinearPCMBitDepthKey,
[NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,
[NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,
nil];
这就ok了。

你可能感兴趣的:(iOS Wav语音文件和acc文件的设置)