Created
August 10, 2023 12:50
-
-
Save GodrichBeaulieu/b55bcef289fbc39393a7bbbbd53344bf to your computer and use it in GitHub Desktop.
ADSR sine sonic pi surprises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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