Dev.to WebDev πŸ›  Dev πŸ‘ 2 πŸ“– 5 min read

Encoding 36 French Conservatoire Oboe Fingerings, Trill Linkages, and Acoustic Registers in Strict TypeScript

Most woodwind fingering references on the web still ship as scanned PDFs or grids of 1990s GIF diagrams. That breaks immediately on mobile viewports, fails keyboard navigation, hides alternate fingerings from screen read

Most woodwind fingering references on the web still ship as scanned PDFs or grids of 1990s GIF diagrams. That breaks immediately on mobile viewports, fails keyboard navigation, hides alternate fingerings from screen readers, and forces search engines to guess what a raster image depicts. While building OboeLib, we replaced bitmap charts with a strictly typed TypeScript state model covering all 36 chromatic oboe pitches (Bb3 to A6), eight orchestral trill mechanisms, and millimeter-level reed scrape specifications.

This post walks through the data modeling decisions behind turning physical French Conservatoire (Système 6 bis) keywork into a deterministic static TypeScript schema that drives SVG rendering, server-rendered plain-text tables, and a read-only MCP endpoint from one file.

1. Modeling Physical Keywork Instead of Arbitrary Dot Grids

A naive approach to fingering data stores an array of six booleans ([1, 1, 1, 1, 1, 0]) plus a free-text footnote for side keys. On the oboe, that collapses immediately because three mechanical states cannot be represented by binary finger dots:

  1. The left-hand index key (LH 1) is tri-state, not boolean. Below Db5 it seals completely (closed). On Db5 (554.37 Hz), D5 (587.33 Hz), and Eb5 (622.25 Hz), the player rolls the finger downward to expose a small upper vent (half). Above C5 on notes like open C#5, it lifts completely (open).
  2. Three separate octave vents govern upper registers. Semi-automatic Conservatoire oboes engage the 1st octave thumb key across E5–Ab5, switch to the 2nd octave side key across A5–C6, and use a 3rd octave upper-joint lever from E6 through A6.
  3. Alternate fingerings share the same pitch frequency but change mechanical bridges. F4 (349.23 Hz) and F5 (698.46 Hz) each carry three distinct key configurationsβ€”Regular F, Left-Hand F (ClΓ© de Fa Γ  gauche), and Forked F (Fa fourchu)β€”whose acoustic validity depends on the surrounding notes.

Instead of encoding fingerings as opaque strings, we modeled every key cup and side lever explicitly in OboeKeyLayout:

export type HalfHoleState = 'open' | 'half' | 'closed';

export interface OboeKeyLayout {
  // Left Hand
  halfHole: HalfHoleState;
  lh1: boolean;
  lh2: boolean;
  lh3: boolean;
  octave1: boolean;      // 1st Octave Key (Back Thumb)
  octave2: boolean;      // 2nd Octave Key (Side Forefinger)
  octave3: boolean;      // 3rd Octave Key (Top Lever)
  lhGSharp: boolean;
  lhEb: boolean;
  leftF: boolean;
  lowBb: boolean;

  // Right Hand
  rh1: boolean;
  rh2: boolean;
  rh3: boolean;
  rhFKey?: boolean;
  forkedFResonance: boolean;
  rhLowC: boolean;
  rhLowCSharp: boolean;
  rhEb: boolean;
  rhLowB: boolean;
  rhSideBb: boolean;
  trillKey1: boolean;    // Upper C-D Trill Key (Tr1)
  trillKey2: boolean;    // Lower C#-D Trill Key (Tr2)
}

Making every mechanical lever a typed boolean (and halfHole a three-way union) eliminates string-parsing bugs. Any impossible stateβ€”such as marking octave1: true on a half-hole D5β€”becomes trivially catchable during static build validation.

2. Turning Context-Dependent Fingering Rules Into Pure Functions

Knowing three valid fingerings for F4 is not enough during sight-reading; musicians need to know which F prevents the right ring finger from sliding off RH 3 onto the side Regular F key.

Because Regular F occupies the space between RH 2 and RH 3, moving directly between F and any note that closes RH 3 (D, Eb, Db, C, B, Bb) introduces an audible mechanical hiccup at tempo. We encoded that Conservatory rule as a deterministic state check:

type FVariant = 'regular' | 'left-f' | 'forked-f';

