librosax.to_mono

to_mono(*signals: Array, pad: bool = True, norm: bool = True) Array[source]

Downmix one or more signals to a single mono channel.

Each input is first collapsed across its channel dimensions, then the results are combined.

Parameters:
  • *signals – One or more audio buffers with shape (..., n). Signals may differ in both channel layout and length.

  • pad – If True (default), shorter signals are zero-padded to the longest input. If False, longer signals are trimmed to the shortest.

  • norm – If True (default), channels and signals are combined by averaging. If False, they are combined by summing.

Returns:

Mono signal with shape (n_out,).

Raises:

librosax.util.exceptions.ParameterError – If no signals are given, or if any signal is a scalar or not floating-point.

See also

to_stereo, to_multi, fix_length

Examples

>>> y1 = librosax.tone(440.0, sr=22050, duration=1.0)
>>> y2 = librosax.tone(550.0, sr=22050, duration=1.0)
>>> y_mono = librosax.to_mono(y1, y2)