0

I'm working on a sample pack of small audio files. I create & record the samples into Ableton Live & for most of them that works fine as they are tied to the BPM, so I can just cut them to the beat. For some of the samples, however, I'd like them to be as short/small as possible. Is there a way that I can batch trim the samples so that all silence at the end is removed? Either directly inside Ableton or as a program that I can just run on a folder. The samples are in .wav format

2
  • Have you tried searching for silence removers? Is the silence noise-floor silence or zero amplitude silence?
    – n00dles
    May 26, 2023 at 19:57
  • I did look for a little while but could not find anything. i think anything below -60dB will be fine to remove. some samples contain some reverb so that should eventually trail off. I don't need the whole tail for that though like down to the very quiet parts at the end...
    – BRHSM
    Jun 3, 2023 at 8:31

4 Answers 4

2

I ended up using the following piece of python code:

"""Bulk trim silence from all wav files in the folder of this script."""

import os, glob
import numpy as np
import soundfile as sf

# Noise floor in dB
NOISE_FLOOR = -60

# Trim silence from start?
TRIM_START = True

# Trim silence from end?
TRIM_END = True

# Padding to apply around detected edge of silence
PADDING = 32

epsilon = 10**(NOISE_FLOOR/20)


def process(filename):
    # Load the wav file
    data, samplerate = sf.read(filename, always_2d=True)
    # Find indices of samples above noise floor
    indices = (np.abs(data) >= epsilon).any(axis=1).nonzero()[0]
    # Trim silence (if it found any non-silent samples)
    if len(indices) > 1:
        # Find start and end index to trim (+/- padding)
        start = max(0, indices[0] - PADDING) if TRIM_START else 0
        end = min(len(data), indices[-1] + PADDING) if TRIM_END else len(data)
        trim = data[start: end]
    else:
        trim = data
    # Write trimmed wave to subfolder called 'trimmed' with the same file name
    sf.write(os.path.join('trimmed', os.path.basename(filename)), trim, samplerate)


if __name__ == "__main__":
    # Prepare output directory
    os.makedirs('trimmed', exist_ok=True)
    # Find and process all wav files
    wav_files = glob.glob("*.wav")
    for i, filename in enumerate(wav_files):
        print(f"{i}/{len(wav_files)}: {filename}")
        try:
            process(filename)
        except Exception as ex:
            print("Trimming failed!")
            print(ex)

this will remove trailing silence from all files in a folder, and place them in a folder called trimmed

0

I've never used Ableton Live, so I'm not sure if you can automatically strip silence in it, but I recently created a small exe for Windows that does just that - it removes any samples below a given threshold (in dBFS) and allows you to pad the resulting blocks of samples (i.e. leave some leading/trailing silence).
It's called SiRemX (Pronounced "sai·rem ex" - silence remover - Smart, eh?) - I've tested it many times, and it works great, but there are currently some... minor limitations:

  1. It currently only works with 16 bit & 32 bit(float) stereo WAVE files with simple headers.
  2. As it writes NO AppData on the computer, the processed samples are held in the RAM, so it won't process large files (e.g. It processed a 3 minute 192k 32 bit(float) perfectly, but wouldn't process a 6-minute version due to memory problems (it reports any issues clearly, if it has any, so you know exactly what happened)).
  3. It's a Windows .exe application, with a console-based UI, so it only works on Windows systems.
  4. It still has some small UI issues, and you may need to Run as Administrator if you want to overwrite any files.

Other than that, it works perfectly. If you want to try it, it's on my GDrive - SiRemX. I'll update it now and then, when I'm bored.

0

you might be already done with that but anyways... To me it sounds like a job for the "Gate" audio effect in Ableton. Also the "remove ambience" Preset from the Multiband Dynamics audio effect should work. Learned that trick from a "Virtual Riot" producer tutorial - since bass music ofthen relies on heavily processed sounds, whitch often produces ringing tails and stuff - so you got to clean that shi* up all the time... but you get used to it ^^

1
  • that's not what I want, I'm looking to remove silence from files, not from the signal in an audio track. I forgot to post the code I ended up using here which was provided to me by a friend!
    – BRHSM
    Jul 25, 2023 at 11:20
0

https://ffmpeg.org/ffmpeg-filters.html#silenceremove Remove silence from the beginning, middle or end of the audio.

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.