T-010 — Pedals: continuous sustain, sostenuto, soft pedal; and the split of stage 2 into tasks

Status: done (D0–D6 accepted by the maintainer, 2026-12-06; the maintainer’s listening pending) · Area: rust, piano · Depends on: T-009 (done)

Read for that: Piano 09, Spec 001 (requirement 1), Spec 003 (Pedals), T-039 (Results: the damped law, no measurable damper delay), T-035 and T-050 (the velocity path the soft pedal would use), T-044 (the dock’s pedal slots), Piano notes (Engine, Parameters).

Why: the backlog row “coupled hammer, pedals, sympathetic resonance, noises, phantom partials; differentiable refinement and MAESTRO validation” is the whole of milestones M4 and M5 (Roadmap). That is far more than one task: it spans Julia and Rust, a new model format, and data questions that are still open. Some of it can be built on today’s measured modal model (format v4) and some cannot. The coupled hammer, una corda as a real string count, the String scope of the inspector and phantom partials all need physical strings: strike position, a string count per key, unison detune and hammer parameters. Format v4 has none of these; its string axis holds three fitted components (Piano model file). D0 splits the row. The rest of this page is the first piece, the pedals. Spec 001 requires them (requirement 1), and the editor shows two of them as unsupported today.

What

  1. The split (D0): T-010 becomes the pedals; the other parts of the row become tasks of their own (T-056–T-061, Piano), each to get its own page when it is chosen.
  2. Continuous sustain (D1): CC64 as a pedal travel 0…1, not on/off at 64; a half-pedal zone in which the dampers damp partly.
  3. Damper motion (D2): what happens between “on the string” and “off the string” in time.
  4. Sostenuto (D3): CC66 holds up the dampers that are up when it goes down.
  5. Soft pedal (D4): CC67 on the measured model.
  6. Engine and plugin (D5): pedal events, the damping blend per key, the engine’s report to the editor; CC121 (reset all controllers) releases all pedals.
  7. Editor (D6): the dock’s Sostenuto and Soft slots show Up/Down; Sustain shows its travel.

Out of scope: pedal and damper noises (D0, the noises task), sympathetic resonance (D0), una corda through a string count, half-pedalling that damps high partials more than low ones (T-039 measured damped rates that do not depend on frequency, ; no data to fit a dependence), pedals as CLAP parameters or automation (they come in as MIDI CCs like today’s sustain).

Decisions (accepted by the maintainer, 2026-12-06)