const RH3_CLOSED_NEIGHBORS = new Set(['D', 'Eb', 'Db', 'C', 'B', 'Bb']);
const LEFT_PINKY_OCCUPIED = new Set(['Ab', 'G#', 'Eb', 'Bb3']);

export function resolveOboeFChoice(prevPitch: string, nextPitch: string): FVariant {
  const needsAlternate =
    RH3_CLOSED_NEIGHBORS.has(prevPitch) || RH3_CLOSED_NEIGHBORS.has(nextPitch);

  if (!needsAlternate) return 'regular';

  const leftPinkyBusy =
    LEFT_PINKY_OCCUPIED.has(prevPitch) || LEFT_PINKY_OCCUPIED.has(nextPitch);

  return leftPinkyBusy ? 'forked-f' : 'left-f';
}

Separating the decision logic from UI state meant we could drive the browser tool at https://oboelib.com/fingering, the standalone Left-F solver, and the JSON-RPC MCP tool check_oboe_f_fingering_choice from identical TypeScript rules.

3. Modeling Trills as Anchor State + Active Oscillator

Trill charts suffer from a second UI problem: showing two static fingering diagrams side by side forces the player to mentally diff 22 keys to figure out which single finger actually moves.

In OboeTrillEntry, we split each trill into two layers: a stationary baseKeys: OboeKeyLayout snapshot and a single activeTrillKeyId pointing to the oscillating lever (trill1, trill2, rhEb, rhSideBb, rh1, or lhGSharp). For example:

  • C5 – D5 (whole-tone): Anchor standard C5 (LH 1 + RH 1) and oscillate trill1 (Tr1) with the right side finger rather than rolling across the half-hole.
  • C#5 – D5 (semitone): Anchor open C#5 (LH 2-3 + RH 1) and pulse trill2 (Tr2).
  • A4 – Bb4 and B4 – C5: Hold A4 (LH 1-2) or B4 (LH 1) and tap rh1 alone, relying on the articulated Conservatoire bridge linkage.

In the interactive Conservatoire trill reference, that separation lets the SVG layer render stationary closed keys in solid dark fill while pulsing only activeTrillKeyIdβ€”and lets the server render a plain-text HTML table explicitly naming both the anchor grip and the moving finger.

4. Dual Output: Vector SVG + SSR Plain-Text Tables + Typed Specifications

A subtle pitfall with interactive JavaScript instrument charts is shipping a blank canvas to crawlers and assistive tech until client hydration completes. We solved this by deriving three outputs from the same static modules during Next.js static export:

  1. Interactive SVG Visualizer: Binds each boolean in OboeKeyLayout to an SVG <circle> or <path> element with explicit aria-label keywork descriptions and client-side Web Audio synthesis.
  2. Server-Rendered Plain-Text Reference Tables: Every pitch from Bb3 (233.08 Hz) to A6 (1760.00 Hz) and every trill entry renders directly in initial HTML markup so musicians on slow connections, screen readers, and text-only crawlers receive exact key codes immediately.
  3. Structured Morphological Specs: Non-fingering domain guides follow the same strict-schema patternβ€”for instance, the American long-scrape and European short-scrape comparison encodes exact scrape length (10.5 mm vs. 6.8 mm), shoulder step geometry (hasShoulderStep), and micrometer thickness across Tip (0.06 mm vs. 0.08 mm), Heart (0.40 mm vs. 0.45 mm), Spine (0.49 mm vs. 0.54 mm), and Back (0.30 mm vs. 0.36 mm) on a 47 mm staple.

5. Reusing the Same Data Over Read-Only MCP

Because the entire fingering and reed dataset is pure TypeScript with zero database dependencies, exposing it to coding agents and CLI tools required only a thin stateless streamable-http worker (POST /api/mcp) and an open-source wrapper repository (github.com/AbigailDavised/oboelib-mcp). Every tool is marked readOnlyHint: true and returns deterministic JSON directly from the same Conservatoire tables powering the web UI.

If you are building vertical domain toolsβ€”whether for musical instruments, hardware pinouts, or engineering reference chartsβ€”modeling the physical state space in strict TypeScript first pays off across every surface: fewer UI bugs, accessible SSR fallbacks by default, and clean machine-readable APIs without duplicating business logic.

The full French Conservatoire acoustic register tables, trill lever matrix, and reed scrape measurements are also documented in the OboeLib Technical Reference.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.