如何将两个 mp3 音频文件混合/叠加到一个 mp3 文件中(不连接) [英] How to mix / overlay two mp3 audio file into one mp3 file (not concatenate)

查看:64
本文介绍了如何将两个 mp3 音频文件混合/叠加到一个 mp3 文件中(不连接)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将两个 mp3 文件合并为一个 mp3 文件.例如,如果第一个文件是 1 分钟,第二个文件是 30 秒,那么输出应该是一分钟.在那一分钟内,它应该播放两个文件.

I want to merge two mp3 files into one mp3 file.for example if 1st file is 1min and 2nd file is 30 sec then the output should be one min. In that one min it should play both the files.

推荐答案

首先,为了混合两个音频文件,您需要处理它们的原始表示;由于MP3 文件被压缩,您无法直接访问信号的原始表示.您需要对压缩的 MP3 流进行解码,以理解"音频信号的波形,然后才能将它们混合.

First of all, in order to mix two audio files you need to manipulate their raw representation; since an MP3 file is compressed, you don't have a direct access to the signal's raw representation. You need to decode the compressed MP3 stream in order to "understand" the wave form of your audio signals and then you will be able to mix them.

因此,要将两个压缩音频文件混合成一个压缩音频文件,需要执行以下步骤:

Thus, in order to mix two compressed audio file into a single compressed audio file, the following steps are required:

  1. 解码使用解码器来获取原始数据的压缩文件(没有可用的公共系统API,您需要手动进行!).
  2. 混合两个未压缩的原始数据流(如有必要,应用音频剪辑).为此,您需要考虑使用解码器 (PCM)
  3. 编码原始混合数据到压缩的MP3文件中(根据解码器,您需要使用编码器手动完成)
  1. decode the compressed file using a decoder to obtain the raw data (NO PUBLIC SYSTEM API available for this, you need to do it manually!).
  2. mix the two raw uncompressed data streams (applying audio clipping if necessary). For this, you need to consider the raw data format obtained with your decoder (PCM)
  3. encode the raw mixed data into a compressed MP3 file (as per the decoder, you need to do it manually using an encoder)

可以在此处找到有关 MP3 解码器的更多信息.

More info aboud MP3 decoders can be found here.

这篇关于如何将两个 mp3 音频文件混合/叠加到一个 mp3 文件中(不连接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