3

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

I found this question but the answer doesn't work for me. crossfading a group of audio files with sox splice

1 Answer 1

5

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

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
1
  • 1
    Can the crossfade_cat.sh script be used to crossfade mp3 files?
    – Jeanno
    Feb 9, 2018 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.