foxLyrionDSP
Go-based DSP engine for Lyrion Music Server
This is the core signal processing engine that powers the SqueezeDSP plugin. It runs as a standalone binary in the Lyrion/Squeezebox transcoding chain, receiving a raw audio stream via stdin and writing the processed stream to stdout.
End users — you do not need this repository. Install the plugin directly via the Lyrion third-party plugins list. See the SqueezeDSP repository for installation instructions.
Overview
foxLyrionDSP is invoked by Lyrion's transcoding system as part of a pipeline, for example:
flac -dcs -- $FILE$ | foxLyrionDSP --id="xx:xx:xx:xx:xx:xx" --wav=true --wovo=true --d=24 | flac -cs -0 --totally-silent -
It reads settings for the given player ID from the SqueezeDSP configuration, applies the configured DSP chain, and passes the processed audio downstream.
Features
- Parametric Equaliser — Peak, High Pass, Low Pass, High Shelf, Low Shelf filters with configurable frequency, gain, and Q
- FIR Convolution — room correction and impulse response convolution via WAV files, with automatic resampling via SoX to match the incoming sample rate
- Preamp — gain reduction to prevent clipping, particularly important when using convolution
- Balance — left/right channel level adjustment
- Width — stereo width control
- Delay — single-channel delay in milliseconds
- Loudness — bass and treble compensation at lower listening levels
- Per-player configuration — each Lyrion player can have independent settings
- Preset support — save and load named configurations
- Clipping detection — peak level monitoring with log output
Input is processed from the Lyrion transcoding chain. Output is 24-bit FLAC or 16-bit WAV depending on player capability.
Audio formats with custom transcoding profiles: aac, aif, alc, alcx, ape, flc, mov, mp3, mp4, mp4x, mpc, ogg, ogf, ops, spt, wav, wma, wmal, wmap, wvp
DSD and MQA are not supported.
Architecture
Package Structure
| Package |
Purpose |
LyrionDSPFilters |
Filter design and coefficient calculation (PEQ, shelf, pass filters, FIR) |
LyrionDSPProcessAudio |
Audio processing pipeline, sample conversion, convolver |
LyrionDSPSettings |
Configuration loading and per-player settings management |
LyrionTools |
Shared utilities |
Convolver
The convolver uses a partitioned FFT approach with a ring buffer to process the audio stream efficiently. Key design decisions:
- A custom minimal FFT library (based on ArgusDusty FFT) with cached twiddle factors, optimised for block sizes below 16,386 samples — substantially faster than
scientificgo in this range
- Partitioned processing minimises the data discarded after FFT/InverseFFT cycles
- Impulse files are resampled on first use (via SoX) and cached for subsequent tracks at the same sample rate
- Filter building at track start uses an IIR calculation to combine filters rather than a full convolution, giving approximately 10x faster cold starts
- Output gain is managed by calculating the inverse of the final impulse's MaxGain and applying it during the gain stage, rather than normalising the impulse itself
Performance (approximate, streaming with a large room correction impulse):
| Hardware |
Max sample rate |
Notes |
| Pi 3B |
192kHz |
As of v0.1.41 engine rewrite |
| Pi 4 |
192kHz+ |
Comfortable |
| Modern PC / server |
192kHz+ |
Minimal CPU load |
Building
Requires Go 1.21 or later.
Build all targets (Windows):
Build-All.bat
Build test harness (Windows):
Build-Test.bat
Manual cross-compilation:
# Linux (ARM - Pi)
GOOS=linux GOARCH=arm GOARM=7 go build -o foxLyrionDSP_arm ./foxLyrionDSP.go
# Linux (ARM64)
GOOS=linux GOARCH=arm64 go build -o foxLyrionDSP_arm64 ./foxLyrionDSP.go
# Linux (x86_64)
GOOS=linux GOARCH=amd64 go build -o foxLyrionDSP ./foxLyrionDSP.go
# Windows
GOOS=windows GOARCH=amd64 go build -o foxLyrionDSP.exe ./foxLyrionDSP.go
Testing
A test harness is included for offline development and benchmarking:
go run dsp_tester.go
This allows processing of a local audio file through the DSP chain without requiring a running Lyrion instance.
Command Line Arguments
| Argument |
Description |
--id |
Player MAC address — used to load the correct per-player settings |
--wav |
Input is WAV format |
--wovo |
Output WAV format |
--d |
Output bit depth (typically 24) |
Tested on: Windows 10/11, Raspberry Pi 3B/4 (Raspbian), Docker (Linux), Ubuntu (VirtualBox), macOS (VirtualBox), PiCorePlayer.
License
MIT License — Copyright (c) 2024 Jonathan Fox
