//------------------ 設置錄音格式及參數 --------------------------
NSDictionary *settings = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey,
[NSNumber numberWithInt:kAudioFormatLinearPCM], AVFormatIDKey,
[NSNumber numberWithFloat:8000.0], AVSampleRateKey,
[NSNumber numberWithInt:16], AVLinearPCMBitDepthKey,
[NSNumber numberWithInt:1], AVNumberOfChannelsKey,
[NSNumber numberWithBool:NO], AVLinearPCMIsBigEndianKey,
[NSNumber numberWithBool:NO], AVLinearPCMIsFloatKey, nil];
// NSDictionary *settings = [[NSDictionary alloc] initWithObjectsAndKeys:
// [NSNumber numberWithInt:kAudioFormatLinearPCM],AVFormatIDKey,//格式
// [NSNumber numberWithFloat:8000.0],AVSampleRateKey, //採樣率8000次
// [NSNumber numberWithInt:1], AVNumberOfChannelsKey, //通道的數目
// [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey, //採樣位數 默認 16
// [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey, //大端仍是小端 是內存的組織方式
// [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey, //採樣信號是整數仍是浮點數
// //Encoder
// [NSNumber numberWithInt:12800],AVEncoderBitRateKey, //解碼率
// [NSNumber numberWithInt:8],AVEncoderBitDepthHintKey, //位深度
// [NSNumber numberWithInt:8],AVEncoderBitRatePerChannelKey, //聲道採樣率
// [NSNumber numberWithInt:AVAudioQualityLow],AVEncoderAudioQualityKey, //音頻編碼質量
// nil];
[[AVAudioRecorder alloc] initWithURL:[NSURL fileURLWithPath:cafFilePath] settings:settings error:&error];ide