SonicPI uses SuperCollider to produce music, providing a Ruby-like DSL and an IDE to develop

Sound envelope (ADSR)

Sonic Pi’s ADSR envelopes have the following phases:

  • attack - time from 0 amplitude to the attack_level,
  • decay - time to move amplitude from attack_level to decay_level,
  • sustain - time to move the amplitude from decay_level to sustain_level,
  • release - time to move amplitude from sustain_level to 0 It’s important to note that the duration of a sound is the summation of the times of each of these phases. Therefore the following sound will have a duration of 0.5 + 1 + 2 + 0.5 = 4 beats:
play 60, attack: 0.5, attack_level: 1, decay: 1, sustain_level: 0.4, sustain: 2, release: 0.5