music.adsr_stereo¶
- music.adsr_stereo(duration=2, attack_duration=20, decay_duration=20, sustain_level=-5, release_duration=50, transition='exp', alpha=1, db_dev=-80, to_zero=1, number_of_samples=0, sonic_vector=0, sample_rate=44100)[source]¶
A shorthand to make an ADSR envelope for a stereo sound.
adsr()is applied to each channel with the same arguments, so the two channels keep their relative level through the envelope rather than being shaped independently.- Parameters:
- durationscalar
The duration of the envelope in seconds. Passed to
adsr()asenvelope_duration.- attack_durationscalar
The duration of the Attack in milliseconds.
- decay_durationscalar
The duration of the Decay in milliseconds.
- sustain_levelscalar
The Sustain level after the Decay in decibels. Usually negative.
- release_durationscalar
The duration of the Release in milliseconds.
- transition
str “exp” for exponential transitions of amplitude (linear loudness), “linear” for linear transitions of amplitude.
- alphascalar or array_like
An index to make the exponential fade slower or faster. Ignored if
transition="linear"oralpha=1. An array_like should hold three values, for Attack, Decay and Release.- db_devscalar or array_like
The decibels deviation to reach before using a linear fade to reach zero amplitude. An array_like should hold two values, for Attack and Release. Ignored if
transition="linear".- to_zeroscalar or array_like
The duration in milliseconds for linearly departing from zero in the Attack and reaching zero at the end of the Release. An array_like should hold two values, for Attack and Release. Ignored if
transition="linear".- number_of_samples
integer The number of samples of the envelope. If supplied,
durationis ignored.- sonic_vectorarray_like
A
(2, nsamples)stereo sound for the envelope to be applied to. If supplied,durationandnumber_of_samplesare ignored.- sample_rate
integer The sample rate.
- Returns:
ndarrayA
(2, nsamples)array: the envelope itself ifsonic_vectoris 0, or the sound with the envelope applied.
See also
adsrthe mono envelope, and the meaning of every argument here.
Examples
>>> envelope = adsr_stereo(duration=1) >>> envelope.shape[0] 2