Files
ShoeGaze/Sources/LyrebirdShoeGaze/Pedals/BoutiqueODAmpPedal.swift
T
josh f9ddd6b160 feat(amp): Gain/Drive become a 1–11 dial with a musical taper
Every amp's Gain (and the boutique/drive-channel Drive) is now a 1–11 dial —
yes, it goes to eleven — instead of the raw 1–30 tube-drive number.

- New AmpVoicePedal.taperedDrive(_:) maps the 1–11 dial to the 1–30 tube drive
  through an exponential LinExp taper, so 1 is nearly clean, 11 is full
  saturation, and the useful grind spreads across the dial (fine at the bottom,
  steep at the top) rather than bunching near the low end.
- Wired into the base preampStage and every override that feeds a drive:
  Boutique / Fullerton Drive / Jazz Clean / British Dual (Drive channel),
  Anaheim (SS preamp), British Master (cascaded stage).
- gainRange / driveRange → 1...11; every amp's default gain/drive reconverted
  from drive-space to the equivalent dial value (dial = 1 + 10·ln(drive)/ln(30)),
  so each amp's shipped voicing is preserved.
- No preset migration (nothing shipped — per product owner); all knob work
  stays within ShoeGaze (no core Lyrebird change).
- Tests updated to the 1–11 scale; added range + exponential-taper assertions.

671 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-04 10:42:35 -07:00

63 lines
2.5 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// BoutiqueODAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// Boutique **overdrive special** — the smooth D-style voice: a Fender-derived clean plus a fluid
/// overdrive channel, a **Mid Boost** switch, a Master volume, and Presence / Depth shaping.
///
/// A ``BoutiqueAmpPedal`` on the smoother American tone stack. The Mid Boost adds a midrange peak
/// (the D-style "PAB" character) on top of the base Presence/Depth shaping.
public final class BoutiqueODAmpPedal: BoutiqueAmpPedal {
/// Mid Boost switch: `0` = flat, `1` = midrange peak engaged.
@UIParam public var midBoost: Double = 0.0
private let midBoostFreqHz: Double = 650.0
private let midBoostMaxGainDb: Double = 6.0
private let midBoostQ: Double = 1.0
public override var toneStackModel: ToneStackModel { .fender }
public override var summaryText: String {
"Boutique overdrive special — smooth D-style OD with a Mid Boost, Master, Presence, and Depth."
}
/// Base Channel switch plus the Mid Boost switch (compose `super`).
public override var effectSwitches: [PedalSwitch] {
super.effectSwitches + [
PedalSwitch(
label: "Mid Boost",
node: $midBoost,
options: [
PedalSwitch.Option(title: "Off", value: switchOffValue),
PedalSwitch.Option(title: "On", value: switchOnValue),
]
),
]
}
/// Creates a Boutique OD amp.
///
/// - Parameters:
/// - inputBus: Audio bus index to read the dry input from. Defaults to `0`.
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Boutique OD", inputBus: inputBus, outputBus: outputBus)
gain = 5.73
drive = 7.77
cab = 0.0 // American 1×12
}
/// The base Presence/Depth shaping, plus a Mid Boost peak when the switch is engaged (its gain
/// scales by the switch value, so Off is a true identity, live, no rebuild).
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let shaped: any ValidGeneratorInput = super.shapeVoice(signal)
let midGainDb: any ValidGeneratorInput = $midBoost * midBoostMaxGainDb
return RBJPeakingEQ.Audio(input: shaped, freq: midBoostFreqHz, gain: midGainDb, q: midBoostQ)
}
}