I want to split a single audio file into multiple audio files using python and save them, the peaks in file is separated by silence. The audio file contains 5 A's
I have tried librosa library and pydub codes for the same Also i have referred to this link: https://gist.github.com/kylemcdonald/c8e62ef8cb9515d64df4
But it is cutting file into 1 second equal interval and i don't want that. I want to split the file on basis of silence
import librosa as l
from scipy.io import wavfile
audio = l.load("D:/Downloads/Voice_a.wav")[0]
x = l.effects.trim(audio, top_db = 50)[0]
expected output is 5 different files each with a single 'A'
I did some research and finally got the answer
def split(filepath):
sound = AudioSegment.from_wav(filepath)
dBFS = sound.dBFS
chunks = split_on_silence(sound,
min_silence_len = 500,
silence_thresh = dBFS-16)
return chunks