Pitch and Volume Tracking MIDI interface for the Theremin

by Stephen Hobley on January 24, 2011

Post image for Pitch and Volume Tracking MIDI interface for the Theremin

Can you top a laser harp…?

After I published some of my earlier videos I get asked on a regular basis if I can create a MIDI interface that would work with any Theremin. So after completing the vacuum tube Theremin, I thought it was about time I put something together.

The hardware tracks threshold crossings of the audio output and uses a fairly comprehensive look-up table to match the fundamental frequency detected with a corresponding MIDI note value (assuming a concert pitch of A= 440Hz).

Volume information is also integrated over time to produce and envelope function that is mapped to MIDI volume data.

(Click the diagram above for a larger version. This covers the basic audio input system.)

Since I was using the LM324 opamp I wanted the whole system to operate with just a Gnd / +5v supply. The first phase is just a biasing network to get the AC input signal up into the active range for the opamp. Then a fairly standard design envelope follower. Finally a differential amp to scale the output back down to positive 0 to +5v, a buffer, a low pass filter and straight into the Analog input of the ATMEGA328.

Pitch preview is even simpler – a threshold comparator generates a square wave, and then the ATMEGA processes this on a positive going interrupt pin.

The real work takes place inside the ATMEGA328 – I used a MIDI synth and the above circuits to generate a look-up table of values. This lookup table (takes up a lot of RAM – hence the 328 and not 168) handles the non-linearity of the system, and since the values were derived on the system being used to track pitch, it takes into account any discrepancies in timing.

There are currently four modes of operation:

