【发布时间】:2014-11-13 08:38:14
【问题描述】:
场景: 我正在开发的应用程序我想录制语音备忘录并将它们发送到 Windows 客户端。在 iOS 中录制音频并没有那么难,但录制的文件(在我的情况下是以 .mp3 的形式)could not be playable in Windows 但相同的文件could be easily playable in Mac。
我强烈怀疑我在以下代码中使用的录音设置,
_audioRecorder = [[AVAudioRecorder alloc] initWithURL:audioFileURL settings:_recordingSettings error:&error];
我使用的设置是,
_recordingSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:kAudioFormatMPEG4AAC], AVFormatIDKey,
[NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16], AVEncoderBitRateKey,
[NSNumber numberWithInt: 2], AVNumberOfChannelsKey,
[NSNumber numberWithFloat:44100.0], AVSampleRateKey,
nil];
我已经尝试过各种AVFormatIDKeys比如
kAudioFormatLinearPCM - .lpcm
kAudioFormatMPEG4AAC - .acc
kAudioFormatMPEGLayer3 - .mp3
但没有收获。
感谢您的帮助。如果不可能,我需要解释原因!
【问题讨论】:
-
将其导出为线性 PCM,然后将标头调整为 wav? ccrma.stanford.edu/courses/422/projects/WaveFormat
-
感谢推荐,但解决方案有点复杂。我已经成功了。
标签: ios objective-c audio audio-recording