Crossfading a group of audio files with sox splice

I can join and rephrase two audio files using SoX, for example:

sox file1.wav file2.wav outfile.wav splice -q `soxi -D file1.wav`,0.5 

where soxi is the file length1 sample, and 0.5 is the crossfade length. Now I am trying to extend this to an arbitrary number of files in order to link them together with short crossfades between them. It would seem that there are two approaches: pipeline and scenarios. Sox has the -p option, indicating that it treats it as transmitted over channels (instead of writing a file). But with a lot of input and arguments for the command, it is not clear how this output ( and input? ) Is assigned in subsequent commands. So far I have a line below that is not working , trying to expand to 3 files.

 sox -p file1.wav file2.wav splice -q `soxi -D file1.wav`,0.5 | sox -p file3.wav outfile.wav splice -q `soxi -D file3.wav`,0.5 

Your advice on the sox pipeline and scripts will be greatly appreciated.

+4
source share
1 answer

I got most of the way with

 sox --combine concatenate *.wav _merge.wav splice -q 3,1 

The splicing effect at the end puts the crossfade beginning at 3 seconds in the first file and uses 1 second as the crossfade duration (half a second at the beginning and end of two files). This method is a temporary fix, since I can only include 3-second files in the output (using other methods). The best answer would be to figure out how to capture the duration of the current file and replace it with 3 instead.

 sox --combine concatenate *.wav _merge.wav splice -q $(soxi −D {}),1 

If {} here selected the current item (as in find ), that would do it. But that does not work.

+2
source

Source: https://habr.com/ru/post/1392238/


All Articles