← Iris

Volume 0%
Waveform sine
0 Hz
Move your mouse here to play
Click to enable audio
Waveform:
Min frequency 65 Hz
Max frequency 2000 Hz

The theremin

Invented by Léon Theremin in 1920, the theremin is one of the earliest electronic instruments and the only one played without physical contact. The original uses two antennas: one controls pitch (right hand proximity), the other controls volume (left hand proximity). The antennas form LC oscillator circuits whose capacitance changes with hand distance, producing a heterodyne frequency difference that becomes the audible tone.

How this simulation works

This lab uses the Web Audio API to synthesize sound in real time. An OscillatorNode generates the waveform (sine, triangle, sawtooth, or square), and a GainNode controls amplitude. Mouse X position maps logarithmically to frequency (because human pitch perception is logarithmic), and mouse Y maps linearly to volume. The AnalyserNode captures the waveform data for the oscilloscope display.

Note detection

The note name shown is the nearest pitch in 12-tone equal temperament, where each semitone is a factor of 21/12 ≈ 1.05946 apart. The calculation finds the nearest MIDI note number: n = 69 + 12 · log2(f / 440), then maps it to note names. A4 = 440 Hz is the reference.

Waveforms

A sine wave is the purest tone — a single frequency with no harmonics. A triangle wave contains odd harmonics falling off as 1/n². A sawtooth contains all harmonics falling off as 1/n, giving it a bright, buzzy character. A square wave contains only odd harmonics falling off as 1/n — hollow and reed-like. The oscilloscope shows these shapes directly.

Reverb

The reverb effect uses a ConvolverNode with a synthetically generated impulse response — an exponentially decaying noise burst that simulates the reflections in a reverberant space. It adds spatial depth and sustain to the otherwise dry oscillator output.