v1.7.0 release: amp-modeling core (ToneStack, TriodeStage, LSTMAmp)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -447,6 +447,20 @@ MuTronIII.Control(input: guitar, sensitivity: 1.0, peak: 3.0)
|
||||
- `attackTime` / `releaseTime`: Envelope time constants in seconds.
|
||||
- Companion types: `MuTronIIIMode`, `MuTronIIISweep`.
|
||||
|
||||
#### ToneStack
|
||||
Passive guitar-amplifier tone stack (bass / mid / treble) — the interactive Fender / Marshall / Vox EQ network, not three independent bands, so the controls load each other exactly as on the real amp. The selected model's continuous-time transfer function (Yeh & Smith closed form) is bilinear-discretized to a 3rd-order IIR; coefficients recompute only when a control changes. Audio-only, mono output.
|
||||
|
||||
```swift
|
||||
ToneStack(input: sig, bass: 0.6, mid: 0.4, treble: 0.7) // Fender (default)
|
||||
ToneStack(input: sig, bass: 0.5, mid: 0.7, treble: 0.5, model: .marshall)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `input`: Signal to filter.
|
||||
- `bass` / `mid` / `treble`: Controls in `[0, 1]` (clamped). Bass uses an exponential taper; mid/treble are linear. Default `0.5`.
|
||||
- `model`: `ToneStackModel` — `.fender` / `.marshall` / `.vox` (component values). Set at init. Default `.fender`.
|
||||
- Companion type: `ToneStackModel`.
|
||||
|
||||
---
|
||||
|
||||
### Envelopes
|
||||
@@ -2575,8 +2589,18 @@ Transfer-function and stochastic distortion generators. Source files live in
|
||||
| `Waveshaper` | `Shaper` | yes | yes | Table-lookup transfer-function waveshaper. Input clamped to `[-1, 1]` before linear-interpolated table lookup. RT-safe live table swap via `setTable(_:engine:)`. |
|
||||
| `CrossoverDistortion` | `CrossoverDistortion` | yes | yes | Dead-zone / crossover distortion. Signals in `[-amp, amp]` are silenced; signals outside that range are shifted toward zero. Optional C¹ smooth knee. |
|
||||
| `Disintegrator` | `Disintegrator` | yes | — | Stochastic sample-dropping distortion. Each sample is independently disintegrated (replaced by `input × multiplier`) with probability `probability`. Audio-only. |
|
||||
| `TriodeStage` | — | yes | — | Tube-style preamp stage: biased asymmetric `tanh` soft-clip (`drive` gain, `bias` grid offset → even harmonics), evaluated at 2×/4× oversampling, with an output coupling (DC-block) high-pass. Audio-only. |
|
||||
|
||||
`Waveshaper` and `CrossoverDistortion` conform to `GeneratorEnum`. `Disintegrator` is Audio-only and does not.
|
||||
`Waveshaper` and `CrossoverDistortion` conform to `GeneratorEnum`. `Disintegrator` and `TriodeStage` are Audio-only and do not.
|
||||
|
||||
### TriodeStage
|
||||
|
||||
A single tube preamp stage. A grid `bias` makes the `tanh` transfer asymmetric — generating even-order harmonics (single-ended tube warmth) and a program-dependent DC shift the output coupling removes. The nonlinearity is oversampled so its harmonics don't alias. A musically-voiced static waveshaper, not a SPICE circuit solve.
|
||||
|
||||
```swift
|
||||
TriodeStage(input: sig, drive: 3.0, bias: 0.3) // 4× oversampled (default)
|
||||
TriodeStage(input: sig, drive: 5.0, bias: 0.0, oversample: 2) // symmetric, 2×
|
||||
```
|
||||
|
||||
### Waveshaper (SC `Shaper`)
|
||||
|
||||
@@ -2636,3 +2660,28 @@ let det = Disintegrator.Audio(input: signal, probability: 0.5, seed: 42)
|
||||
- `mul` / `add`: applied after disintegration to all samples (including undisintegrated ones).
|
||||
|
||||
---
|
||||
|
||||
## Neural amp modeling
|
||||
|
||||
Real-time neural inference of guitar-amp/pedal captures. Source files live in
|
||||
`Sources/Lyrebird/Generators/Neural/`.
|
||||
|
||||
### LSTMAmp
|
||||
|
||||
Runs a single-layer LSTM amp capture one audio sample at a time — the GuitarML "Proteus" /
|
||||
NeuralPi topology (`LSTM(inputSize: 1, hiddenSize: H)` → `Linear(H, 1)`, optional input skip).
|
||||
Weights come from a `NeuralAmpModel` (a `Codable` weight container) and are copied into
|
||||
contiguous storage at init; the render path does only pre-allocated scalar math (no allocation
|
||||
or locks), costing `O(4·H²)` multiply-adds per sample, so keep `H` modest (Proteus captures are
|
||||
typically `H = 20…40`). Audio-only, mono. Does not clamp — a well-trained capture stays near
|
||||
`[-1, 1]`.
|
||||
|
||||
```swift
|
||||
let model = NeuralAmpModel(hiddenSize: 20, residual: true,
|
||||
weightIH: ih, weightHH: hh, biasIH: bih, biasHH: bhh,
|
||||
denseWeight: dw, denseBias: db)
|
||||
let amp = LSTMAmp(input: di, model: model)
|
||||
```
|
||||
|
||||
An importer for external NAM `.nam` / GuitarML Proteus JSON model files onto `NeuralAmpModel`
|
||||
is a planned follow-up (it maps those schemas onto the documented weight layout).
|
||||
|
||||
Reference in New Issue
Block a user