Java Theremin

Hold down the cursor to hear the playback. Drag along the vertical to change the volume and along the horizontal to change the playback rate. The black bands reflect the black keys on a piano keyboard, and can be used to find "relative" pitches. For playing a melody, consider using W-like motions, peaking at the note values that you wish to have be the most prominant.

The slider on the lower left moves the tone from a pure Sine wave to a pure Sawtooth, Square or Pulse wave, depending on which wave type is selected. Middle positions are a mix of the sine and the selected wave. If this control has the focus, tapping the keyboard letter "a" will move the slider left, and tapping the letter "s" will move the slider right.

The "octaves" dropdown can be used to specify the pitch width of the window. The "pitch" slider can change the tuning of the entire window. You can use it to set the Theremin's keyboard to play in tune with other instruments.

NEW: Echo effect! Echo volume is independant of the Theremin volume. To hear the echo continue to nothing, move the mouse to the floor of the control area. Note: if the settings don't "take", click in the field with the mouse, then press the "Enter" key to post the setting you wish to hear.

NEW: Added a Pulse Wave. Noisy little thing, especially for aliasing in the high end. Also, mixing it with a sine wave seems very odd. Better if one could use the slider to vary the pulse width.

Calling this a "Theremin" is perhaps a loose use of the term. I'm mostly referring to the fact that with a Theremin one waves a hand in a two-dimensional space to control volume and pitch. Much interesting info about theremins can be found at Wikipedia.

Putting this up is a little premature, as there are some aliasing artifacts in the higher octaves. This is my first experiment with wave-table synthesis and there are definitely ISSUES to work out! But a big plus here is that the application is pretty responsive to mouse movements. A FIFO array receives mouse events along with a timestamp. A class I wrote called an RTESmoother ("Real Time Event Smoother") then feeds values to a soundplayer on a "per frame" basis. The code that does this is on display at Java-Gaming.org.

If you have trouble getting this application to sound, try the "Options" menu in the top left, to select different audio playback channels. I have found that the "Java Sound Audio Engine" for example, has troubles, but that "direct playback" options usually work quite well. (Coming eventually: ability to adjust the audio buffer size.)

Feedback can be made at this link at Java-Gaming.org.