play note (symbol_or_number)
Play note with current synth. Accepts a set of standard options which include control of an amplitude envelope with attack:
, decay:
, sustain:
and release:
phases. These phases are triggered in order, so the duration of the sound is attack + decay + sustain + release times. The duration of the sound does not affect any other notes. Code continues executing whilst the sound is playing through its envelope phases.
Accepts optional args for modification of the synth being played. See each synth’s documentation for synth-specific opts. See use_synth and with_synth for changing the current synth.
If note is nil
, :r
or :rest
, play is ignored and treated as a rest.
Introduced in v2.0
amp: |
The amplitude of the note |
amp_slide: |
The duration in beats for amplitude changes to take place |
pan: |
The stereo position of the sound. -1 is left, 0 is in the middle and 1 is on the right. You may use a value in between -1 and 1 such as 0.25 |
pan_slide: |
The duration in beats for the pan value to change |
attack: |
The duration in beats for the sound to reach maximum amplitude. Choose short values for percussive sounds and long values for a fade-in effect. |
sustain: |
The duration in beats for the sound to stay at full amplitude. Used to give the sound duration |
release: |
The duration in beats for the sound to fade out. |
# Example 1 | |
|
|
# Example 2 | |
|
|
# Example 3 | |
|
|