我正在使用AVAssetWriter将wav文件输出到应用程序的临时文件夹,并使用以下设置:
NSDictionary* outputSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[ NSNumber numberWithInt: kAudioFormatMPEG4AAC], AVFormatIDKey,
[ NSNumber numberWithInt: 2 ], AVNumberOfChannelsKey,
[ NSNumber numberWithFloat: 44100.0 ], AVSampleRateKey,
[ NSData data ], AVChannelLayoutKey,
[ NSNumber numberWithInt: 64000 ], AVEncoderBitRateKey,
nil];
应用程序似乎可以输出45MB大小的正常wav文件,但是无法读取它。我怀疑是因为文件头损坏了,在Audacity中打开了这个.wav文件(没有问题),然后再次导出。重新导出的文件在我的应用程序中可以正常工作。同时,我使用文本编辑器打开两个.wav文件以查看文件头,它们有所不同。你有什么线索吗?