使用sox交叉淡入淡出多个音频文件 [英] Cross fading several audio files using sox
问题描述
我正在尝试对多个音频文件进行淡入淡出以及3秒钟的交叉淡入淡出,然后将它们与sox一起合并到一个文件中.
I'm trying to cross-fade several audio files together with a 3 second cross-fade and join them together in to one file with sox.
我可以通过下面的命令将多个文件连接在一起,但不确定如何在每个文件之间进行淡入淡出>
I can join several files together by the command below but not sure how to cross fade between each one:
sox $(ls /tmp/a*.wav | sort -n) /tmp/out/out.wav
我可以使用以下命令交叉淡入淡出两个文件,但不确定如何将连接多个文件的第一行与拼接/交叉淡入淡出的第二行结合起来
I can cross fade two files with the commands below but not sure how to combine the first line that joins several files together with the second line that splices / cross fades
sox 100hz.wav 440hz.wav out.wav splice $(soxi -D 100hz.wav),3
我找到了这个问题,但答案对我不起作用.使用sox接头对一组音频文件进行交叉淡化
I found this question but the answer doesn't work for me. crossfading a group of audio files with sox splice
推荐答案
I don't know if you are aware of the crossfade_cat.sh
script offered by sox. You could just use it successively:
./crossfade_cat.sh 1 440.wav 660.wav auto auto && ./crossfade_cat.sh 1 mix.wav 880.wav auto auto
或者,如果要交叉淡化大量的wav文件,要使用目录中的所有文件,可以使用shell循环,如下所示:
Or if you want to crossfade a high number of wav files, to use all files in a directory you could use a shell loop, something like this:
crossfade_dur=1
i=0
for file in *.wav
do
i=$((i+1))
if [ $i -eq 1 ]
then
cp $file mix.wav
else
crossfade_cat.sh $crossfade_dur mix.wav $file auto auto
fi
done
这篇关于使用sox交叉淡入淡出多个音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!