OpenTheremin V3 - MIDI Input under Sonic Pi v3.2.1

Hardware & Software Details

Hardware:
OpenTheremin V3

Firmware:
OpenTheremin_V3 With MIDI

Software:
Hairless MIDISerial Bridge
loopMIDI Virtual MIDI Loopback
Sonic Pi v3.2.1 x64 PAF

Issue Summary:
Got my OpenTheremin V3 hooked up to SonicPi! Works great using a slight tweak to the MIDI example code in the documentation, but I don’t know how to take advantage of the the pitch_bend and control_change messages it fires, just the note_on as per the example.

# Welcome to Sonic Pi
live_loop :midi_OpenThereminV3 do
  use_real_time
  note, velocity = sync "/midi:loopmidi_port:0:1/note_on"
  synth :tb303, note: note
end

Furthermore, the volume antenna does not seem to function at all to control the volume of the midi signal as I would expect.

Here’s where I stand currently:

Just stepping up and down through the pitch scale. Volume was moved a few times to no effect. Last message logged was the “pause” button on the OpenThereminV3.

You are not actually using the velocity information at all in your code.
You should try something like

# Welcome to Sonic Pi
live_loop :midi_OpenThereminV3 do
  use_real_time
  note, velocity = sync "/midi:loopmidi_port:0:1/note_on"
  synth :tb303, note: note,amp: velocity/127.0
end

velocity will be a number in the range 0-127 By dividing it by 127.0 you will get a number in the range 0.0->1.0 which you can use to control the amplitude of the note.
(You divide by 127.0 and not 127 to get floating point division, not integer division)

2 Likes

Excellent, thanks so much for your assistance!

I’ll try that later tonight and see if it behaves as expected.

Hm, does not seem to operate as intended.

Working with the author of the MIDI firmware for the OpenTheremin to see what I’m doing wrong.

Thanks!