music.mix2

music.mix2(sonic_vectors, end=False, offset=0, sample_rate=44100)[source]

Mix sonic vectors of arbitrary lengths.

The operation consists in summing sample by sample [1]. This function helps when the sonic_vectors are not of the same size.

Parameters:
sonic_vectorslist of sonic_arrays

The sonic vectors to be summed.

endbool

If True, sync the final samples. If False (default) sync the initial samples.

offsetlist of scalars

A list of the offsets for each sonic vectors in seconds.

sample_rateinteger

The sample rate. Only used if offset is supplied.

Returns:
Sndarray

A numpy array where each value is a PCM sample of the resulting sound.

Notes

Cite the following article whenever you use this function.

References

[1]

Fabbri, Renato, et al. “Musical elements in the discrete-time representation of sound.” arXiv preprint arXiv:abs/1412.6853 (2017)

Examples

>>> W(mix2(sonic_vectors=[np.vstack(), N()]))  # writes a WAV file
                                               # with nodes