私はオーディオ録音を実装しています。それはcaf
& wave
形式で正常に動作します。しかし問題は、ファイルサイズが大きすぎることです。iOS:オーディオ録音ファイル形式
だから、誰でも、ウィンドウで再生されるフォーマットの録音オーディオを手伝うことができます&ファイルサイズは少し小さいです。
私が試したコードは以下である:
dirPaths = NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
NSString *soundFilePath = [docsDir
stringByAppendingPathComponent:@"sound.wave"];
NSLog(@"%@",soundFilePath);
NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
NSDictionary *recordSettings = [NSDictionary
dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:AVAudioQualityMin],
AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16],
AVEncoderBitRateKey,
[NSNumber numberWithInt: 2],
AVNumberOfChannelsKey,
[NSNumber numberWithFloat:8000.0], AVSampleRateKey,
[NSNumber numberWithInt:8], AVLinearPCMBitDepthKey,
nil];
NSError *error = nil;
audioRecorder = [[AVAudioRecorder alloc]
initWithURL:soundFileURL
settings:recordSettings
error:&error];
if (error)
{
NSLog(@"error: %@", [error localizedDescription]);
} else {
[audioRecorder prepareToRecord];
}
http://stackoverflow.com/questions/4279311/how-to-record-voice-in-m4a-formatの複製? – nneonneo
m4a(MPEG-4 AAC)形式のレコード。詳細については、http://stackoverflow.com/questions/4279311/how-to-record-voice-in-m4a-formatを参照してください。 – nneonneo