QuestionOptionsProposal
D0How to split the row(a) **T-010 = pedals (this page); new tasks, numbered from T-056 when this page is accepted: Sympathetic resonance (the engine’s bridge sum drives the low partials of undamped keys, as Piano 09/13 plan; on the measured model, with a coupling derived from the fitted prompt decay rates and an amount parameter; after T-010); Mechanical noises (Salamander’s rel1–88 release noises and pedalD/U pedal noises, key bottom, hammer knock; it must first decide how noise reaches the plugin, because ADR-0007 keeps recordings out of the repository: a parametric noise model fitted to them, or a download); Physical strings (Julia: model = "physical", string count per key, polarisations, unison detune, strike position, hammer , , , fitted to the velocity layers; format v5; brings una corda and the String scope; may need splitting again when its page is written); Coupled hammer (Rust: the nonlinear hammer–string coupling during contact on that model, Piano 05); Phantom partials (bass longitudinal resonators, Piano 08; after the coupled hammer); Fit and validate (M5: differentiable refinement of the physical model, MAESTRO validation, with T-022)*; (b) keep T-010 as one task and do it all in order; (c) split as (a) but start with physical strings(a): each piece is a task of normal size, and a dependency order falls out of it (pedals → sympathetic resonance and noises on today’s model; physical strings → coupled hammer → phantom partials → M5). Pedals come first: they are small, the Spec requires them, and sympathetic resonance needs them. (b) would be one task lasting weeks with several open decisions; (c) postpones everything audible behind the largest piece
D1Sustain: what CC64 means(a) travel with a half-pedal zone: below the dampers rest fully on the strings, above they are lifted, and in between a key’s damping weight falls linearly from 1 to 0. Defaults , (MIDI 45 and 83), as two parameters in Resonance & noises. Each partial’s rate is , with the same for all partials of a key; (b) on/off at 64 as today, with hysteresis; (c) as (a), with the zone fitted from MAESTRO’s continuous pedal data (CC BY-NC-SA: then the default model would be NC-derived, ADR-0007)(a): Spec 001 asks for continuous sustain and half-pedalling. A controller that sends only 0 and 127 behaves exactly as today. The zone is a placeholder, not fitted: no recording we may ship from shows half-pedalling. It is marked like T-039’s former [damper] placeholder, and its numbers are for listening to check
D2Damper motion in time(a) no extra ramp: a key’s weight follows the pedal travel (smoothed over one block, so a jump from 0 to 127 moves within one block) and the key (instant at key-up, as now); (b) a landing ramp of a fixed time (tens of ms, Piano 09) on every damper fall(a): T-039 fitted the damped rates from the decay after the dampers landed and found the damper delay not measurable, so a ramp would be a guess on top of a fit. Where the controller sends intermediate values, the pedal’s travel already is a ramp
D3Sostenuto(a) on CC66 going down (≥ 64), catch every key whose damper is up through its own key at that moment; a caught key stays undamped until CC66 goes up. Keys pressed later are not caught. Keys held up only by the sustain pedal are not caught; (b) as (a) but also catch the dampers that the sustain pedal holds up, as the sostenuto rod of many real grands does when both pedals are down(a): it is what players expect from the middle pedal and what most instruments and hosts assume. (b) is the more literal mechanism, but in common pedalling (sustain down, then sostenuto) it freezes every ringing key. It can be a later option
D4Soft pedal on the measured model(a) at a strike, a soft pedal at lowers the shaped velocity so that the strike’s level falls by dB, with = Soft pedal depth (parameter, default 3 dB, range 0–12). The level comes from the model’s level-over-velocity curve (T-050), so the strike also gets the duller timbre of a softer strike (T-035’s tilt, the measured layers). Ringing notes are unchanged: the pedal moves the action, which only matters at the next strike; (b) show Soft as unsupported until physical strings exist; (c) as (a), plus moving energy towards the slow components (the unstruck string of a real una corda)(a): it is cheap and audible, and it uses only measured relations (level and timbre over velocity). The physical-strings task replaces it with a real una corda. The depth is a placeholder like D1’s zone. (c) would invent a balance that no data supports yet
D5Engine shape(a) Event::Sustain(f32) (travel), Event::Sostenuto(bool), Event::Soft(f32); per key a damping weight computed once per block from key, sustain travel and sostenuto catch, and the key’s delta coefficients blended between its free and damped values for that block (one multiply-add per partial per block; the free and damped sets already exist in CoeffSet). With the output is bit-identical to today’s. PianoEngine reports the sustain travel, the sostenuto state and the soft value for the editor; (b) recompute the coefficients through the worker when the pedal moves(a): the pedal is a performance control and must act within the block, as Piano 13’s table says (“smoothed, per sample: pedal and damper positions”). Blending the delta coefficients is exact at and and first-order exact in between, since . The worker’s ~10 ms would be audible latency
D6Editor(a) the dock’s three slots: Sustain shows Up, Down or Half plus the travel in percent when it is between 1 % and 99 %; Sostenuto and Soft show Up/Down from the engine’s state (Soft shows Half when 0 < s < 1). The slot width rule of T-046 stays (widest word per slot). The two half-pedal parameters and Soft pedal depth appear in Resonance & noises without GUI code (T-025); (b) Up/Down only(a): Spec 003 asks for a partial value where the engine supports travel, and D1 and D4 add travel

Done when

  • The gates of AGENTS.md pass, including bundle, clap-validator and the GUI smoke test.
  • Tests (written first):
    • Engine: CC64 at 0 and 127 bit-identical to today’s on/off sustain; at a value inside the zone, a held-then-released key decays between its free and damped rates (rate measured from the output within 5 % of the blend); a pedal jump settles within one block; top keys without dampers are unaffected.
    • Sostenuto: a key held when CC66 goes down rings after its key-up until CC66 goes up, then damps; a key pressed after CC66 went down damps at its key-up; sustain plus sostenuto behave as D3 says; CC121 releases all three pedals.
    • Soft: a strike with CC67 = 127 is dB quieter (within 0.5 dB, at three velocities and three keys) and its spectral tilt matches the softer strike’s; a note already ringing when CC67 moves is sample-identical to one without the pedal.
    • Parameters: new ids appended, defaults as D1/D4, old projects and presets load unchanged; the default sound with pedals up is unchanged (golden test).
    • Real time: no_alloc with all three pedals moving while notes sound.
    • egui frames: the three slots show Up / Down / Half with travel; the slots do not move when states change (T-046’s rule).
  • Smoke test captures of the dock with sustain half down and sostenuto and soft down.
  • A listening render (data/t010/): a pedalled passage with half-pedalling, a sostenuto passage, a phrase with and without the soft pedal.
  • The new tasks of D0 are in the backlog and on the piano page, with this page’s row rewritten; Spec 003 Pedals, Piano 09 and Piano 13 (Stages) updated.

