equaliser icon indicating copy to clipboard operation
equaliser copied to clipboard

fix(docs): REW import guide lists outdated frequency clamp limits

Open coygeek opened this issue 3 weeks ago • 0 comments

Summary

The REW import guide says imported frequencies are clamped to 20–20,000 Hz. The importer actually clamps to 1–22,000 Hz. This gives readers the wrong expectation about which frequencies are preserved and when an import warning appears.

Steps to reproduce

  1. Read the Frequency row under “Limit Ranges” in docs/user/REW-Import.md; it says 20 Hz–20,000 Hz, clamped to range.
  2. In either source baseline below, run REWImporter.importBands(from:) with a text file containing the following filter lines:
Filter 1: ON PK Fc 10 Hz Gain 3 dB Q 1.41
Filter 2: ON PK Fc 21000 Hz Gain 3 dB Q 1.41
  1. Inspect the returned band frequencies and warnings. Both frequencies are preserved and warnings is empty, contrary to the documented limits.
  2. As a boundary control, repeat with frequencies 0 Hz and 23,000 Hz. They become 1 Hz and 22,000 Hz, with warnings naming those actual limits.

The importer calls were executed in a standalone Swift executable using the unmodified REWImporter.swift, FilterType.swift, AudioConstants.swift and BandwidthConverter.swift from each baseline. The only stub was a storage-only PresetBand with the same five initializer fields; no parsing or clamping was stubbed. The app and audio driver were not launched. To repeat that focused check from a checkout, create these two files in a disposable folder:

// BandStub.swift
struct PresetBand {
    let frequency: Float
    let q: Float
    let gain: Float
    let filterType: FilterType
    let bypass: Bool
}
// main.swift
import Foundation
let url = URL(fileURLWithPath: CommandLine.arguments[1])
for frequency in [0, 10, 20, 20000, 21000, 23000] {
    try "Filter 1: ON PK Fc \(frequency) Hz Gain 3 dB Q 1.41\n".write(to: url, atomically: true, encoding: .utf8)
    let result = try REWImporter.importBands(from: url)
    print("\(frequency) -> \(result.bands[0].frequency), warnings=\(result.warnings)")
}

Compile from the checkout, substituting the disposable folder for PROBE_DIR:

swiftc src/presets/REWImporter.swift src/dsp/config/FilterType.swift src/pipeline/AudioConstants.swift src/dsp/config/BandwidthConverter.swift "$PROBE_DIR/BandStub.swift" "$PROBE_DIR/main.swift" -o "$PROBE_DIR/probe"
"$PROBE_DIR/probe" "$PROBE_DIR/fixture.txt"

Expected behavior

The import guide should state the frequency clamp limits that the importer applies, so readers can predict whether a band will be changed or produce a warning.

Actual behavior

The guide lists 20–20,000 Hz. In both tested source baselines, the focused executable returned:

0 -> 1.0, warnings=["Filter at 0 Hz: frequency clamped to 1 Hz"]
10 -> 10.0, warnings=[]
20 -> 20.0, warnings=[]
20000 -> 20000.0, warnings=[]
21000 -> 21000.0, warnings=[]
23000 -> 22000.0, warnings=["Filter at 23000 Hz: frequency clamped to 22000 Hz"]

Each executable exited successfully. This report concerns the guide’s range, not a request to narrow the engine’s supported frequencies.

Runtime or environment

  • Latest published release source: v1.3.3, commit 92095338a187f47fa0d1250fc970f1c57436b130.
  • Current default branch source: main, commit 8472be63f6c08333c21338da0c2be36ea2694234.
  • Focused harness: Apple Swift 6.4.2 (swiftlang-6.4.2.1.9), arm64 macOS target; no app installation or audio routing changes.

Evidence

  • Expected source: The user guide’s Limit Ranges table explicitly describes the limits applied during import; the documentation should match that behaviour.
  • Failure source: The focused executions above exercise the production importer’s AudioConstants.clampFrequency call. AudioConstants defines minEQFrequency = 1 and maxEQFrequency = 22000.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Restoration check

Reading the guide should correctly predict that 10 Hz and 21,000 Hz are preserved without a clamp warning, while 0 Hz and 23,000 Hz clamp to 1 Hz and 22,000 Hz with warnings. The documentation and actual supported range should agree, including both endpoints.

Triage assessment

  • Impact level: P3
  • Assessment status: supported
  • Impact basis: This is a documentation error about frequency limits; the observed importer behaviour itself is consistent and no audio processing failure is alleged.
  • Workaround status: available
  • Workaround basis: Readers can use the actual 1–22,000 Hz range established by the importer and constants; the running importer requires no change to preserve these inputs.

coygeek avatar Nov 09 '26 18:11 coygeek