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, duration is ignored.

sonic_vectorarray_like

Samples for the tremolo to be applied to. If supplied, duration and number_of_samples 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.

note_with_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

>>> write_wav_mono(note_with_vibrato() * tremolo())  # a note with tremolo
>>> s = horizontal_stack(
...     *[note_with_vibrato() * tremolo(tremolo_freq=i, max_db_dev=j)
...      for i, j in zip([6, 15, 100], [2, 1, 20])])
>>> s = horizontal_stack(
...     *[tremolo(tremolo_freq=i, max_db_dev=j,
...              sonic_vector=note_with_vibrato())
...      for i, j in zip([6, 15, 100], [2, 1, 20])])
>>> envelope2 = tremolo(440, 1.5, 60)  # a lengthy envelope