Created
August 24, 2025 12:41
-
-
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
This file contains hidden or 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
| 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