Lab

Organ

A tonewheel organ device: nine drawbars, a percussion, a key click, a drive and a rotary speaker, with six registrations, a panel with drawbars and a keyboard, a Web Audio engine and tools for agents.

Audio UI

A tonewheel organ. Every key sounds nine sines at the organ's harmonics, from the 16' an octave under the key to the 1' three octaves over it, each at the level its drawbar is pulled to. A percussion on the second or third harmonic and a tick of key click open each note, and the sound goes through a drive and a rotary speaker, whose horns take a moment to reach a new speed. Start from one of its six registrations (Jazz, Gospel, Rock, Church, Flute, Full), then pull the drawbars. It is a device: a state, a panel, an engine and tools, each its own file.

Installation

pnpm dlx shadcn@latest add @audio-ui/organ

It installs the device's state, its engine and its panel to components/audio-ui/devices/organ/. The demo above, which wires them to a loop, is @audio-ui/block-organ.

Controls

A drawbar pulls from 0 to 8, each step 3 dB louder; the knobs read 0 to 10.

Controls · 16

Panel

The panel loads a registration from the menu in its title bar, beside the rotary speaker's switch, draws the nine drawbars as faders, the percussion, the key click, the drive and the volume beside them, and has a keyboard of two octaves that plays the organ. organPreset(name) gives a registration's whole state, and ORGAN_PRESETS lists them. With activeNotes, the notes held now, such as on a MIDI keyboard, light up their keys. The panel sends notes out and does not make the sound, so it plays through any engine.

import { OrganPanel } from "@/components/audio-ui/devices/organ/panel";
import { organDevice } from "@/components/audio-ui/devices/organ/device";

const [state, setState] = useState(() => organDevice.defaults());

<OrganPanel onValueChange={setState} value={state} />;

Engine

Create it, connect it and update it as for any device: see The engine.

engine.noteOn({ frequency: 261.63 }); // a key now
engine.noteOff(); // stops it

// Scheduled ahead on the audio clock, by a host that plays notes from a song:
engine.noteOn({ frequency: 440 }, { at: time, id: "a4" });
engine.noteOff({ at: time + length, id: "a4" });

An engine plays one key, through its own drive and rotary speaker. For chords, make as many as the notes you hold and give each note its own: the arrangement's engine does it for a MIDI track, and the block above keeps eight. A key sounds at once and stops at once, as an organ's does, with no click. A note while one is held cuts it and sounds anew, and a noteOff whose id is not the held note's lets nothing go. A drawbar moved sounds on a held key, and a registration with few drawbars out is lifted part of the way so it is not far quieter than a full one. An agent plays the organ with the play tool.

Built by Ouest Labs, the source code is available on GitHub.
RSS