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. If only one sonic vector is provided, it is duplicated to create a stereo mix. Optionally, the shorter sonic vector can be padded with zeros to match the length of the longer sonic vector before mixing.
- 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. If not provided, the first sonic vector is duplicated to create a stereo mix.
- 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.
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)