#pragma mark -录音设置配置
- (void)initRecordConfig{
//录音设置
NSMutableDictionary*recordSetting = [[NSMutableDictionaryalloc]init];
//设置录音格式AVFormatIDKey==kAudioFormatLinearPCM
[recordSettingsetValue:[NSNumbernumberWithInt:kAudioFormatLinearPCM]forKey:AVFormatIDKey];
//设置录音采样率(Hz)如:AVSampleRateKey==8000/44100/96000(影响音频的质量),采样率必须要设为11025才能使转化成mp3格式后不会失真
[recordSettingsetValue:[NSNumbernumberWithFloat:11025.0]forKey:AVSampleRateKey];
//录音通道数1或2,要转换成mp3格式必须为双通道
[recordSettingsetValue:[NSNumbernumberWithInt:2]forKey:AVNumberOfChannelsKey];
//线性采样位数8、16、24、32
[recordSettingsetValue:[NSNumbernumberWithInt:16]forKey:AVLinearPCMBitDepthKey];
//录音的质量
[recordSettingsetValue:[NSNumbernumberWithInt:AVAudioQualityHigh]forKey:AVEncoderAudioQualityKey];
//存储录音文件
_recordUrl= [NSURLURLWithString:[NSTemporaryDirectory()stringByAppendingString:@"selfRecord.caf"]];
//初始化
_audioRecorder= [[AVAudioRecorderalloc]initWithURL:_recordUrlsettings:recordSettingerror:nil];
//开启音量检测
_audioRecorder.meteringEnabled=YES;
_audioRecorder.delegate=self;
}