`

iosAMR和WAV互相转换

    博客分类:
  • ios7
 
阅读更多

 

录音设置

NSDictionary *settings = [NSDictionarydictionaryWithObjectsAndKeys:
                                          [NSNumber numberWithInt:kAudioFormatLinearPCM], AVFormatIDKey,
                                          [NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey,
                                          [NSNumber numberWithInt:16], AVEncoderBitRateKey,
                                          [NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
                                          [NSNumber numberWithFloat:8000.0], AVSampleRateKey,
                                          //[NSNumber numberWithInt:8], AVLinearPCMBitDepthKey,
                                          nil];
                
                NSError* error;
                self.audioRecorder = [[AVAudioRecorder alloc] initWithURL:[NSURL fileURLWithPath:filePath] settings:settings error:&error];
                self.audioRecorder.delegate = self;
                
                
                AVAudioSession *audioSession = [AVAudioSession sharedInstance];
                [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
                [audioSession setActive:YES error:nil];
                
                [self.audioRecorder prepareToRecord];
                self.audioRecorder.meteringEnabled = YES;
 
                [self.audioRecorder record];

 

 

将录下的音频用下面的包进行转换

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics