01 / Numbers become spectra
Each key has a distinct prime pᵢ and a fixed wavelength λᵢ. A press starts at exponent 1; holding adds 1 at the selected interval, up to 32. Each exponent is an equal-radiant-power weight, not a photon count.
n = ∏ pᵢeᵢ
Sλ(λ) = ∑ eᵢ δ(λ − λᵢ)
Unique factorization recovers every spectral weight. Multiplying numbers adds their spectra, within the instrument’s range. The number 1 means no light. Sustain keeps released weights; pressing again adds to them.
02 / Spectra become perception
Light frequencies are logarithmically spaced from 700 nm red to 400 nm violet, using f = c/λ. The official CIE 1931 2° observer functions convert the sum of spectral lines to XYZ:
(X, Y, Z) = ∑ eᵢ (x̄(λᵢ), ȳ(λᵢ), z̄(λᵢ))
The 1 nm data is linearly interpolated. Mixing adds power at existing frequencies; it does not average frequencies or produce a new spectral line. Different spectra can look identical: a color alone cannot recover the number.
03 / Perception meets a screen
XYZ is transformed to linear sRGB. Most pure spectral colors are outside a screen’s gamut. We clip negative channels, apply one shared exposure-compression scale, then apply the sRGB transfer function. The preview is an approximation; the XYZ values above remain unmodified.
Doubling every exponent doubles XYZ and preserves chromaticity. Equal power does not mean equal perceived brightness, so violet and deep red can look dim. Keycap colors are normalized as a guide.
Sound uses the same exponents as power weights, with one equal-tempered sine tone per prime, C3 to C♯5. Amplitude grows as √eᵢ, because power is proportional to amplitude squared. Tones add before output compression and limiting; these protect loud chords and do not change the encoded spectrum.
s(t) = A₀ ∑ √eᵢ sin(2πfᵢt + φᵢ)
Data: CIE (2019), DOI 10.25039/CIE.DS.xvudnb9b, CC BY-SA 4.0. Unmodified data, bundled locally. Conversion: W3C CSS Color 4. Data provenance & display formula.