Reiji's Explorationsin Sound & Structure

December 3, 2026

Reiji Tuning System 05 — A 7-Limit Just-Intonation Keyboard and Exact Audio Synthesis

Overview:
Reiji Tuning System 05 (RTS-05) is a prototype 7-limit just-intonation keyboard conceived by Reiji (age 10). It was designed to enable performance in 25 keys (13 major and 12 minor) and five diminished seventh chords on a single keyboard layout, without switching keys or tuning settings. Prototype 21 comprises 143 keys across three octaves.

The investigation into audio synthesis began with Reiji’s idea that combining binary and ternary representations might allow rational numbers with repeating expansions to be retained exactly as tuples of integers. Questioning the replacement of exact just-intonation ratios with floating-point approximations during synthesis, the project experimentally implements four Exact waveforms using integer and rational arithmetic and certified interval evaluation to preserve fidelity to the mathematical model up to the final Float32 output.

Note:The tuning concepts, keyboard design and research questions originate from Reiji. A parent organizes the documentation, and AI assists with coding and technical explanations. The following distinguishes Reiji's design requirements, source-code verification, earlier test records and remaining research questions.

143Keys / 3 octaves
25Tonalities / no switching
7-limitInteger ratios
4Exact waveforms

Application — RTS-05 Prototype 21

RTS-05 Prototype 21 interface with original keyboard and ratios preserved and UI labels translated into English.

Reiji Tuning System 05 — Exact / 7-limit

Prototype 21 interface (original screenshot with its Japanese UI labels translated into English for this illustration). Each key displays its note name and integer ratio; the reference frequency, octave, waveform and volume can be adjusted. The linked application may display Japanese interface labels.

Individual notes can be played by clicking the keys with a mouse. On an iPad or a touch monitor supporting ten-point multitouch, multiple keys can be held simultaneously, enabling chord performance with up to ten touch inputs. The number of simultaneous inputs depends on the device and browser.

Open RTS-05 ExactWeb application / opens in a new tab

Research Background

In just intonation, musical intervals are defined as integer frequency ratios. With a fixed twelve-key octave, it is difficult to assign distinct, closely spaced pitches needed for different tonalities and chords to the same keys. RTS-05 explores a layout in which distinct integer ratios are assigned to separate keys, eliminating the need to switch tuning settings during performance.

A second question concerns how much of mathematical just intonation can be preserved if precisely defined ratios are subsequently approximated during sound synthesis. Keyboard structure and audio computation are treated as separate research topics and integrated into a single prototype instrument.

Design Process

Figure 1. Initial design sketch

Figure 1. Initial design sketch

Interval ratios, relationships between notes and a keyboard concept recorded on a whiteboard. Brightness and contrast have been adjusted without altering the original content.

Figure 2. Note relationships (detail)

Figure 2. Note relationships (detail)

Relationships organized using an Euler lattice. The original handwritten notation and connecting lines are preserved.

Figure 3. Initial keyboard concept (detail)

Figure 3. Initial keyboard concept (detail)

An early proposal translating relationships between notes into a split-key arrangement.

Figure 4. Intermediate design sketch

Figure 4. Intermediate design sketch

An intermediate stage exploring specific split-key positions. According to Reiji, this sketch contains errors; it is reproduced as a record of the design process.

Figure 5. Final design sketch

Figure 5. Final design sketch

The latest handwritten layout, including the additional pitches. Figures 1–5 document Reiji's design process.

Keyboard Structure

The keyboard consists of central main keys, upper split keys and lower extension keys. The Prototype 21 source defines 47, 47 and 49 keys, totaling 143. The final section contains two additional keys at the octave boundary.

Figure 6. Final keyboard layout diagram

Figure 6. Final keyboard layout diagram

The supplied final layout shows each note name and its frequency ratio relative to the reference pitch.

Additional pitchMonzo (2, 3, 5, 7)Design change
35/24(−3, −1, 1, 1)Extension key near G
256/135(8, −3, −1, 0)Upper split key at the right edge
27/20(−2, 3, −1, 0)Lower extension key near F

