librosax.to_multi¶
- to_multi(*signals: Array, downmix: bool = True, pad: bool = True, norm: bool = True) Array[source]¶
Combine several signals into one multi-channel signal.
- Parameters:
*signals – One or more audio buffers with shape
(..., n).downmix – If
True(default), each input is downmixed to mono and becomes one channel of the output, giving shape(len(signals), n_out). IfFalse, all inputs must share a channel layout and are combined additively into it.pad – If
True(default), shorter signals are zero-padded to the longest input. IfFalse, longer signals are trimmed.norm – If
True(default), signals are combined by averaging. IfFalse, they are combined by summing.
- Returns:
Multi-channel signal.
- Raises:
librosax.util.exceptions.ParameterError – If no signals are given, or if
downmixisFalseand the inputs disagree on channel layout.
See also
to_mono, to_stereo, fix_length
Examples
>>> y1 = librosax.tone(440.0, sr=22050, duration=1.0) >>> y2 = librosax.tone(550.0, sr=22050, duration=1.0) >>> y_multi = librosax.to_multi(y1, y2) >>> y_multi.shape (2, 22050)