3

I want to keep several sections of an audio file, merged together, but without any discontinuities ("clicks") at the join points. There's a SoX command that does this (https://superuser.com/a/677351), but it does not do any crossfade, so there will be discontinuities. Is there a way to achieve that, using a command-line utility or a library? (Besides writing my own code — I'd certainly do that if I have to)

Display Name
  • 1,133

1 Answers1

2

Turns out, this is entirely possible to do with SoX, even with just a single SoX invocation, using trim and splice effects. But the numeric arguments are not straightforward to write. All trim regions except the last must include additional amount of time at the end that will be used for crossfading, and arguments to splice must also specify proper lengths of 1st region including that extra time, 1st + 2nd after first splicing, 1st + 2nd + 3rd, etc.

I wrote a script that does this (in Scala language), and I will release it, sooner or later.

There's a drawback in Sox, seems like trim effect does not work with floating point format, so at the end audio data gets converted to (at most) 24-bit integer format, this may be acceptable or not depending on your use case.

Display Name
  • 1,133