# Guitar model 01 — fixed musical passage, new physical string source

**New and unapproved. This is guitar, not sax.** The user says the current
instrument is not close enough. This experiment changes the string source
instead of rewriting the melody again. Nothing in Music II, Ruth, the alto
models or existing Giant Steps recordings is replaced.

## Controlled musical comparison

The score and phrasing files are byte-identical to
`../giant-coltrane-guitar-01/`. The same 195 solo notes, 57 picked voices,
52 connected gestures, note gates, velocities and tempo are retained.
Both solo choruses use the new source. The original opening, return and ending
guitar PCM remain exactly unchanged. Backing WAV is byte-identical.

The explicit slur pitch paths are unchanged. The old sustained-string voice's
unscored pitch settling and automatic vibrato are not copied into this new
source; do not claim sample-identical microintonation or performer controls.

The existing Music II main-riff amp, cabinet, pre/post EQ, room and 290 ms echo
are retained. This **changes the string generator**, and therefore is not
another claim of exact main-riff source parity. There are no recorded samples,
paid APIs, new master compressor/limiter, added piano or sax.

One constant gain matches the solo's integrated LUFS to the previous guitar.
If necessary, a further constant headroom reduction is recorded, not hidden.
The older head and backing are never scaled. Twelve-millisecond transition
fades stay inside the replaced solo span. The held-note set has its own shared
matching gain and shared peak safety gain; individual notes are not normalized.

## String mechanics

`string_model.mjs` starts from an ideal distributed pluck, not noise. Its
triangular static displacement is projected onto stiff-string modes. Finite
contact width smooths the modal coefficients. Modal mass follows effective
linear density and speaking length; stiffness follows steel-core bending
rigidity, tension and length. The fundamental is constrained to the requested
frequency while higher modes retain their stiffness-dependent spacing.

Each coordinate satisfies

```text
coordinate'' + 2 * loss * coordinate' + angular_frequency^2 * coordinate
    = held_force / modal_mass
```

The initial holding force balances the pluck. A 1.5 ms cosine release removes
that force; exact constant-force damped transitions use its midpoint value at
each 44.1 kHz step. A finite-width linear pickup reads modal velocity. Damping
contains a 2.8-second fundamental T60 and wavelength-dependent internal loss.
The final 24 ms raises damping rather than multiplying an output fade onto
the dry string. The existing room/echo still have their own tails.

Existing slur pitch paths adjust the modal frequencies while retaining
coordinates and velocities. This keeps state across those gestures, but
does not constitute a complete moving-boundary/finger-impact model.

This is a reduced physical instrument model. Its designed dimensions,
effective winding/core assumptions, damping and pickup scale are provisional,
not measurements from a named real guitar. A shared bridge/body and sympathetic
strings are absent. Prescribed fretting and mute changes can do work that is
not separately audited. Parameter detail alone does not prove better sound.

Background acoustic/synthesis reference: Julius O. Smith,
[Electric Guitars, Physical Audio Signal Processing](https://dsprelated.com/freebooks/pasp/Electric_Guitars.html).
The implemented modal source is not presented as a recovered commercial model
or a verbatim implementation from that book.

## Files and checks

- `baseline-solo-band` / `solo-band`: same 38.4-second passage with backing.
- `baseline-solo-guitar` / `solo-guitar`: same passage without backing.
- `probe-old` / `probe-new`: G3, E4, F-sharp4, C5 and G5 through the same amp.
- `mix` / `guitar`: complete piece/stem, with the old theme PCM retained.
- All public listening files have 24-bit WAV and 192 kbps MP3 versions.
- `model-report.json`: geometry, controls, source hashes and five energy traces.
- `report.json`: unconstrained pitch estimates, actual gains, headroom,
  PCM/byte preservation and source hashes.

Free-decay energy must decrease after release at all five diagnostic pitches.
Pitch is estimated from broad 70–1800 Hz autocorrelation without a
target-centered search window. It must remain within 20 cents for these
five dry held notes. Those checks do not validate the whole instrument range,
every fast slur, human technique, timbral similarity or listening preference.

## Reproduce locally

```sh
node render.mjs
python3 compare.py
```

Run from this directory. Requirements: Node.js; Python with NumPy, SciPy and
SoundFile; ffmpeg; neighboring unchanged baseline score/stems; the existing
`../../instruments/music2/` DSP modules. Outputs stay in this new directory.
Raw intermediate and dry diagnostic WAVs need not be deployed.
