MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _normalize

Function _normalize

tests/utils/audio_tools.py:67–77  ·  view source on GitHub ↗

Return a zero-mean, unit-RMS copy of a signal (empty stays empty).

(signal)

Source from the content-addressed store, hash-verified

65
66
67def _normalize(signal):
68 """Return a zero-mean, unit-RMS copy of a signal (empty stays empty)."""
69 if signal.size == 0:
70 return signal
71
72 centered = signal - signal.mean()
73 rms = np.sqrt(np.mean(centered * centered))
74 if rms <= 0.0:
75 return centered
76
77 return centered / rms
78
79
80def _best_lag(a, b):

Callers 1

align_and_scoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected