music.tremolo

music.tremolo(duration=2, tremolo_freq=2, max_db_dev=10, alpha=1, waveform_table=array([0., 0.0003835, 0.00076699, ..., -0.00115049, -0.00076699, -0.0003835], shape=(16384,)), number_of_samples=0, sonic_vector=0, sample_rate=44100)[source]

Synthesize a tremolo envelope or apply it to a sound.

Set fa=0 or dB=0 for a constant envelope with value 1. A tremolo is an oscillatory pattern of loudness [1].

Parameters:
durationscalar

The duration of the envelope in seconds.

tremolo_freqscalar

The frequency of the tremolo oscillations in Hertz.

max_db_devscalar

The maximum deviation of loudness in the tremolo in decibels.

alphascalar

An index to distort the tremolo pattern [1].

waveform_tablearray_like

The table with the waveform for the tremolo oscillatory pattern.

number_of_samplesinteger

The number of samples of the envelope. If supplied, d is ignored.

sonic_vectorarray_like

Samples for the tremolo to be applied to. If supplied, d and nsamples are ignored.

sample_rateinteger

The sample rate.

Returns:
tndarray

A numpy array where each value is a PCM sample of the envelope. If sonic_vector is input, t is the sonic vector with the tremolo applied to it.

See also

note_with_vibrato

A musical note with an oscillation of pitch.

fm

A linear oscillation of fundamental frequency.

am

A linear oscillation of amplitude.

Notes

In the MASS framework implementation, for obtaining a sound with a tremolo (or AM), the tremolo pattern is considered separately from a synthesis of the sound.

The vibrato and FM patterns are considering when synthesizing the sound.

Cite the following article whenever you use this function.

See the envelopes.am 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(V()*t())  # writes a WAV file of a note with tremolo
>>> s = H([V()*t(fa=i, dB=j) for i, j in zip([6, 15, 100], [2, 1, 20])])
>>> s = H([t(fa=i, dB=j, sonic_vector=V()) for i, j in zip([6, 15, 100],
                                                           [2, 1, 20])])
>>> envelope2 = t(440, 1.5, 60)  # a lengthy envelope