mstar.model.omnivoice.components.silence#
The reference’s silence trim (omnivoice.utils.audio.remove_silence),
vectorized and sample-exact.
The reference runs pydub: an RMS window every 10 ms, each a fresh
AudioSegment slice and an audioop.rms call, which costs about 14 ms of
Python per second of audio and ran inside the code2wav forward, stalling the
worker’s loop for every finished request. This computes the same windows from
one prefix sum of squared int16 samples and replays pydub’s millisecond
slicing (int(ms * rate / 1000) samples, zero-filled past the end), its
range merging and its edge trim, so the output is the reference’s to the
sample; test_omnivoice_silence checks it against pydub.
Functions
|
|