合并的背景音频文件 [英] merge background audio file

查看:180
本文介绍了合并的背景音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一次和背景音乐2音频文件,我想合并(而不是串联)。的最后的音频文件应该只要主文件,并且如果背景音乐是​​短那么它应该重复。

I have 2 audio files for primary and background music that I want to merge (not concatenate). The final audio file should be as long as the primary file, and if the background music is shorter then it should repeat.

如果有一个Linux命令,或者可以用来做一个Python库? 红袜的支持合并,但没有出现,以允许重复背景声频

If there a Linux command or a Python library that can be used to do this? Sox supports merging, but does not appear to allow repeating the background audio.

推荐答案

作为一种可能的解决方案,为什么不检测是否后台文件&LT的长度;前台文件的长度,然后构建一个背景文件,该文件是一个循环,如果有必要吗?然后,你可以传递到SOX。

As a possible solution, why not detect if the length of the background file < length of the foreground file and then construct a background file which is a loop, if necessary? Then you can pass that into sox.

您应该能够从中获取长度 sndhdr (看帧计数)。

You should be able to get the length from sndhdr (look at the frames count).

至于合并流的蟒蛇的方式, audioop.add 可以这样做你需要什么,但如果你正在合并两个全卷源,您可能希望减少其中之一的体积(-12dB尝试作为一个开始),如果你混合音乐和没有。

As far as a python way of merging the streams, audioop.add may do what you need, although if you're merging two full volume sources, you might want to reduce the volume of one of them (try -12db as a start) if you're mixing music and not.

更多的音频库,可以发现 rel=\"nofollow\">。

More audio libraries can be found here.

这篇关于合并的背景音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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