The colors of E₀ (81/64) and E₋₁ (5/4) were revised to prioritize the pure major third relative to C. The subscripts used for note names in this article follow Reiji's tuning notation, rather than conventional octave numbering.

25 Tonalities and Diminished Seventh Chords

The reference pitch sets include the conventional seven scale degrees together with additional pitches required for harmony. The major reference is C₀ and the minor reference is A₋₁. The minor leading tone is a pure major seventh (15/8), corresponding to G♯₋₂ = 25/16 relative to the C reference.

ReferenceConstituent notesRatios relative to tonic
MajorC₀, D₋₁, D₀, E₋₁, F₀, F♯₋₁, G₀, A₋₁, B₋₁1, 10/9, 9/8, 5/4, 4/3, 45/32, 3/2, 5/3, 15/8
MinorA₋₁, B₋₁, C₀, D₋₁, E₋₁, F₀, G₀, G♯₋₂1, 9/8, 6/5, 4/3, 3/2, 8/5, 9/5, 15/8
53×158×12=2516

Playable tonics and verification method

For each tonic listed below, the relative ratios of the reference pitch set are multiplied by its tonic ratio and normalized by integer powers of two into the interval [1, 2). Each resulting ratio was checked against the pitch-ratio set in the current source using exact fractions rather than floating-point arithmetic. No ratios were missing in any of the 25 cases (13 major and 12 minor). This verifies pitch-class availability, not every voicing, fingering or piece in actual performance.

Major tonicRatioMinor tonicRatio
C₀1C₀1
D♭₊₁16/15D₋₁10/9
D₋₁10/9E♭₀32/27
D₀9/8E₋₁5/4
E♭₊₁6/5F₀4/3
E₋₁5/4F♯₋₁45/32
F₀4/3G₋₁40/27
G♭₊₁64/45G₀3/2
G₀3/2A₋₁5/3
A♭₊₁8/5B♭₀16/9
A₋₁5/3B₋₁15/8
B♭₀16/9C₋₁80/81
B₋₁15/8——

Five diminished seventh chords

Three successive pure minor thirds of 6/5 are stacked. The ratios relative to the root are 1 : 6/5 : 36/25 : 216/125. Unlike equally spaced minor thirds in equal temperament, four successive intervals of 6/5 do not span an exact octave.

(65)×65×65=216125
RootSecond noteThird noteFourth noteImplemented ratios (octave-normalized)
E₋₂G₋₁B♭₀D♭₊₁100/81, 40/27, 16/9, 16/15
B₋₂D₋₁F₀A♭₊₁50/27, 10/9, 4/3, 8/5
F♯₋₂A₋₁C₀E♭₊₁25/18, 5/3, 1, 6/5
C♯₋₂E₋₁G₀B♭₊₁25/24, 5/4, 3/2, 9/5
G♯₋₂B₋₁D₀F₊₁25/16, 15/8, 9/8, 27/20

The ratios of all four required pitches were confirmed to exist in the keyboard set for each of the five chords. The term 7-limit means that the prime factors of each ratio are restricted to 2, 3, 5 and 7; it does not imply that every arbitrary combination of keys will be consonant.

Exact Audio Synthesis Engine

The exploration of exact audio computation began with Reiji’s suggestion that using binary and ternary arithmetic together might make it possible to retain numbers that would otherwise have non-terminating representations as combinations of integers. For example, 1/3 has a repeating expansion in base 2 but a terminating expansion in base 3. This idea led to a reconsideration of how numbers are represented, rather than simply increasing floating-point precision. The implementation uses prime-exponent representations (monzos) and integer and rational arithmetic, rather than combining positional numeral systems with different bases.

If the aim is mathematically exact just intonation, does replacing precisely defined pitch ratios with approximations during subsequent computation depart from the intended model? This question motivated the Exact engine introduced in Prototype 19 and retained in Prototype 21. It applies to four waveforms: Exact Sine, Exact Square, Exact Saw and Exact Triangle.

1. Comparison with conventional audio synthesis

Example floating-point approach

