So I have a audio file of a person saying a sentence, but sometimes there are little bits of sound at the end that I want to keep, but I cant seem to figure out how. I just need to remove silence where there's just blank sound, not very little sound (viz. screenshot). Code iI'm using to get to the second one is here.
audio = AudioSegment.from_mp3(filename)
original_bitrate = mediainfo(filename)['bit_rate']
chunks = split_on_silence(audio, min_silence_len=10, silence_thresh=-40)
processed = chunks[:-1]
processed = sum(processed)
processed.export("output.mp3", format="mp3", bitrate=original_bitrate)
Image in audacity:

Tried to mess with the min_silence_len=10, silence_thresh=-40 but that doesn't change much except just not split it up into segments. Also if min_silence_len is bigger than 10 it doesn't detect the silence, even thought its like 900ms.