After reading this thread I adapted the code to hooked up my Makey Makey to my old cardboard ukulele and strum some chords.
4 key presses are hooked up to the Ukulele strings via the Makey Makey and then you can change the chord by pressing different keys on the keyboard (which I may make a foot switch board to trigger via the Makey Makey as well)
Here’s the adapted code (prob could be cleaner )
Big thanks to @robin.newman . This is a game changer for me!
notes=Hash.new
chords=Hash.new
l=[[:g4,:c4, :e4, :c5],
[:g4,:d4, :g4, :b4],
[:a4,:d4, :fs4, :a4],
[:a4,:c4, :e4, :a4],
[:a4,:c4, :f4, :a4]
]
n=["a", "w", "s", "d", "f"]
c=["g", "h", "j", "k"]
set :n,n
l.length.times do |i| #loop to create the hash
notes[n[i].ord]=l[i]
end
c.length.times do |i|
chords[c[i].ord]=i
end
k = 0
k2 = 0
live_loop :getkey do
use_real_time
use_synth :pluck
b= sync "/osc*/key"
if b[0] == 103 || b[0] == 104 || b[0] == 106 || b[0] == 107
m = b[0]
k2 = k
else
k=b[0]
end
#note to play
if b[0] == 103 || b[0] == 104 || b[0] == 106 || b[0] == 107
play notes[k2.to_i][chords[m.to_i]]
end
sleep 0.05
end