How to mix sound files of different format using FFMPEG?

不打扰是莪最后的温柔 提交于 2019-12-06 08:34:39

This is more of a suggestion than an answer. I don't have any experience with obj-c, though I have worked with audio formats in other languages. Unless you find some library that does this specific task, you may need to decode the files and convert their data to some common numerical representation.

The sample data of a .wav file is stored as signed integers between the range of -32768 to 32767, while mp3 sample data is stored as floating points between the range of -1 to +1. Either representation could be converted to the other through some simple calculation.

mp3ToWavSample = mp3Sample * 32767

Once the data is converted "merging" becomes very easy. You can simply add the sample values together.

mergedSample = convertedSample1 + convertedSample2

You would need to apply this to every sample in the mp3. Depending on the size of your files, this could be a significant processing task.

As for adding reverb to your track, I'd suggest that you ask for help on that in a another question.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!