The other day I was going through one of MrBomb's awesome SonicPi tutorials, where he used a nifty trick with arrays to build a drum grid similar to this one: https://learningmusic.ableton.com/make-beats/make-beats.html
This already worked perfectly, but I thought it could be taken one step further by building the arrays from strings of emojis:
use_bpm 98
open_hat = "⬜⬜❎⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜".split("")
closed_hat = "❎❎⬜⬜❎⬜❎⬜❎⬜❎⬜❎⬜❎⬜".split("")
clap = "⬜⬜⬜⬜❎⬜⬜⬜⬜⬜⬜⬜❎⬜⬜⬜".split("")
kick = "❎⬜⬜⬜⬜⬜⬜❎⬜⬜❎⬜⬜⬜⬜❎".split("")
marker = "❎"
live_loop :drum_machine do
16.times do |i|
sample :bd_haus if kick[i] == marker
sample :sn_zome if clap[i] == marker
sample :drum_cymbal_closed if closed_hat[i] == marker
sample :drum_cymbal_pedal if open_hat[i] == marker
sleep 0.25
end
end
This is so clever!