PITCH – tracking the frequency and output a corresponding MIDI note.
CNTRL – output MIDI controller data (currently set as #55 – general control #1)
ARP 1 – read input from a MIDI keyboard and ‘arpeggiate’ the chord described using the same chord “shorthand” used by the Casio MT-65/70 keyboards (Maj / Min / b7 / Min7)
ARP 2 – Construct an arpeggio around any chord combination held on the keyboard – up to 12 notes.

Volume data is transmitted in each of the modes. Switching modes can be accomplished via a footswitch, or panel switches.

So far I’ve been able to test it successfully with a PAIA Theremax, a Moog Etherwave, and the Keppinger Vacuum Tube Theremin – in all cases it performs very well.

It’s proven to be a very good training tool – as it shows you exactly where the notes are. With the addition of simple software to render the note on a computer screen you can test how linear the response of the Theremin is (I’ve even been able to plot the response on paper and use this as a playing guide.)

One of the criticisms of trying to interpret Theremin data using MIDI is the discrete nature of the digital form. Since the Theremin is a naturally continuous instrument a great deal of the expression can be lost when remapping the output into note data. Therefore a possible improvement would be to use the pitch detune information (currently driving the LED ladder) to operate the pitch bend function of the synthesizer – depending on how good the implementation of the synth engine is it should be possible to get a seamless transition of pitch from one note to the other. This would allow for the vibrato effect to be mapped out, with the 14 bits resolution operating over 1-2 tones. Hopefully this should prevent aliasing.

In the past I’ve just tried to use the pitch bend over a 2 octave range, but this is far from musical 🙂

There are software solutions out there, but they do involve having to take a laptop along to the gig.

I have designed a PCB that holds all the system components and power supply – if there is enough interest I might start selling these as a kit.

UPDATE : I made a slight change to the firmware so that the pitchbend is used to track pitch changes “in-between” whole semitones. Now the MIDI instrument tracks the Theremin pitch almost identically – with the same level of control and expression you get with the regular Theremin tone.

Now I have to quit making cool sound effects and do something musical with it 🙂

UPDATE UPDATE : I put together a complete set of plans available here, and uploaded a board you can buy from BatchPCB.


{ 37 comments… read them below or add one }

clicclic January 24, 2011 at 5:26 pm

If playing this looks ‘cool’ it will probably be a hit!

PA January 25, 2011 at 7:19 pm

“if there is enough interest I might start selling these as a kit.”
I’m interested !! 🙂

Stephen Hobley January 25, 2011 at 11:40 pm

PA – thanks for letting me know…

Would you be interested in :
(a) a downloadable set of design documents,
(b) a PCB and preprogrammed chip,
(c) a complete kit with all parts

I could probably put out (a) by the end of the month, (b) or (c) would take a bit longer.


PA January 26, 2011 at 4:29 pm

one year ago I built my own laserharp after downloading your documents. It was a really great pleasure. Your explanations and schematics were perfect.
So I’m more interested in (a).
But If you sell (b) or (c), it will be great too. 🙂

Bill Fredette January 29, 2011 at 11:53 am

Hi, Steve. I’d be interested in a combination of a and b – a premade board with chip, but instructions and a parts list for the rest of the assembly.


Stephen Hobley January 29, 2011 at 6:11 pm

Hi Bill,

I just uploaded the first version of the download-only package – it has instructions on how to etch your own PCB board at home.

It’s being beta-tested right now.

I will be looking into PCB manufacturer as the next step.


PA February 1, 2011 at 4:05 pm

Hi Steve,

I successfully bought the complete set of plans !
Now, let’s see..

Stephen Hobley February 1, 2011 at 6:23 pm

Thanks! You are officially customer #1.

I tried to make it with really easy-to-find components – do let me know if you have any problems locating parts.

Brian Baker February 4, 2011 at 3:21 am


Looks like quite a fun project. You must have a lot of extra time on your hands!


Stephen Hobley February 4, 2011 at 9:44 am

No – I just deferred sleeping for about 10 years

“You can achieve anything you want in life – you just need the right drugs” – Ronnie Wood

James February 8, 2011 at 2:46 pm

Hi Stephen,

I’m trying to figure out a schematic for a theremin-like device that provides control voltage for electrical instruments – used to control the resistance like a pot, to affect the brightness of a light, to be picked up by a microcontroller and translated into digital messages – whatever. Can you point me in the right direction? It sounds like your fantastic project here is mostly for people who already have the theremin antenna hardware.

Stephen Hobley February 8, 2011 at 3:57 pm

James – yes I do – I was actually planning on showing people how to build a Theremin on my site – just a simple one with digital heterodyning .

The output of heterodyning is always a frequency – but with some simple electronics this can be converted into a voltage signal.

Would that help?

Casey Bushmaker February 10, 2011 at 6:26 pm

I’d definitely be interested in a complete kit. Might make an attempt at assembling the components myself but it would be my first electronics project!

Stephen Hobley February 10, 2011 at 6:59 pm

Cool – that’s two more people added to the list.

At the moment BatchPCB wants something like $65 + shipping for single boards. If I can get an order of 15 together then I can place the order somewhere else at a substantially lower cost. I can also redesign the board to be smaller – which will help with costs.


jonah February 23, 2011 at 9:41 am

im interested

Ron Amundson March 2, 2011 at 5:27 am

This is interesting…
” Therefore a possible improvement would be to use the pitch detune information (currently driving the LED ladder) to operate the pitch bend function of the synthesizer – depending on how good the implementation of the synth engine is it should be possible to get a seamless transition of pitch from one note to the other. ”

It seems like a huge opening for glitches, depending upon how happy the synth takes to that much midi data in a short time slot. Its been 20 years since I wrote midi code… but what if you were to anticipate what was coming next a few pitch bend updates before the transition (monitoring 1st and 2nd derivative)… and then send a new note on volume 0. The transition from old to new would then seemingly be possible with fewer commands, just pitch bend/volume… and you could shut down the old note in between additional pitch bend commands.

Again, its been many many years…came across your post as I was building a long wave theremin for a contest, and thought hey, making this midi would be cool… and after 10 minutes thought egads, what a rabbit hole, so I went looking to see whats changed since way back when.

Stephen Hobley March 2, 2011 at 8:54 am

When I first attempted it – I was only really looking to emulate the MidiVox – made by Moog and no longer available.

Once I had everything running I wondered how far I could go with the MIDI implementation and was quite pleasantly surprised to see how well modern synthesizers could handle the rapid stream of MIDI data (not sure how well an earlier hardware synth could cope)

OSC is actually a better protocol for Theremin connectivity – 32 bit values throughout and connectivity via USB 2.0, TCP/IP, or whatever high speed transport you want to use.

I have been designing my own synths using “SynthMaker” – and these are created from the ground-up to implement supplemental Theremin patches. In these synths note-on/off is ignored and the pitch is governed by the full width (14-bit) of the pitch bend message. Still discrete notes, but lots of microtonality.

Tiago March 10, 2011 at 12:33 pm

It’s really beautiful like this one:



Stephen Hobley March 10, 2011 at 1:15 pm

Yes, I talk with Peter on the Levnet mailing list – his videos were an inspiration to me.

Casey Bushmaker May 13, 2011 at 6:23 pm

I’m confused by something — does this only take CV as the input or does it take the audio signal? I have a regular Moog Etherwave (not the Plus that has the CV outputs). Would I be able to use it with this?

Stephen Hobley May 15, 2011 at 6:25 am

It reads the audio signal directly, although it’s the work of minutes to get the code to work from a CV voltage instead.

gielareck June 10, 2011 at 6:50 pm

Hi Steve:

I have just finished assembly of your theremin interface to midi and trying
to start it.
I have two questions:

1. What should be the range of voltage outbound changes on 14 socket of
lm324 IC2D circuit?
2. How to set fuse bits by programming atmega circuit with external
programmer while having the file THEREMIN_MIDI_2011.cpp.hex generated in
arduino (programmer STK500 – Parallel High Voltage Programming, environment
AVR studio 4)

Thank you for the help and besr regards, G.

Fozzy The Bear July 23, 2011 at 3:37 pm

Hi Steve,
I’d be really interested in
(b) a PCB and preprogrammed chip,
OR Ideally…
(c) a complete kit with all parts,
As I’m just about to build a Jaycar MKII Theremin in a more sensible sized box than the original design. Hopefully with proper sized and spaced antenna it should make it a reasonably playable instrument.

So your design for pitch and volume to MIDI would be a great addition to it. Controlling my Novation Supernova II from the theremin would be fantastic.

Do let me know if you put out a kit at a sensible price.

Best Regards…

Dean Connors September 23, 2011 at 3:14 pm

Not clued in on the technical details,but would love to attempt to build ,while my hands and eyes still function.Put me down for all kits available.

Mark Vervaart November 23, 2011 at 1:20 pm

Hi Stephan. I don’t have the programming environment for this processor. For me it would be really helpfull to have a programmed processor. Is that possible? The rest I’ll figure out myself. I’m building the Forbes theremin now. Would be nice to have the midi in it, and not inventing the wheel twice… (I use PICs at work and Philips LPC before, but your processor is not supported by MPLAB…

hear ya and all the best from France

Stephen Hobley November 23, 2011 at 1:28 pm

Sorry I Mark I don’t have hardware available for sale.

It’s pretty simple to get a programmed chip however – that’s why I chose the Arduino environment.

Professor Hall December 17, 2011 at 4:41 pm

Hello Steve,

I have built both the Midi Camera and the Volume and Pitch MIDI Interface. The Camera works fine but I am having problems with the Tracker. There is no input through the Vol In JP5 connection, but the PP JP7 input works – except that as soon as there is any signal strong enough to register, the volume readout on the LCD & LED’s go to max. The MIDI Output doesn’t work either but the MIDI In does. I used the BatchPCB and the LCD117.

I am using an EtherWave Plus and have tried every combination of Audio output and Pitch Preview. I have adjusted the trimpots mentioned below as well as the controls on the EtherWave Plus.

The build passed all the tests and successfully uploaded the Theremin_MIDI_2011 sketch with the AFSoftSerial library imported (I did this a second time to be sure). There are a few notes that may or may not matter.

1) I used 10K trim pots from Radio Shack rather than Cermet. They seem to work correctly.
2) The connections for the switches on the BatchPCB did not work using pin 2 of JP 10 and pins 1&2 of JP11 but do with pins 1&2 of JP10 and pin 2 of JP11. (Pin 2 of JP10 is ground.)
3) The LCD serial lead has to be to pin 2 on JP 8 with power from JP12. The instructions were a little vague as to where to hook the LCD 117 but this looks like pin 10 of Atmega 168 shown on the schematic rather than pin 9 as described on page 21 of the assembly instructions. I did use a Boarduino with an Atmega 328, so might there be a difference in the chip?

