Add Plate, Room, and Spring reverb pedals
Wrap three Lyrebird 1.2.0 reverb algorithms as pedals, mirroring ReverbPedal (run the generator pure-wet, let the base Pedal mix blend): - Plate Reverb — PlateReverb.Audio (Dattorro plate), stereo folded to mono. Knobs: Decay, Tone, Damp, Mod. - Room Reverb — GVerb.Audio (FDN room/hall), stereo folded to mono. Knobs: Size (m), Decay (T60 s), Damp, Tail. - Spring Reverb — SpringReverb.Audio in mono (stereo:false, no fold). Knobs: Decay, Tension, Damp. Each registered across the six touchpoints (type, registry, category .reverb, palette order, enclosure colour) with a test suite (build+render, param changes output, knob labels, preset round-trip, registry membership). 339 tests pass; both app targets build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
// PlateReverbPedalTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
import Foundation
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
@testable import LyrebirdShoeGaze
|
||||
|
||||
@MainActor
|
||||
@Suite("PlateReverbPedal")
|
||||
struct PlateReverbPedalTests {
|
||||
|
||||
private func render(configure: (PlateReverbPedal) -> Void) throws -> [Float] {
|
||||
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.2, numAudioBuses: 64)
|
||||
defer { try? FileManager.default.removeItem(at: url) }
|
||||
|
||||
let srcBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
|
||||
let dstBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
|
||||
defer {
|
||||
engine.busAllocator.releaseAudioBus(srcBus)
|
||||
engine.busAllocator.releaseAudioBus(dstBus)
|
||||
}
|
||||
|
||||
let source: TestLoopSource = TestLoopSource(targetBus: srcBus.index)
|
||||
let pedal: PlateReverbPedal = PlateReverbPedal(inputBus: srcBus.index, outputBus: dstBus.index)
|
||||
configure(pedal)
|
||||
let master: TestRouteMaster = TestRouteMaster(inputBusIndex: dstBus.index)
|
||||
|
||||
try engine.add(source)
|
||||
try engine.add(pedal, position: NodePosition.after(source))
|
||||
try engine.add(master, position: NodePosition.after(pedal))
|
||||
try engine.start()
|
||||
|
||||
return readStereoCAF(url: url)
|
||||
}
|
||||
|
||||
private func totalSSD(_ a: [Float], _ b: [Float]) -> Double {
|
||||
zip(a, b).reduce(0.0) { acc, pair in
|
||||
let diff: Double = Double(pair.0 - pair.1)
|
||||
return acc + diff * diff
|
||||
}
|
||||
}
|
||||
|
||||
@Test func buildsAndProducesNonSilentOutput() throws {
|
||||
let samples: [Float] = try render { _ in }
|
||||
#expect(!samples.isEmpty)
|
||||
#expect(hasNonSilentOutput(samples), "plate reverb output was silent")
|
||||
}
|
||||
|
||||
@Test func toneChangesOutput() throws {
|
||||
// `tone` (input bandwidth) alters the signal immediately, unlike `decay` whose effect lives
|
||||
// in the recirculating tail beyond this short render window.
|
||||
let dark: [Float] = try render { pedal in pedal.tone = 0.1; pedal.mix = 1.0 }
|
||||
let bright: [Float] = try render { pedal in pedal.tone = 1.0; pedal.mix = 1.0 }
|
||||
#expect(hasNonSilentOutput(bright), "bright plate was silent")
|
||||
#expect(totalSSD(dark, bright) > 0, "changing tone did not change the output")
|
||||
}
|
||||
|
||||
@Test func exposesDecayToneDampModKnobs() throws {
|
||||
let pedal: PlateReverbPedal = PlateReverbPedal()
|
||||
#expect(pedal.effectKnobs.map { $0.label } == ["Decay", "Tone", "Damp", "Mod"])
|
||||
}
|
||||
|
||||
@Test func presetRoundTripPreservesKnobs() throws {
|
||||
let pedal: PlateReverbPedal = PlateReverbPedal()
|
||||
pedal.decay = 0.5
|
||||
pedal.mod = 0.25
|
||||
let state: PedalState = pedal.captureState()
|
||||
|
||||
let restored: PlateReverbPedal = PlateReverbPedal()
|
||||
restored.applyState(state)
|
||||
#expect(restored.decay == 0.5)
|
||||
#expect(restored.mod == 0.25)
|
||||
}
|
||||
|
||||
@Test func registeredInBuiltInRegistry() throws {
|
||||
#expect(PedalRegistry.makePedal(type: "Plate Reverb") is PlateReverbPedal)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// RoomReverbPedalTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
import Foundation
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
@testable import LyrebirdShoeGaze
|
||||
|
||||
@MainActor
|
||||
@Suite("RoomReverbPedal")
|
||||
struct RoomReverbPedalTests {
|
||||
|
||||
private func render(configure: (RoomReverbPedal) -> Void) throws -> [Float] {
|
||||
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.2, numAudioBuses: 64)
|
||||
defer { try? FileManager.default.removeItem(at: url) }
|
||||
|
||||
let srcBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
|
||||
let dstBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
|
||||
defer {
|
||||
engine.busAllocator.releaseAudioBus(srcBus)
|
||||
engine.busAllocator.releaseAudioBus(dstBus)
|
||||
}
|
||||
|
||||
let source: TestLoopSource = TestLoopSource(targetBus: srcBus.index)
|
||||
let pedal: RoomReverbPedal = RoomReverbPedal(inputBus: srcBus.index, outputBus: dstBus.index)
|
||||
configure(pedal)
|
||||
let master: TestRouteMaster = TestRouteMaster(inputBusIndex: dstBus.index)
|
||||
|
||||
try engine.add(source)
|
||||
try engine.add(pedal, position: NodePosition.after(source))
|
||||
try engine.add(master, position: NodePosition.after(pedal))
|
||||
try engine.start()
|
||||
|
||||
return readStereoCAF(url: url)
|
||||
}
|
||||
|
||||
private func totalSSD(_ a: [Float], _ b: [Float]) -> Double {
|
||||
zip(a, b).reduce(0.0) { acc, pair in
|
||||
let diff: Double = Double(pair.0 - pair.1)
|
||||
return acc + diff * diff
|
||||
}
|
||||
}
|
||||
|
||||
@Test func buildsAndProducesNonSilentOutput() throws {
|
||||
let samples: [Float] = try render { _ in }
|
||||
#expect(!samples.isEmpty)
|
||||
#expect(hasNonSilentOutput(samples), "room reverb output was silent")
|
||||
}
|
||||
|
||||
@Test func sizeChangesOutput() throws {
|
||||
let small: [Float] = try render { pedal in pedal.size = 5.0; pedal.mix = 1.0 }
|
||||
let large: [Float] = try render { pedal in pedal.size = 90.0; pedal.mix = 1.0 }
|
||||
#expect(hasNonSilentOutput(large), "large-room reverb was silent")
|
||||
#expect(totalSSD(small, large) > 0, "changing size did not change the output")
|
||||
}
|
||||
|
||||
@Test func exposesSizeDecayDampTailKnobs() throws {
|
||||
let pedal: RoomReverbPedal = RoomReverbPedal()
|
||||
#expect(pedal.effectKnobs.map { $0.label } == ["Size", "Decay", "Damp", "Tail"])
|
||||
}
|
||||
|
||||
@Test func presetRoundTripPreservesKnobs() throws {
|
||||
let pedal: RoomReverbPedal = RoomReverbPedal()
|
||||
pedal.size = 50.0
|
||||
pedal.decay = 6.0
|
||||
let state: PedalState = pedal.captureState()
|
||||
|
||||
let restored: RoomReverbPedal = RoomReverbPedal()
|
||||
restored.applyState(state)
|
||||
#expect(restored.size == 50.0)
|
||||
#expect(restored.decay == 6.0)
|
||||
}
|
||||
|
||||
@Test func registeredInBuiltInRegistry() throws {
|
||||
#expect(PedalRegistry.makePedal(type: "Room Reverb") is RoomReverbPedal)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// SpringReverbPedalTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
import Foundation
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
@testable import LyrebirdShoeGaze
|
||||
|
||||
@MainActor
|
||||
@Suite("SpringReverbPedal")
|
||||
struct SpringReverbPedalTests {
|
||||
|
||||
private func render(configure: (SpringReverbPedal) -> Void) throws -> [Float] {
|
||||
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.2, numAudioBuses: 64)
|
||||
defer { try? FileManager.default.removeItem(at: url) }
|
||||
|
||||
let srcBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
|
||||
let dstBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
|
||||
defer {
|
||||
engine.busAllocator.releaseAudioBus(srcBus)
|
||||
engine.busAllocator.releaseAudioBus(dstBus)
|
||||
}
|
||||
|
||||
let source: TestLoopSource = TestLoopSource(targetBus: srcBus.index)
|
||||
let pedal: SpringReverbPedal = SpringReverbPedal(inputBus: srcBus.index, outputBus: dstBus.index)
|
||||
configure(pedal)
|
||||
let master: TestRouteMaster = TestRouteMaster(inputBusIndex: dstBus.index)
|
||||
|
||||
try engine.add(source)
|
||||
try engine.add(pedal, position: NodePosition.after(source))
|
||||
try engine.add(master, position: NodePosition.after(pedal))
|
||||
try engine.start()
|
||||
|
||||
return readStereoCAF(url: url)
|
||||
}
|
||||
|
||||
private func totalSSD(_ a: [Float], _ b: [Float]) -> Double {
|
||||
zip(a, b).reduce(0.0) { acc, pair in
|
||||
let diff: Double = Double(pair.0 - pair.1)
|
||||
return acc + diff * diff
|
||||
}
|
||||
}
|
||||
|
||||
@Test func buildsAndProducesNonSilentOutput() throws {
|
||||
let samples: [Float] = try render { _ in }
|
||||
#expect(!samples.isEmpty)
|
||||
#expect(hasNonSilentOutput(samples), "spring reverb output was silent")
|
||||
}
|
||||
|
||||
@Test func tensionChangesOutput() throws {
|
||||
let low: [Float] = try render { pedal in pedal.tension = 0.1; pedal.mix = 1.0 }
|
||||
let high: [Float] = try render { pedal in pedal.tension = 0.9; pedal.mix = 1.0 }
|
||||
#expect(hasNonSilentOutput(high), "high-tension spring was silent")
|
||||
#expect(totalSSD(low, high) > 0, "changing tension did not change the output")
|
||||
}
|
||||
|
||||
@Test func exposesDecayTensionDampKnobs() throws {
|
||||
let pedal: SpringReverbPedal = SpringReverbPedal()
|
||||
#expect(pedal.effectKnobs.map { $0.label } == ["Decay", "Tension", "Damp"])
|
||||
}
|
||||
|
||||
@Test func presetRoundTripPreservesKnobs() throws {
|
||||
let pedal: SpringReverbPedal = SpringReverbPedal()
|
||||
pedal.decay = 3.0
|
||||
pedal.tension = 0.2
|
||||
let state: PedalState = pedal.captureState()
|
||||
|
||||
let restored: SpringReverbPedal = SpringReverbPedal()
|
||||
restored.applyState(state)
|
||||
#expect(restored.decay == 3.0)
|
||||
#expect(restored.tension == 0.2)
|
||||
}
|
||||
|
||||
@Test func registeredInBuiltInRegistry() throws {
|
||||
#expect(PedalRegistry.makePedal(type: "Spring Reverb") is SpringReverbPedal)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user