How can I remove the silence from the beginning and the end of wave files with PyDub?
I guess I should access segment by segment and check whether it's silent or not (but I'm not able to do it) :/
e.g. I have a wave file with silence at the beginning, end, or both (like below) and I want to remove the silence at the beginning and at the end of the file:
e.g. I want to import it
sound = AudioSegment.from_wav(inputfile)
cycle for every sample of sound to check whether it's silent and mark the last silent sample since when the waves starts (marker1), then get to the last sample before the wave ends (marker2) and I can export the new sound file from the two markers
newsound = sound[marker1:marker2]
newsound.export(outputfile, format="wav")