I have traced Vol In JP5 as far as the LM124N socket and the components are of the right value and installed correctly. I changed the LM124N with the same results. I did recheck all the solder connections with a loop but did not start resoldering since everything seemed to check up to the LM124N socket.

Except for the Vol maxing immediately at 756 or so, the pitch readout and LED’s seem to work correctly when using PP in. The switches change the LCD display line from Pitch to Cont and Arp 1&2. The LCD registers MIDI in signals. but there is no MIDI output and Vol In is dead.

Your work is very well done and I appreciate all the effort it took. Thanks for your help with this and Merry Christmas. Professor Hall

Casey January 8, 2012 at 12:40 pm

Hi Stephen,
(or anyone else who has built one of these successfully, I guess)
I’m a total electronics novice and I’m about to purchase parts to assemble my pitch to midi board.. I was wondering whether part R3 should be a 3.3K resistor like it says in the parts list and on the batch PCB board itself, or a 3.9K resistor like it says in the step by step instructions? Thanks!

Alejandro June 20, 2012 at 8:56 pm

Hi Stephen
I’ve recently purchased your kit guide (very awesome by the way!), but I’m confused on the input of the tracker (excuse for my amateor knowledge, I’m novice):

is it taking only one analog audio input from the theremin? If so, what those the “P” and “V” represent in your model (I assumed it was pitch and volume, but not sure)

