ITeye博客

AVAudioRecorder MAV格式录音

修博龙泉 · 2013-08-15 21:13 · ios开发学习相关 · 移动开发 · Markdown

//录音设置

    NSDictionary *RecordParam = [[NSDictionaryalloc] initWithObjectsAndKeys:

                                 [NSNumber numberWithFloat: 8000.0],AVSampleRateKey, //采样率

                                 [NSNumber numberWithInt: kAudioFormatLinearPCM],AVFormatIDKey,

                                 [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,//采样位数默认 16

                                 [NSNumber numberWithInt: 1], AVNumberOfChannelsKey,//通道的数目

                                 [NSNumber numberWithInt: AVAudioQualityMedium],AVEncoderAudioQualityKey,//音频编码质量

                                 nil];

    NSString   *DocmentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES) objectAtIndex:0];

    NSURL *url = [NSURLURLWithString:[DocmentPath stringByAppendingString:@"/luyin.wav"]];

    urlPlay = url;

    

    NSError *error;

    //初始化

    recorder = [[AVAudioRecorder alloc]initWithURL:url settings:RecordParam error:&error];

    //开启音量检测

    recorder.meteringEnabled = YES;

 

    recorder.delegate = self;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。