Outcome

  • Split (D0): T-056 Sympathetic resonance, T-057 Mechanical noises, T-058 Physical strings, T-059 Coupled hammer, T-060 Phantom partials, T-061 Fit and validate (M5), as rows on Piano and in the Backlog; no pages yet.
  • Events (crates/dsp/src/lib.rs): Event::Sustain(f32) (travel 0…1; was bool), Event::Sostenuto(bool), Event::Soft(f32). NaN counts as up, values are clamped. The demos’ MIDI reader maps CC 64/66/67 like the plugin and lets all three go at the end of a piece.
  • Damping (D1, D2, D5): PedalSettings (half-pedal start and end, soft depth) and PedalSettings::rest(travel); per key KeyState::damping(has_damper, rest) = 0 for a key without a damper, a held key or a caught key, else what the sustain leaves (1 below the zone, linear in it, 0 above; a zone given in reverse counts from its lower end). Per chunk (≤ 512 samples) a key runs on Decay::Free, Decay::Damped or Decay::Blended; the blend is written into ModeState::br/bi for that span (exact at both ends, so 0 and 127 are bit-identical to the old on/off). A pedal jump therefore acts from the next chunk; a block split at the event applies it at the event.
  • Sostenuto (D3): KeyState::caught, set to held when CC 66 goes down (a repeated down catches nothing new), cleared when it goes up; kept across the activity check and a choke; AllNotesOff (CC 120/123) resets all three pedals, CC 121 sets them up.
  • Soft pedal (D4): CoeffSet holds a strike-level table per key, at 4 velocities below the first layer, at each layer and at the midpoint between two (11 points on the shipped model; within 0.05 dB of the exact level there, 0.33 dB without the midpoints). CoeffSet::softer walks it down to the velocity that is soft · depth dB quieter; the strike then uses that velocity for the excitation and the contact time, so its tilt is the softer strike’s. The table adds ~2–5 ms to a debug rebuild (with it ~4–8 ms; the worker test’s budget is 20 ms). Measured on the shipped model: −2.7 … −3.1 dB at keys 33/60/84 and velocities 30/70/110 with the default 3 dB, −1.5 dB at half travel; above the last layer (124) the level is flat, so a strike there drops to about velocity 84 (from 100–124) for 3 dB.
  • Plugin (D5, D6): CC 64 and 67 as travel value/127, CC 66 down at ≥ 64, CC 121 releases the three; parameters Half-pedal start (id 14, %, default 35), Half-pedal end (15, %, 65), Soft pedal depth (16, dB, 0–12, default 3), group Resonance & noises, applied to the engine at the start of each block and on each automation event. EngineView publishes the pedals in whole percent (PedalView); the dock shows Up, Down or Half n % for Sustain and Soft and Up/Down for Sostenuto, the mark filling from the bottom with the travel; each slot is as wide as its widest word.
  • Deviation (D6, layout): the group Resonance & noises is on the Edit tab under Microtuning (and on Play in the wide class, like Microtuning), not on Play: on Play it pushed the output meters out of the default 720 × 400 view (a test guards it), and these are set-up values, not played ones. Microtuning’s Scala choosers stay directly under its MTS-ESP row on both tabs; the new group follows them.
  • Tests: engine (engine/tests/pedals.rs: the ends of the travel bit-identical to held and damped; the blended rate within 5 % at three travels; a jump settles within a chunk; keys without dampers; sostenuto catches only held keys, not later or pedalled ones, survives a choke; clamping and NaN; soft strike sample-identical to a strike at the table’s velocity and 3 dB down rendered; depth and amount scale it; ringing notes untouched; no allocation with all pedals moving; the table within 0.1 dB on the model), resonator (blend exact at its ends; SIMD = scalar with blended spans), dsp integration (soft drop on the model, 3 keys × 3 velocities), view (percent), egui (slot states; slots stay put through Up, Down, Half), host (parameter metadata; half pedal between up and down and following its parameters; sostenuto holds and CC 121 releases; soft depth 3 and 9 dB), no_alloc (CC 64/66/67/121 and the three parameters while notes sound), demos (reader and arrange). Gates: fmt, clippy, nextest (265), cargo test -p instruments-piano, bundle, clap-validator (38 passed, 0 failed), GUI smoke test (GUI_SMOKE_PEDALS=half plays the chord with sustain at 64 and sostenuto and soft down). Julia untouched.
  • Demo renders are unchanged: every demo MIDI file sends CC 64 only as 0 or 127, which plays bit-identically; none sends CC 66 or 67. No refresh, no line in demos/CHANGES.md.
  • Listening: data/t010/half_pedal_down_half_up.wav (one phrase with the pedal down, at 64, and up), sostenuto_bass_held_under_staccato.wav (C2+C3 caught, a staccato melody above), soft_pedal_without_then_with.wav; not yet heard by the maintainer. At 64 the default zone leaves a damping weight of 0.49: released keys decay at about the mean of their free and damped rates.