Stephen Hobley June 21, 2012 at 9:55 am

You are correct, the Pitch input should be a signal that just contains pitch data, and the volume should be one that contains both pitch and volume. For the different Theremin types there are different places in the circuit where you can tap this.

Scott July 18, 2012 at 11:31 pm

Hey Stephen, I have a few questions:

1) Can you elaborate on the difference between the PITCH and CNTRL mode? Currently I am learning the MIDI protocols, so I am novice when it comes to this stuff. From my understanding, when you set the MIDI channel as control change, does that mean that you change parameter of other MIDI devices (similar to the Roland FC-300 MIDI Footswitch) via Pitch-to-MIDI converter? Whereas in PITCH mode, it basically acts like a MIDI instrument, sending NOTE ON, Velocity, etc?

2)In the code you provided, I am having hard time locating the part where the button_state declares mode ARP2; I’ve only figured out that in ProcessButton is where you use the toggle switches to pick the mode operation. Can you help me pinpoint where you can choose ARP2?

3) As for the 3rd pin analog, have you thought of any extra feature that you may have thought of? I may twinkle little bit on that extra pin…

Thank you so much for providing this tutorial!


Anthony August 7, 2012 at 3:36 pm

Hey Stephen, can you elaborate a little more on what you are trying to accomplish with the differential amp circuit.

My guess is that you are trying to make sure that the voltages to the arduino ranges from only 0-5V.

Also what is the expected voltage from a theremin audio output signal that would be fed into the vol in pin.


Scott October 15, 2012 at 9:26 pm

Hey Stephen, can you talk elaborate on how you calculated the lower_bound_period numbers ?

Joe January 9, 2013 at 8:44 pm

I’ll commit to a kit at around $100 a pop, too!

Ragune April 26, 2013 at 11:38 am

If you sell a complete ready-to-use-kit let me know, I am interested to use it w. the theremin.

David Young July 25, 2013 at 6:16 pm

I would love to buy a ready to use kit. Is this possible?
Really love your work Stephen.

Paul Camann December 22, 2013 at 2:47 pm

Now that BatchPCB appears to have gone the way of many businesses in this economy, is there any other source for the PCBs for this project? If not and I want to send it out to be fabricated, do you have any suggested vendors, or am I on my own?

Thanks for your time.

Leave a Comment

Comments links could be nofollow free.

{ 1 trackback }

Previous post:

Next post: