ios - combine/concatenate multiple audio files
我有一堆音频文件(mp3,aac等),我想将它们连接成1个音频文件。 有人做过吗?
我已经做到了。要进行串联,首先需要将音频文件加载到AVAsets中。具体来说,您将要使用称为AVURLAssets的AVAsset的子类,该子类可以加载您的URL:加载AVAsset。然后,您可以将每个
请注意,
我还将指出,Apple没有提供写出MP3文件的选项。您可以阅读它们,但不能编写它们。通常最好坚持使用m4a / aac格式。
使用ExtAudioFile相当简单。使用伪代码,您想要做的是:
1 2 3 4 5 6 7 8 | 1. Open the file you'll be using for output (ExtAudioFileOpen) 2. Set the client data format you'll use for ExtAudioFileWrite 3. For each input file you want to process: a. Open the file using ExtAudioFile b. Set the client data format used for reading to the same client format used in the output file for writing c. Loop through the input file using ExtAudioFileRead and save the data to the output file using ExtAudioFileWrite d. Close the input file 4. Close the output file |