Pitch ratios / frequencies
Finite-precision phase increments
Numerical evaluation of each voice
Finite-precision gain and polyphonic mixing
Conversion to PCM

RTS-05 Exact

Preserve integer ratios
Phase by integer remainder
Define a mathematical model of all voices
Combine intervals enclosing the exact value
Determine correctly rounded Float32 output

Conventional oscillators employ a variety of methods; the left column illustrates only one example. The Exact engine also uses numerical approximations in intermediate evaluations, but does not accept an approximation alone as the definitive value. Instead, it determines the final PCM rounding from an interval enclosing the exact value. If rounding cannot be determined, it increases precision; if the result remains unresolved, it stops.

2. Prime-factor representation in 7-limit tuning

r=2a3b5c7d,(a, b, c, d) ∈ ℤ⁴
RatioMonzoMeaning
9/8(−3, 2, 0, 0)Major second
81/64(−6, 4, 0, 0)Pythagorean major third
5/4(−2, 0, 1, 0)Pure major third
3/2(−1, 1, 0, 0)Perfect fifth
7/4(−2, 0, 0, 1)Harmonic seventh
63/64(−6, 2, 0, 1)Inverse of the septimal comma

A monzo is a vector of prime exponents: multiplication and division of intervals correspond to addition and subtraction of exponents. In the actual synthesis path, keyboard ratio strings are converted directly into BigInt numerators and denominators. Exactness is not achieved by monzo notation alone; subsequent phase computation is also defined using rational numbers.

8164÷54=8180

3. Common clock and integer phase

The initial reference frequency C, 261.625565 Hz, is treated exactly as a finite decimal. This is not the irrational equal-tempered C derived from A = 440 Hz. Let rⱼ be the ratio of key j, oⱼ its octave index, s the global octave shift, and Fₛ the sample rate.

fj=Crj2oj+s,fjFs=PjDj
kj[n]=(nPj)modDj

The AudioWorklet's common frame number n provides the time reference. Phase is recalculated in integers at the start of each block and subsequently updated by integer remainder. Notes starting at different times still share the same time origin. Attack and release envelopes, and errors in the physical clock, are separate issues.

Figure 7. Common period of 4:5:6:7

Figure 7. Common period of 4:5:6:7

An ideal continuous-time model. Frequencies 4f, 5f, 6f and 7f each complete an integer number of cycles within the common period 1/f. This is neither actual PCM nor a recording.

4. Preserving sine terms as mathematical objects

ζD=e2πiD,sin(2πkD)=ζDk−ζD−k2i

Here ζ is a primitive Dth root of unity. The sine of a rational multiple of a full turn can be represented as an algebraic number. For example, D = 8 and k = 1 gives √2/2, without needing a finite decimal expansion. Rather than fully expanding cyclotomic polynomials, the implementation represents a sparse sum of sine terms reduced by symmetry to the first quadrant, with rational coefficients. Values such as 0, ±1 and ±1/2 are extracted exactly, and identical terms are combined. The implementation does not exhaustively decide general algebraic equivalence.

5. Four band-limited waveforms

ws(x)=∑h=1Has,hsin(2πhx)
WaveformCoefficient aₛ,ₕCondition
Exact Sine1h = 1; zero otherwise
Exact Square4/(πh)Odd h; zero for even h
Exact Saw2(−1)⁽ʰ⁺¹⁾/(πh)All h
Exact Triangle8(−1)⁽ʰ⁻¹⁾⁄²/(π²h²)Odd h; zero for even h
H=min(63,⌈Fs2fj⌉−1)

When the fundamental is within the bandwidth, only harmonics strictly below the Nyquist frequency are included, up to harmonic 63. Sine contains only the fundamental. Since the coefficients are defined using rational numbers and integer powers of π, the full model, including Square and the other waveforms, is generally not closed within a cyclotomic field alone. The waveforms are finite Fourier series, distinct from ideal infinite-series square and other waveforms.

Figure 8. Finite Fourier series of four waveforms

Figure 8. Finite Fourier series of four waveforms

Illustrative plots computed through harmonic 15. The ringing in waveforms such as Square is a property of finite series. The implementation supports up to harmonic 63; these plots are not measurements of actual output.

