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

Function normalize_per_channel

examples/csv2wav/csv2wav.py:113–118  ·  view source on GitHub ↗
(audio, headroom_db=0.5)

Source from the content-addressed store, hash-verified

111
112
113def normalize_per_channel(audio, headroom_db=0.5):
114 peaks = np.max(np.abs(audio), axis=0)
115 peaks[peaks == 0.0] = 1.0
116 target = 10.0 ** (-headroom_db / 20.0)
117 scale = target / peaks
118 return audio * scale
119
120
121def float_to_int16(x, dither=False, rng=None):

Callers 1

write_wavFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected