2

I have different audio files those are one hour long and I want to insert silence with a same predefined positions and length into all of these files. Is there any software which is capable of doing this job? Otherwise I should edit audio files separately which will take a lot of time.

2 Answers 2

6

If by "inserting silence" you mean to pad the file with silence, and thereby changing the duration of the track, I'd use SoX:

# example file
sox -n -r 44100 -b 16 before.wav synth 20 brownnoise

# pads with 5 seconds of silence at the 2 seconds mark    
sox before.wav after-pad.wav pad 5@2

If by "inserting silence" you mean to mute a section of the file, and thereby keeping duration the same, I'd use FFmpeg:

# example file
ffmpeg -f lavfi -i "anoisesrc=d=20:c=brown:r=44100:a=0.5" before.wav

# sets volume to zero between the 2 and 5 second marks
ffmpeg -i before.wav -af "volume=enable='between(t,2,5)':volume=0" after-mute.wav

To batch process files, move to a folder containing the files you want to process (assumes WAV) and run either

files="*.wav"
for f in $files
do
  sox "$f" "${f%.*}-pad.wav" pad 5@2
done

or

files="*.wav"
for f in $files
do
  ffmpeg -i "$f" -af "volume=enable='between(t,2,7)':volume=0" "${f%.*}-mute.wav"
done
2
  • Excellent! I was looking for exactly this kind of software. Thanks! Commented Sep 29, 2016 at 21:04
  • Also if someone is looking for solid silence, change the first line to: sox -n -r 44100 -b 16 before.wav trim 0.0 20.0 Commented Aug 15 at 6:40
-2

I would recommend Audacity. It is free and there is great documentation. Here is a how-to document on editing multiple files with Audacity's "chain" feature.

2
  • I have searched Audacity, but could not find this function. Anyway, AkselA's answer is a decent solution for my problem. Commented Sep 29, 2016 at 21:07
  • Audacity is nice, but not a solution for this question.
    – Tom
    Commented Sep 16, 2021 at 22:20

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.