Editing silence/quiet from beginning of a bunch of recordings
February 22, 2020 10:29 PM   Subscribe

Specifics within but it's pretty straightforward

I have a bunch of recordings of people reading sentences. In general they are 1-4 seconds long. Some have a pause at the beginning of maybe 100-300ms, and sometimes some extra silence at the end. I say silence, but it isn't pure silence -- these recordings were made by people at their computers, so sometimes you can hear a very slight mouse click, or them breathing in preparation to speak. Still, the sound level of them speaking is quite consistent, and much louder than the quite before after.

I want a way to remove the silences at the beginning and end in an automated way. I know that some files might be too loud before or after, that's fine -- I just want a general solution that will work for most files.

I'm a Mac user. I'm a programmer as well so I can write a script to use a given library or whatever if there's a good one, I just don't know the audio space at all. Are there any programs that do this? Can audacity?

Any suggestions? Thank you!
posted by wooh to Computers & Internet (4 answers total) 1 user marked this as a favorite
It'll take some time reading man pages - or at least it would for me - but sox can almost certainly do it. It might involve printing "stat" or other results to a file and then parsing it with text tools before invoking the tool again, but finding a whole file RMS value and recording the first and last times that the level is 20% of that is something one can definitely do.
posted by eotvos at 11:05 PM on February 22, 2020

The silenceremove filter in ffmpeg can be used for this. Starting point for syntax is

ffmpeg -i input -af "silenceremove=start_periods=1:start_threshold=-30dB:stop_periods=1:stop_threshold=-50dB:detection=rms" output

See docs for all available options.
posted by Gyan at 12:37 AM on February 23, 2020 [5 favorites]

Seconding ffmpeg. Its command line syntax is pretty daunting but that's mainly because it can do pretty much anything that can be done to video and/or audio via scripting. Great tool, and available via brew.
posted by flabdablet at 1:21 AM on February 23, 2020 [1 favorite]

Thirding ffmpeg. You can Google "How do I X ffmpeg" where X is something audio/visual and almost certainly find an answer. It's worth reading at least the introductory documentation to get a grip on the whole input->dostuff->output thing works and play with some trivial examples to get the hang of using it. It's one of the Swiss Army Chainsaws of trying a few things to get it right and then throwing 10,000 things at it while you make a cup of tea and wait.
posted by zengargoyle at 5:50 PM on February 23, 2020

« Older How to deal with deprivation while saving up for a...   |   A window into his soul... or, Trump clips that... Newer »
This thread is closed to new comments.