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.
Application — RTS-05 Prototype 21
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.
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
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)
Relationships organized using an Euler lattice. The original handwritten notation and connecting lines are preserved.

Figure 3. Initial keyboard concept (detail)
An early proposal translating relationships between notes into a split-key arrangement.

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
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
The supplied final layout shows each note name and its frequency ratio relative to the reference pitch.
| Additional pitch | Monzo (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.
| Reference | Constituent notes | Ratios relative to tonic |
|---|---|---|
| Major | C₀, 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 |
| Minor | A₋₁, B₋₁, C₀, D₋₁, E₋₁, F₀, G₀, G♯₋₂ | 1, 9/8, 6/5, 4/3, 3/2, 8/5, 9/5, 15/8 |
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 tonic | Ratio | Minor tonic | Ratio |
|---|---|---|---|
| C₀ | 1 | C₀ | 1 |
| D♭₊₁ | 16/15 | D₋₁ | 10/9 |
| D₋₁ | 10/9 | E♭₀ | 32/27 |
| D₀ | 9/8 | E₋₁ | 5/4 |
| E♭₊₁ | 6/5 | F₀ | 4/3 |
| E₋₁ | 5/4 | F♯₋₁ | 45/32 |
| F₀ | 4/3 | G₋₁ | 40/27 |
| G♭₊₁ | 64/45 | G₀ | 3/2 |
| G₀ | 3/2 | A₋₁ | 5/3 |
| A♭₊₁ | 8/5 | B♭₀ | 16/9 |
| A₋₁ | 5/3 | B₋₁ | 15/8 |
| B♭₀ | 16/9 | C₋₁ | 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.
| Root | Second note | Third note | Fourth note | Implemented 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
RTS-05 Exact
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
| Ratio | Monzo | Meaning |
|---|---|---|
| 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.
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.
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
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
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
| Waveform | Coefficient aₛ,ₕ | Condition |
|---|---|---|
| Exact Sine | 1 | h = 1; zero otherwise |
| Exact Square | 4/(πh) | Odd h; zero for even h |
| Exact Saw | 2(−1)⁽ʰ⁺¹⁾/(πh) | All h |
| Exact Triangle | 8(−1)⁽ʰ⁻¹⁾⁄²/(π²h²) | Odd h; zero for even h |
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
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
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.
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.
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.
Figure 9. Interpolation and enclosing intervals
The error width is exaggerated for illustration.
8. Determining final rounding and adaptive reevaluation
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.
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
Exact timbres
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 technique | Established approach | Comparison with RTS-05 |
|---|---|---|
| SonicWeave [1] | Rational and monzo representations of musical intervals | Interval representation itself is established |
| Jird [2] | Ratio-based music notation and external synthesis | Score and pitch representation are distinct from PCM rounding |
| Analog Devices DDS [3] | Rational frequency generation using a programmable modulus | Precedent for integer phase and rational frequency synthesis |
| Faust [4] | Integer / fixed-point phase oscillators | Phase precision is distinct from guaranteed rounding of the full mix |
| Dannenberg [5] | Error and performance analysis of table interpolation | Interpolation error analysis is established |
| Ziv / MPFR / FLINT [6–8] | Correct rounding and adaptive evaluation | Principles 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 item | Result / scope |
|---|---|
| Fractions and prime factors of all 143 keys | All 143 keys are 7-limit |
| Major and minor tonalities | 13/13 and 12/12; octave-equivalent ratio sets |
| Diminished seventh chords | 5/5; four-note ratio sets formed by stacking three 6/5 intervals |
| Continuity from Prototype 19 | Relevant dedicated computation-core source strings were compared and found identical |
| Earlier Prototype 19 test records | Internal and simulated Worklet checks: 616/616; high-precision mpmath comparisons: 520/520 (reproduced from earlier technical documentation, not newly rerun) |
| Performance and physical output | No 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
| Stage | Scope of exactness |
|---|---|
| Pitch ratios / integer phase | Exactly defined using rational numbers |
| All-voice synthesis model | Finite Fourier series, symbolic coefficients and rational gain |
| Numerical evaluation | Designed to determine final rounding from an interval enclosing the exact value |
| Web Audio PCM | Finite Float32 precision |
| OS / DAC / transducer / air | Effects 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
- SonicWeave — TimeMonzo class reference
- Jird — Quick start
- Ken Gentile / Analog Devices — AN-953: Direct Digital Synthesis (DDS) with a Programmable Modulus
- GRAME — Faust Libraries: Oscillators
- Roger B. Dannenberg (1998) — Interpolation Error in Waveform Table Lookup
- Abraham Ziv (1991) — Fast Evaluation of Elementary Mathematical Functions with Correctly Rounded Last Bit
- GNU MPFR — Manual
- FLINT — Correctly rounded elementary functions
- 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.