我想录制声音并想将录制的文件保存到文档目录中:- 做过喜欢:-
[[AVAudioSession sharedInstance]
setCategory: AVAudioSessionCategoryRecord
error: nil];
NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:16000.0] forKey:AVSampleRateKey];
[recordSetting setValue:[NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey];
recorderFilePath = [[NSString stringWithFormat:@"%@/Audio.caf", DOCUMENTS_FOLDER] retain];
NSURL *soundFileURL=[NSURL URLWithString:recorderFilePath];
recorderFilePath = [[NSString stringWithFormat:@"%@/Audio.caf", DOCUMENTS_FOLDER] retain];
NSURL *soundFileURL = [NSURL fileURLWithPath:recorderFilePath];
NSLog(@"str==>%@ soundurl==>%@",recorderFilePath,soundFileURL);
AVAudioRecorder *newRecorder =
[[AVAudioRecorder alloc] initWithURL: url
settings: settings
error: nil];
newRecorder.delegate = self;
[newRecorder prepareToRecord];
[newRecorder record];
和[录音机停止];当停止录制完成时。
看过这个:- 这个
并相应编码..但我仍然无法在文件夹中创建任何 .caf 文件。