Caution

You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.9.1.

librosa.to_mono

librosa.to_mono(y)[source]

Convert an audio signal to mono by averaging samples across channels.

Parameters
ynp.ndarray [shape=(…, n)]

audio time series. Multi-channel is supported.

Returns
y_mononp.ndarray [shape=(n,)]

y as a monophonic time-series

Notes

This function caches at level 20.

Examples

>>> y, sr = librosa.load(librosa.ex('trumpet', hq=True), mono=False)
>>> y.shape
(2, 117601)
>>> y_mono = librosa.to_mono(y)
>>> y_mono.shape
(117601,)