1

I asked about a Non-Linear Editor for sound that works from plain-text files. As it does not seem to exist, I programmed one with FFMPEG. The text input is:

## take_1.wav

-ss 3.32179
-to 7.57171
any notes on this

## take_1.wav

-ss 11.82790
-to 15.22180
some more notes

## take_2.wav

-ss 15.76000
-to 20.20920
more notes

and I extract those segments with FFMPEG:

ffmpeg -i take2.wav -ss 15.76000 -to 20.20920 -ac 1 temp3.wav

and then join them with Python's wave module, from this answer:

def join_audio(infiles, outfile):
    data = []
    for infile in infiles:
        w = wave.open(infile, 'rb')
        data.append( [w.getparams(), w.readframes(w.getnframes())] )
        w.close()

    output = wave.open(outfile, 'wb')
    output.setparams(data[0][0])
    for i in range(len(data)):
        output.writeframes(data[i][1])
    output.close()

I notice some discrepancies at the joins between the segments. Since WAV is uncompressed, I assume that this slicing and joining is lossless. Is that correct or am I losing some information in the process?

2
  • 3
    Wav editing should always be lossless, but cutting at non-zero points is always going to click. How are you ensuring your edit points are going to be silent? Why do you need to do this programatically rather than audio-visually? I'm sure something like Audacity would be a simple-enough tool for this job.
    – Tetsujin
    Aug 2, 2020 at 11:11
  • I was doing it programmatically to avoid the destructive editing of Audacity. Thanks for the tip on non-zero points. Aug 3, 2020 at 16:39

1 Answer 1

1

It will be lossless. You can avoid the popping sounds by doing very short fade ins/outs

Your Answer

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

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