music.louds¶
- music.louds(durations=(2, 4, 2), trans_devs=(5, -10, 20), alpha=(1, 0.5, 20), method=('exp', 'exp', 'exp'), number_of_samples=0, sonic_vector=0, sample_rate=44100)[source]¶
An envelope with linear or exponential transitions of amplitude.
See L() for more details.
- Parameters:
- durationsiterable
The durations of the transitions in seconds.
- trans_devsiterable
The sequence of deviations of the transitions. If method=”exp” the deviations are in decibels. If method=”linear” the deviations are amplitude proportions.
- alphaiterable
Indexes to make the transitions slower or faster [1]. Ignored it method=”linear”.
- methoditerable
Methods for each transition. “exp” for exponential transitions of amplitude (linear loudness). “linear” for linear transitions of amplitude.
- number_of_samples
interable The number of samples of each transition. If supplied, durations is ignored.
- sonic_vectorarray_like
Samples for the envelope to be applied to. If supplied, durations or number_of_samples is given, the final sound has the greatest duration of sonic_vector and durations (or number_of_samples) and missing samples are replaced with silence (if sonic_vector is shorter) or with a constant value (if durations or number_of_samples yield shorter sequences).
- sample_rate
integer The sample rate. Only used if nsamples and sonic_vector are not supplied.
- Returns:
- e
ndarray A numpy array where each value is a value of the envelope for the PCM samples. If sonic_vector is supplied, e is the sonic vector with the envelope applied to it.
- e
See also
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
>>> write_wav_mono(note_with_vibrato(duraton=8) * louds())