music.normalize_stereo

music.normalize_stereo(sonic_vector, remove_bias=True, normalize_sep=False)[source]

Normalize a stereo sonic vector.

The final array will have values only between -1 and 1.

Parameters:
sonic_vectorarray_like

A (2, nsamples) shaped array. A one-dimensional array is taken as mono and given two identical channels.

remove_biasbool

Whether to remove or not the bias (or offset)

normalize_sepbool

Set to True if each channel should be normalized separately. If False (default), the arrays will be rescaled in the same proportion (preserves loudness proportion).

Returns:
sv_normalizedndarray

A numpy array with values between -1 and 1.