Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GodrichBeaulieu/b55bcef289fbc39393a7bbbbd53344bf to your computer and use it in GitHub Desktop.
Save GodrichBeaulieu/b55bcef289fbc39393a7bbbbd53344bf to your computer and use it in GitHub Desktop.
ADSR sine sonic pi surprises
# Sonic Pi Script
use_synth :sine
# Function for the slow oscillation
define :play_slow do |note|
play note, attack: 0.5, decay: 1, sustain_level: 0.5, sustain: 2, release: 2, amp: 0.5
sleep 4
end
# Function for the fast oscillation
define :play_fast do |note|
play note, attack: 0.1, decay: 0.2, sustain_level: 0.5, sustain: 0.4, release: 0.5, amp: 0.5
sleep 1
end
# Main Loop
live_loop :oscillate do
3.times do # Play slow sine waves 3 times
play_slow :e3
play_slow :g3
end
5.times do # Play fast sine waves 5 times
play_fast :e4
play_fast :g4
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment