
This was a short project I put together to experiment with creating a 3D interface in the physical world that could also connect to 3D visuals in the digital world. The code in p5.js uses keyPress events to work with the Makey Makey. It also is sending MIDI messages using the webMidi to trigger sounds in Sonic Pi.
p5.js Code: https://editor.p5js.org/mrbombmusic/sketches/1dAWOwawY
Note: If you want to use this, you'll need to change the part of the code for which midi device is used for sending output. It is indicated in the code and all available outputs will appear in the console when the sketch begins.
(This code was adapted from this tutorial by Luisa Pereira: https://medium.com/@luisa.ph/making-your-own-musical-instruments-with-p5-js-arduino-and-webmidi-2422b9596791)
Sonic Pi code:
live_loop :midi_box do
use_real_time
note, velocity = sync "/midi*/note_on"
puts note, velocity
set :b, note
synth :square, note: note + 24, release: 1
end