music.mix_stereo¶
- music.mix_stereo(first_sonic_vector, second_sonic_vector=None, end=False)[source]¶
Mixes two stereo sonic vectors.
This function mixes two stereo sonic vectors. A mono one is put in both channels first, and the shorter is padded with zeros to the length of the longer.
- Parameters:
- first_sonic_vector
ndarray The first stereo sonic vector to mix.
- second_sonic_vector
ndarray,optional The second stereo sonic vector to mix, by default None: nothing, so the first comes back in stereo as it was.
- endbool,
optional If False, both sounds start together and the shorter is padded at the end. If True, both sounds end together and the shorter is padded at the beginning. Defaults to False.
- first_sonic_vector
- Returns:
ndarrayA stereo sonic vector containing the mix of the input sonic vectors.
- Parameters:
- Return type:
Notes
If second_sonic_vector is not provided, the end parameter is ignored.
Given one sound, this returned it mixed with itself, at twice its amplitude: the default was the empty list, padded to the first sound’s length, until a cleanup in 2024 made it None and put the first sound in its place.
Examples
>>> left = horizontal_stack(note(220, 0.5), silence(0.5)) >>> right = horizontal_stack(silence(0.5), note(330, 0.5)) >>> together = mix_stereo(convert_to_stereo(left), ... convert_to_stereo(right)) >>> together.shape (2, 44100)