Minecraft from MIDI

Ok, this works:

block_type=(ring :fence, :glass, :farmland, :door_wood, :dirt, :diamond,  :cobblestone,  :clay,  :cactus,  :chest,  :brick,  :bookshelf,  :bedrock,  :bed)

live_loop :sax do
  nt, vel=sync "/midi/pisound_midi_ps-233vayb/1/1/note_on"
  tick
  block_note=(scale 0, :chromatic)[nt]
  b=block_type[block_note]
  x = (range 20, 100, step: 0.1).look
  y = 40
  z = -20
  mc_teleport x, y, z
  mc_set_block b, x, y, z-5
end

It takes incoming MIDI (from another Pi, running MODEP), and puts blocks related to notes in front of the view (z-5), and moves along the x axis. Works with both a keyboard and a wind controller, plugged in at the same time (and sending on the same MIDI channel).
Will try to add some musical response on the Sonic Pi side since, after all, the idea is to showcase some musical affordances. Might bring back my countermotion script since it can be fun to play. Could also constrain notes to a scale or assign certain events to certain notes. Obviously, the possibilities are endless.
Will probably not have much time to work on this before Saturday, so having something which works is quite important for me at this point.

1 Like