Skip to main content

Theremin Music Simulation: Voyager/ScratchX

Profile picture for user Rich
Submitted by Rich on Mon, 08/20/2018 - 20:41

What is a Theremin?

A theremin , named after its Russian inventor in the early 1900's, is an electronic musical instrument that is controlled without any contact by the musician.   Volume is controlled by moving one hand near one antenna, while pitch is controlled by moving the other hand near a second antenna.  The sound is generated by a pair of high-frequency oscillators.

In this lesson, you will simulate a very simple theremin using Voyager and the PocketLab implementation of ScratchX.  To keep things as simple as possible, we will control only the frequency while keeping the volume at a constant level.  Voyager's IR rangefinder will be used to determine the distance of the performer's hand from Voyager.  In agreement with a traditional theremin, the closer the hand is to Voyager, the higher the pitch of the sound produced by ScratchX sound blocks.

Figure 1 shows a snapshot of the setup.  Voyager remains at rest on the far right.  A white paper grid has been added to show what note is played based upon the distance of the hand from Voyager's IR rangefinder.  The PocketLab implementation of ScratchX is running the theremin simulation program, which will be discussed in the next section of this paper.  To keep things simple, only the "white" keys of the piano from low C to high C have been programmed.  A thereminist would not have a grid in sight; rather, through much practice, would develop the skill of finding the desired notes.

Snapshot of the Simple Voyager/ScratchX Theremin
Figure 1

The ScratchX Program

The ScratchX sbx file for this program is included in this post.  Figure 2 shows a portion of the ScratchX program that simulates our theremin.  The blocks in this figure are assigned to the ScratchX stage--no sprites are needed.  Block 1 allows the user to select any one of twenty different instruments (piano, guitar, clarinet, etc.).  Block 2 lets the user select the size of a beat--0.025 is of very short duration.  The result is a sort of chirping sound with the pitch of the note being played.  The forever loop of block 3 gets the rangefinder value.  Based upon the value (in meters) obtained, a series of 15 if blocks plays the appropriate note for a time equal to the beat.  For example, the first if block will play note 72 (high C) if the performer's hand is between 4 and 6 cm from Voyager.  The if blocks cover  only the "white" key notes from high C to low C (ScratchX note 48).   This explains why the vertical lines in the grid of Figure 1 are spaced 2 cm apart.

Theremin ScratchX program segment
Figure 2

Two Videos of PocketLab Theremin Music

The above video use the block "set beats to 0.025". 

The above video used the block "set beats to 0.75".

Moog Synthesizers

The Moog company, well known for its music synthesizers since the 1960's, has recently released a new theremin product called Theremini®.  You can see it by clicking here.

A Voyager/ScratchX Theremin
Subject