Let's discuss about Theremin and MIDI

Posted: 4/17/2021 8:55:20 PM

From: Occitanie

Joined: 3/4/2012


A few years ago I developed some source code to add MIDI to open theremin V3. Recently, I saw that @Dewster was asking himself the same question as me.

Then I thought that it would be good to discuss how digital theremins manage their MIDI messages. I started the discussion there but I don't want to sidetrack this thread which contains a lot of important information about the D-Lev Project.

The goal is to see how we can use the MIDI standard to transmit the most precisely the subtle information about hands' position near the antennas and get a MIDI signal that is intelegible for any external synth.

I'd like this forum thread to be for all those who have a project of MIDI theremin.

I start taking as a prerequisite that the reader has basic knowledge about Theremin itself, MIDI connections, MIDI message structure, etc...

So, what are we speaking about ?

We want to play our favorite MIDI synth with our favorite MIDI Theremin.

For that, we have the MIDI standard which defines NOTE ON/OFF messages, aftertouch messages, Pitch Bend messages and Continuous Controler changes (MIDI CC).

MIDI was designed in early 1980's arround a 7 bit architecture. It has some limitation that recent evolutions of the standard try to cover.

Our chance is that theremin is most frequently a monophonic instrument so we will probably not have to deal with MPE (Midi Polyphonic Expression).

But it is a precise intrument and, as such, we may need to extend our architecture to 14 bits sometime and reach some limitation of the standard.

[EDIT]: I currently just present the topic. I'll post more reflexion in a while. If this topic is interesting for you, just let me know...

Posted: 4/18/2021 7:03:08 PM

From: Occitanie

Joined: 3/4/2012

Basic Things:

We want to affect independant MIDI CCs corresponding to hands position next to the PITCH ANTENNA (ROD) and to the VOLUME ANTENNA (LOOP).
e.g. Typically CC #7 is used for volume.

In MIDI standard, NOTE ON/OFF messages have a NOTE NUMBER and a VELOCITY. Let's consider a Fade-in / Picth Variation / Fade-out sequence (I use right handed convention):

 - Fade-In
When left hand moves away from VOLUME ANTENNA (LOOP) and volume crosses a settable threshold, a NOTE ON is generated. VELOCITY can be fixed or depend on how fast left hand is moving. Right hand's position next to PITCH ANTENNA (ROD) determines the starting NOTE NUMBER and a Preliminary Picth Bend Message is sent before the NOTE ON in order to start at the right pitch.

- Pitch variation
When right hand moves next to PITCH ANTENNA (ROD), PITCH BEND messages are generated to reach exact pitch as long as pitch bend range will do.
- Fade-Out
When left hand moves close to VOLUME ANTENNA (LOOP) and volume goes under Volume trigger threshold, a NOTE OFF is generated to mute the playing note.

Pitch Bend range should be set wide enough to allow long glissandos, its 14bit definition should do to transmit pitch precisely.
It is up to designer to retrigger a new note at the limit of pitch bend range.

My question is:
Do you know if there is other approach among numeric Theremin or other Continuous instruments in their numeric MIDI version ?
(ribbon controlers, onde martenot-like, light theremin, ...)

Less basic things:

With the pitch antenna, we may want to control the pitch of an oscillator without using Notes and Pitch Bend. For this purpose, we need a continuous controler.

And in this case, 7bits are not enough. Then, we might want to use 14 Bit CC.
14 Bit CC consist in using CC[x](x < 32) as MSB and CC[x+32] as LSB. MIDI standards specifies:   
    The LSB value is assumed zero when an MSB arrives.
    The MSB may or may not be followed by an LSB.
A consequence of that is that MSB and LSB message are not applied in synchronisation resulting in some audible glitches.

And what if we want 14 resolution on any other CC oustide of CC# 0 to 31 ? (e.g. CC74 cutoff)

Any attempt to workarround this problem will result in a proprietary design on theremin side as well as on recceiver synth's side (Haken's MPE+, change the endianness, buffurization and resynchronization of LSB/LSB, use of NRPN, sysex...). With inherent loss of compatibility.

Do you know if there is a "less proprietary" design that tends impose itself as a standard ?

Posted: 4/19/2021 6:57:24 AM

From: Colmar, France

Joined: 12/31/2007

I haven’t yet looked at it in detail, but from the headings I saw, it seems that the new Midi 2.0 standard (currently still in draft) opens new ways for continuous pitch.

The 14bit pitch problem with the MSB/LSB glitch can be reduced on receiver side: After the MSB arrived, don’t use it immediately, but wait for the next message. If it’s the corresponding LSB, apply both together. If it’s not, handle it in the classic way, using only the MSB and setting the LSB to 0.

Posted: 4/19/2021 9:57:32 AM

From: Occitanie

Joined: 3/4/2012

Yes, I got your autodetection idea.

Let me try an implementation at receiver side...

(The receiver side is interesting for me too, I usually combine a very simple FM synthesizer program with the open theremin).

Posted: 4/20/2021 8:22:34 AM

From: Occitanie

Joined: 3/4/2012

new Midi 2.0 standard (currently still in draft) - Thierry

I probably have a good news!
I spent yesterday a significant part of the afternoon at https://www.midi.org/midi-articles/details-about-midi-2-0-midi-ci-profiles-and-property-exchange

And we can read:
"On Sunday, January 19, 2020 at the Annual Meeting of the MIDI Manufacturers Association, the complete suite of MIDI 2.0 specifications were adopted unanimously by the MMA members in attendance. "

It brings MIDI to another higher level in a very more modern way.
Especially, it covers the 16 bit topic properly.

At the end, it will probably change my approach into: stick to the standard in 1.0, study 2.0, do beter things by using 2.0 when I am mature enough.

Posted: 4/26/2021 3:43:23 PM

Joined: 10/24/2020

There are several MIDI enabled instruments with continuous pitch-bend. For instance, the new Arturia PolyBrute has a continuous ribbon control...and there are several others. 

Also, I have seen some Arduino MIDI implementations that have continuous pitch bend data, which leads me to believe that the method that a theremin requires may already be built in to the Arduino MIDI Library.

There are many CV based modulars out there, not using pitch quantization, that cannot rely on NONO + individual pitch bend/offset to replicate things like filter sweeps or microtone structure. I'm relatively certain that there is code in the AML that covers this. 

Maybe a hard look at the AML is in order, and perhaps a theremin fork that would provide MIDI signals that support MPE (playing chords with your theremin is FUN, yo!) and perhaps something like polyphonic aftertouch, using small variations in the volume plane. 
It might be a good thing to start a Arduino Theremin MIDI Library and a set of rules, so that we're all playing with the same cc messages and conventions. 

At that point, it may even be an easy thing to make an Arduino (or Teensy, or Pi, or Itsy Bitsy) shield that will work with theremin outputs, ideally audio, but potentially CV for instruments that provide CV and Gate outputs. 

I feel like it would be relatively easy to do, and I've had some luck with the Itsy Bitsy doing some advanced DSP for backing tracks for my theremin stuff. I'm a shitty coder, though...and I'm also an engineer, and I've learned that doing things in a way that makes sense to ME seems not to make sense for anyone else...unless they're an engineer, and I explain why I did things that way. Shitty+cryptic=unusable for the public. 

The other option is to make a small modular system outfitted with one of the excellent CV to MIDI modules, and see how that works. 

Posted: 4/26/2021 3:46:47 PM

Joined: 10/24/2020


Posted: 4/27/2021 5:15:27 PM

From: Occitanie

Joined: 3/4/2012

Thanks for the link.

The question here is more about which messages should exchange two device (a theremin and another one) without taking into account the internal technology (arduino, FPGA, ... ).

AML library is more about how to implement MIDI inside a device. Anyway it may help for some implementation for sure and may lead us to some other example of continuous controler.

Thanks for pointing out Polybrute as well. I spent some time on manual... Did you find MIDI implementation chart ?

You must be logged in to post a reply. Please log in or register for a new account.