MIDI to OSC? Other Ways to Communicate between Pis?

Been using two pisound setups during events. One Pi uses MODEP to produce sounds from MIDI controllers (using JX10 and SetBfreak plugins, the latter going in rkr distortion). Playing weird sounds with my wind controller gets people intrigued and they can play with a keyboard controller.
My other setup does “Sonic Minecraft”, based on the default Raspbian install. The code is from one of Sam’s articles about being a Minecraft VJ. In that case, Sonic Pi plays some semi-random loops and puts blocks in Minecraft.
In a way, the HAT isn’t bringing anything noticeable to the equation and people have asked me about it. Here, latency doesn’t matter much. And the sound comes through HDMI anyway.
Something which was mentioned by many people is about my controller affecting Minecraft. While it can be done, have yet to set it up in such a way. The two setups are disconnected.
Soooo… Thinking of my options. The simplest is probably to run a DIN5 MIDI cable from the MODEP pisound’s MIDI out and plug it into the Sonic Pi pisound’s MIDI in. Could then tell Sonic Pi to put blocks at MIDI note distance in front of the character. That could look cool as well, à la @rbn. Besides, it justifies the second pisound.
The other main option could be to convert MIDI in to OSC on the MODEP setup and sync Sonic Pi to that (through wifi).
There’s also supposed to be something about WiFi MIDI but have yet to investigate it.
Latency needs not be an issue, since it’s just about putting blocks. Could also use the MIDI or OSC messages to change something about the Sonic Pi pattern. Could probably help my event neighbours get less annoyed by the repetitiveness of that Sonic Pi loop (though they didn’t make any negative comment).
Thoughts?
https://instagram.com/p/Bf52wTJACNjQg24eoh7dC-ZTFboK5k9jpJXbSg0/

I’d vote for MIDI cable solution :slight_smile: One more thought would be to use the Audio Input of Pisound with a microphone or something else, stuff in Minecraft could happen based on the audio levels.

Also, it’d be cool to set up some effects to act on the Minecraft Pisound’s output, as you mentioned yourself on Showcase Your Setup or Pisound in the Wild :slight_smile:

1 Like

The audio levels idea is pretty neat. Not sure there’ll be enough time for me to make it work this Saturday, but it makes a lot of sense. Will likely have something that for the Maker Faire in the Fall.
In the meantime, will probably just set up the Minecraft Pi to accept MIDI from both controllers on the MODEP and put blocks in the field of view.
One option would be to run all the sound on the same Pi connected to my amp, instead of HDMI.
Processing audio effects at the same time as two synths are playing from MIDI may have been the cause for glitches, in the previous instance, so a bit wary of playing with this. But we’ll see. Might be worth a try.

(This is not a terribly complicated situation and it shouldn’t be too difficult for me to figure out. Thinking out loud has several advantages, in this case.)

As expected, running a MIDI cable between the two pisound HATs is a fine solution.

At this point, my integrated setup works as follows:
One pisound-HATted Pi3 runs MODEP. It takes MIDI in from a USB-MIDI keyboard and a wind controller plugged through MIDI in, play two synths from them, and forwards the MIDI signals through MIDI out. It also does audio thru without further processing.

Another Pi3 with pisound runs Minecraft and Sonic Pi and gets MIDI input from the first Pi. Sonic Pi runs a very simple script which puts blocks in Minecraft based on incoming notes from MODEP. The effect is fun and easy to grasp. Latency isn’t enough to distract from it. That Pi isn’t producing any sound, yet (will probably add something to the script so that it plays in countermotion with incoming notes). Once it does, the sound will be routed to the MODEP Pi which will connect to my amp. (Need to buy another audio cable.)

For some reason, the “No Active Sensing” plugin doesn’t have the expected effect. My WX-11 keeps sending active_sensing messages. Apart from being annoying when trying to watch MIDI signals in Sonic Pi, it doesn’t sound like it’s really causing an issue, which is a bit of a relief.

Probably won’t have that much time to tweak this setup before Saturday but, even as it is, it’s workable. It’s a bit strange to have Sonic Pi not producing any music but that’ll be an easy fix. Even if it remains as-is, it won’t be hard to explain what’s happening.

Will likely report back after the event and, hopefully, will have a good video excerpt to share. Will ask someone at the museum to film a bit of it before people arrive.

1 Like

Ok, added sounds to Sonic Pi.
That Pi now takes incoming MIDI and plays notes in countermotion. The latency’s quite audible, but it actually makes it sound like Sonic Pi is responding to my controllers.
There’s quite a bit of background noise too, but that should be fine with my cheapo amp in the noisy environment of the museum.
Haven’t tried to run this countermelody in parallel with “Sonic Minecraft” but if performance isn’t good enough, will just play one at a time. When kids ask why Minecraft is on the screen, it’s easy enough to run that buffer on its own.
Part of the idea of these events, in my mind, is also about getting people to understand that creating things is about playing with limitations.

1 Like

So… Tried both scripts at the same time: a simplified (and silent) “Sonic Minecraft” and a simplified version of my countermelody script. No performance issue from having both at the same time. For instance, the latency between a note played on a controller hooked on my MODEP Pi and a countermotion note in Sonic Pi remains pretty much constant, whether Minecraft is running or not (and whether or not Sonic Pi uses its API).
Having the MODEP Pi route some incoming audio while also playing two synths can produce a bit of glitch when multiple notes are played at once. But even that should be ok.
Altogether, my integrated setup feels fitting for a Raspberry Jam. It’s unusual and flexible enough to give people some ideas and make them curious. It’s really not meant to be impressive. It’s just a way to awaken, stimulate, build awareness…

1 Like