music.mix_many_with_offsets¶
- music.mix_many_with_offsets(*args)[source]¶
Mix any number of sonic vectors, each at its own offset.
Where
mix_with_offset()takes two sounds and one offset, this takes as many as it is given: each sound is mixed into the result built so far, delayed by the offset that follows it.- Parameters:
- *args
sonicvectors,eachoptionallyfollowedbyascalar A sequence of sonic vectors, each a sequence of PCM samples, or a sequence alternating the sonic vectors and their offsets in seconds. A vector with no scalar after it is mixed at offset 0.
- *args
- Returns:
ndarrayEvery sound summed at its offset. An empty argument list gives an empty array.
- Raises:
ValueErrorIf a positional argument that should be a sonic vector is a bare number. Two consecutive offsets almost always means a sound was left out, and mixing silence at a wrong offset would hide it.
- Parameters:
args (ArrayLike)
- Return type:
NDArray[float64]
See also
mix_with_offsettwo sounds and a single offset.
mix_manya list of sounds aligned at their starts or their ends.
Examples
>>> chord = mix_many_with_offsets(note(220, 1), 0.25, note(277, 1), ... 0.25, note(330, 1)) >>> len(chord) / 44100 # each offset is from the mix so far 1.25