Skip to content

Instantly share code, notes, and snippets.

@camilajenny
Created August 24, 2025 12:41
Show Gist options
  • Save camilajenny/8583e3ca782db02163c21196f74e516b to your computer and use it in GitHub Desktop.
Save camilajenny/8583e3ca782db02163c21196f74e516b to your computer and use it in GitHub Desktop.
Sonic Pi code snippet for section arrangment of instruments such as kick, snare, and hat
section_duration = 16
arrangement = {
kick: [0, 1, 1, 0, 1, 1],
snare: [0, 0, 1, 1, 1, 0],
hat: [0, 1, 1, 1, 1, 0]
}
define :section_on? do |inst|
section = get(:look) / section_duration
arrangement[inst][section] == 1
end
set :look, 20
if section_on?(:kick)
print "yes"
else
print "no"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment