MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / moving_average

Function moving_average

data_gen/tts/data_gen_utils.py:75–79  ·  view source on GitHub ↗
(array, width)

Source from the content-addressed store, hash-verified

73
74 # Smooth the voice detection with a moving average
75 def moving_average(array, width):
76 array_padded = np.concatenate((np.zeros((width - 1) // 2), array, np.zeros(width // 2)))
77 ret = np.cumsum(array_padded, dtype=float)
78 ret[width:] = ret[width:] - ret[:-width]
79 return ret[width - 1:] / width
80
81 audio_mask = moving_average(voice_flags, vad_moving_average_width)
82 audio_mask = np.round(audio_mask).astype(np.bool)

Callers 1

trim_long_silencesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected