Provide 0.3s buffer for silence trimming
We want to trim the silence from recordings but risk cutting off the first and last syllables, particularly if they are softer sounds. This adds a reasonable length buffer for data collection. During post-processing the sounds can be further trimmed if desired.pull/47/head
parent
e3e3c8e155
commit
ffd7e965a4
|
@ -13,7 +13,10 @@ class Audio:
|
|||
while sound[trim_ms:trim_ms + Audio.chunk_size].dBFS \
|
||||
< Audio.silence_threshold and trim_ms < len(sound):
|
||||
trim_ms += Audio.chunk_size
|
||||
|
||||
trim_buffer = 300 # buffer to prevent first sound getting cut
|
||||
trim_ms -= trim_buffer
|
||||
if trim_ms < 0:
|
||||
trim_ms = 0
|
||||
return trim_ms
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue