Files
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

86 lines
3.9 KiB
Swift
Raw Permalink 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.
// CaliHiGainAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// California **Mark-series high-gain** — the cascaded lead voice defined by its onboard **5-band
/// graphic EQ**: the sliders sculpt the famous scooped "V" lead tone on top of the amp's own gain.
///
/// A ``BoutiqueAmpPedal`` (Clean/Lead channel, Master, Presence, Depth) that adds a graphic-EQ bank
/// in ``shapeVoice(_:)`` — a low shelf, three peaks, and a high shelf, each a dB fader — cascaded
/// after the base Presence/Depth shaping. Defaults to a gentle V.
public final class CaliHiGainAmpPedal: BoutiqueAmpPedal {
/// Graphic-EQ band gains in dB, range [-12, 12]. Defaults form a mild scooped "V" — the
/// Mark-series signature.
/// 80 Hz low-shelf gain in dB.
@UIParam public var eq80: Double = 2.0
/// 240 Hz peaking gain in dB.
@UIParam public var eq240: Double = 0.0
/// 750 Hz peaking gain in dB (the mid-scoop band).
@UIParam public var eq750: Double = -5.0
/// 2.2 kHz peaking gain in dB.
@UIParam public var eq2200: Double = 0.0
/// 6.6 kHz high-shelf gain in dB.
@UIParam public var eq6600: Double = 3.0
private let eq80Freq: Double = 80.0
private let eq240Freq: Double = 240.0
private let eq750Freq: Double = 750.0
private let eq2200Freq: Double = 2200.0
private let eq6600Freq: Double = 6600.0
/// Shelf slope for the outer graphic-EQ bands.
private let eqShelfSlope: Double = 1.0
/// Peaking-band Q — moderate bandwidth so adjacent graphic-EQ bands overlap smoothly.
private let eqPeakQ: Double = 0.9
private let bandGainRange: ClosedRange<Double> = -12.0 ... 12.0
public override var toneStackModel: ToneStackModel { .mesa }
public override var summaryText: String {
"California Mark-series high gain with an onboard 5-band graphic EQ (scooped-V lead)."
}
/// The five graphic-EQ bands as vertical faders (dB), rendered as a slider bank.
public override var effectSliders: [PedalSlider] {
[
PedalSlider(label: "80", node: $eq80, range: bandGainRange),
PedalSlider(label: "240", node: $eq240, range: bandGainRange),
PedalSlider(label: "750", node: $eq750, range: bandGainRange),
PedalSlider(label: "2.2k", node: $eq2200, range: bandGainRange),
PedalSlider(label: "6.6k", node: $eq6600, range: bandGainRange),
]
}
/// Creates a Cali Hi-Gain 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: "Cali Hi-Gain", inputBus: inputBus, outputBus: outputBus)
gain = 6.27
drive = 9.15 // hot Mark-style lead
cab = 1.0 // British 4×12 — tight and aggressive
}
/// Base Presence/Depth shaping, then the 5-band graphic EQ (low shelf → 3 peaks → high shelf),
/// each band's gain in dB from its fader.
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let shaped: any ValidGeneratorInput = super.shapeVoice(signal)
let low: RBJLowShelf.Audio = RBJLowShelf.Audio(
input: shaped, freq: eq80Freq, gain: $eq80, slope: eqShelfSlope)
let lowMid: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio(
input: low, freq: eq240Freq, gain: $eq240, q: eqPeakQ)
let mid: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio(
input: lowMid, freq: eq750Freq, gain: $eq750, q: eqPeakQ)
let highMid: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio(
input: mid, freq: eq2200Freq, gain: $eq2200, q: eqPeakQ)
return RBJHighShelf.Audio(
input: highMid, freq: eq6600Freq, gain: $eq6600, slope: eqShelfSlope)
}
}