6. Joint synthesis of all voices, gain and envelopes

gj[n]=1212500LEj[n]

L is the integer value of the Level slider, and Eⱼ[n] is a rational linear attack/release envelope. At 48 kHz, an 18 ms attack corresponds to 864 samples and a 155 ms release to 7,440 samples. Gain at key release is retained as the starting point for decay.

X[n]=∑jgj[n]ws(kjDj)
Y[n]=R32(clip(X[n],−1,1))

After summing the amplitudes of all voices, the model clips the result to ±1 and aims to perform the final conversion to binary32 using round-to-nearest, ties-to-even. Clipping is a nonlinear operation defined by the model, distinct from rounding error. The ordinary path's GainNode and compressor are not included in the Exact path.

7. Fast path: certified table interpolation

Partial sums for each waveform are precomputed. A cycle is divided into 8,192 steps, and symmetry permits storing the first 4,097 points. The 128 rows (Sine 1, Square 32, Saw 63 and Triangle 32) total 4,195,328 bytes. Grid values are stored as integers scaled by 2⁵⁰; even when stored in Float64, they remain exact as long as they are within its exactly representable integer range. The earlier documentation states that table generation used 88-bit integer interval evaluation.

Ti≈250w(i8192)

At runtime, arbitrary phases are evaluated with ten-point Newton forward-difference interpolation. The error bound accounts for grid quantization, the interpolation remainder and rounding in interval arithmetic itself. Outward rounding is used to maintain an enclosure of the exact value. Each voice's interval is scaled by rational gain and added to the others. Independently regenerating every table entry and proving the error bounds remain future tasks.

Interval enclosing exact valueTen grid points (schematic)

Figure 9. Interpolation and enclosing intervals

The error width is exaggerated for illustration.

8. Determining final rounding and adaptive reevaluation

L≤X≤U,R32(L)=R32(U)⇒R32(X)=R32(L)

In this expression, L and U denote the lower and upper bounds of the clipped interval. If both endpoints round to the same binary32 value, the exact value within the interval must round to that value as well. Signed zero is distinguished in the code. When the fast path cannot determine rounding, sine terms are reconstructed as a symbolic sum. Integer interval evaluation, using Machin's formula and bounds on alternating-series remainders, increases precision successively to 80, 128, 192 and 256 bits.

π4=4arctan(15)−arctan(1239)
Rounding boundaryResolvedReevaluateRounded value ARounded value B

Figure 10. Determining correct rounding

If an interval straddles a rounding boundary, the output is not finalized. If rounding remains unresolved at 256 bits, the engine stops with an error rather than falling back to approximate output.

In the fast path, the clipped integer endpoints on the 2⁻⁵⁰ grid are exactly representable in binary64. They are converted to Number, divided by 2⁵⁰ and rounded to binary32 using Math.fround. The slow path uses the integer-based floatBits function. The rounding guarantee is conditional on the validity of the enclosing interval; it is not a guarantee that every input will be resolved.

9. Implementation paths and waveform display

Ordinary timbres

OscillatorNode / PeriodicWave
Per-voice Gain / Analyser
Master / Compressor
Destination

Exact timbres

Single AudioWorklet
Interval evaluation of all voices
Final Float32 PCM
Destination

The Exact path connects a single AudioWorkletNode to the Destination. Ordinary timbres retain the conventional Web Audio path. Switching between Exact waveforms sends the shape parameter to the dedicated engine. MODEL PREVIEW displays a theoretical 10 ms waveform starting at phase zero, so the display appears stationary even while the internal playback phase advances. Math.sin used for visualization is independent of audio synthesis; the preview is not a measured waveform.

Comparison with Existing Techniques

Rational interval representation, integer-phase oscillation, wavetable interpolation and correct rounding using interval arithmetic are all established techniques. RTS-05 investigates their integration into a full polyphonic audio model for a 7-limit keyboard instrument.

