// SpectralGateTests.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT import Testing import Foundation @testable @_spi(LyrebirdExtensions) import LyrebirdSynth @Suite("SpectralGate") struct SpectralGateTests { private static func fillRamp(_ buf: SpectralBuffer) { // mag k = k * 0.1, phase k = 0.7 buf.dcValue = 0.05 buf.nyquistValue = -0.3 let halfSize: Int = buf.fftSize / 2 for k: Int in 1.. 0.1, passes through with sign. } @Test func phaseUntouched() { let fftSize: Int = 32 let buf: SpectralBuffer = SpectralBuffer(fftSize: fftSize) Self.fillRamp(buf) let g: SpectralGate = SpectralGate(fftSize: fftSize, threshold: 0.5, floor: 0) g.process(spectral: buf, engine: makeTestEngine()) let halfSize: Int = fftSize / 2 for k: Int in 1..