Skip to content

Instantly share code, notes, and snippets.

View fred9's full-sized avatar

Fred Oh fred9

  • Portland, OR, USA
View GitHub Profile
@fred9
fred9 / remove_silence.py
Created May 9, 2019 23:44 — forked from sotelo/remove_silence.py
Remove silences
# From https://stackoverflow.com/questions/29547218/
# remove-silence-at-the-beginning-and-at-the-end-of-wave-files-with-pydub
from pydub import AudioSegment
def detect_leading_silence(sound, silence_threshold=-50.0, chunk_size=10):
'''
sound is a pydub.AudioSegment
silence_threshold in dB
chunk_size in ms