Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove start of new track from end of audio file

Tags:

audio

sox

I've a couple of recordings where at the end of the track there's silence and the start of a new track (fraction). I tried to remove the start of the new track from the end of the file.

My command (*nux)

sox file_in.mp3 -C 320 file_out.mp3 silence 1 0.75 0.2% -1 0.75 0.2%

Preferably keep the silence at the end or just add some new. Any help appreciated

like image 988
John Doe Avatar asked Oct 27 '18 07:10

John Doe


People also ask

How do you delete part of a sound?

Double-tap on your audio: a shortcut menu will appear > tap Split. Now move the playhead to the point where you want to end cutting > double-tap on your audio > tap Split. Tap on the fragment you created > tap Delete from the editing toolbar.


1 Answers

Probably you can use the below period parameter without the above period.

A bit of silence can optionally be kept with the -l parameter (or you can just use pad with a fixed amount).

For example:

sox input.mp3 -C 320 output.mp3 silence -l 0 1 0.5 0.5%

Sample input:

Sample input

Result:

enter image description here


Note, if the beginning of some new tracks has long silence periods inside, it may be tricky - but usually possible - to find appropriate duration and threshold parameters (the general case, apparently, it is not tractable at all by simple processing, one needs a machine learning approach to reliably mark inner periods of silence that belong to a track).

Also, if it is just a couple of files, opening an editor e.g. Audacity is the quickest and the best outcome approach.

like image 187
Fedor Losev Avatar answered Sep 18 '22 14:09

Fedor Losev