Related techniqueEstablished approachComparison with RTS-05
SonicWeave [1]Rational and monzo representations of musical intervalsInterval representation itself is established
Jird [2]Ratio-based music notation and external synthesisScore and pitch representation are distinct from PCM rounding
Analog Devices DDS [3]Rational frequency generation using a programmable modulusPrecedent for integer phase and rational frequency synthesis
Faust [4]Integer / fixed-point phase oscillatorsPhase precision is distinct from guaranteed rounding of the full mix
Dannenberg [5]Error and performance analysis of table interpolationInterpolation error analysis is established
Ziv / MPFR / FLINT [6–8]Correct rounding and adaptive evaluationPrinciples of guaranteed rounding are established

A distinguishing design feature of this approach is its integration of exact rational phase, band-limited waveforms, all-voice gain and clipping, and final rounding determined by enclosing intervals within one synthesis path. The scope of the cited material is limited; this article does not claim that equivalent precedents do not exist or that the implementation is a world first.

Verification and Future Work

Verification to date

Verification itemResult / scope
Fractions and prime factors of all 143 keysAll 143 keys are 7-limit
Major and minor tonalities13/13 and 12/12; octave-equivalent ratio sets
Diminished seventh chords5/5; four-note ratio sets formed by stacking three 6/5 intervals
Continuity from Prototype 19Relevant dedicated computation-core source strings were compared and found identical
Earlier Prototype 19 test recordsInternal and simulated Worklet checks: 616/616; high-precision mpmath comparisons: 520/520 (reproduced from earlier technical documentation, not newly rerun)
Performance and physical outputNo physical measurements at the time of writing

The earlier technical documentation records Node.js synthesis times for one second of four-voice audio at 48 kHz: Sine 407 ms, Square 509 ms, Saw 513 ms and Triangle 879 ms. Triangle at 96 kHz was also recorded at 1,792 ms. These results do not guarantee real-time browser performance or uninterrupted audio; reproducible benchmarks are needed.

The boundary between mathematical definition and physical output

StageScope of exactness
Pitch ratios / integer phaseExactly defined using rational numbers
All-voice synthesis modelFinite Fourier series, symbolic coefficients and rational gain
Numerical evaluationDesigned to determine final rounding from an interval enclosing the exact value
Web Audio PCMFinite Float32 precision
OS / DAC / transducer / airEffects of resampling, clock accuracy, distortion and other factors; not measured

AudioWorklet output in the Web Audio API is represented by Float32Array [9]. Higher-precision output formats, alternative APIs and control methods that do not require PCM are possible research directions. However, even Float64 or higher-bit-depth PCM cannot represent general sine values exactly. Integer-ratio frequency control and the exactness of physical waveforms are distinct issues.

Future work includes independent verification of table generation and interpolation remainders, tests at rounding boundaries and under cancellation, real-time browser performance measurements, comparisons with existing engines under equivalent conditions, digital loopback and measurements after the DAC. The transducer itself also becomes a research subject, including possible periodic control through a common clock and integer counters and analog waveform-shaping methods.

Sharing and Open Exploration

We hope this research will inspire new discoveries and experiments among those interested in tuning systems, mathematics, acoustics, and instrument design.

We welcome its use, adaptation, and independent implementation in education, research, creative work, and product development.

Our hope is that this research will continue to evolve openly through the knowledge, curiosity, and ideas of others.

References

  1. SonicWeave — TimeMonzo class reference
  2. Jird — Quick start
  3. Ken Gentile / Analog Devices — AN-953: Direct Digital Synthesis (DDS) with a Programmable Modulus
  4. GRAME — Faust Libraries: Oscillators
  5. Roger B. Dannenberg (1998) — Interpolation Error in Waveform Table Lookup
  6. Abraham Ziv (1991) — Fast Evaluation of Elementary Mathematical Functions with Correctly Rounded Last Bit
  7. GNU MPFR — Manual
  8. FLINT — Correctly rounded elementary functions
  9. W3C — Web Audio API, AudioWorkletProcessor

Internal materials: RTS-05 Prototype 19 Technical Documentation (revised edition, December 3, 2026), Prototype 21 HTML source, and Reiji's initial, intermediate and final design sketches.