Skip to content

[Feature] EBU R128 Real-Time Loudness Normalizer & Audiophile DSP Audio Rack #21

Description

@arkalon76

📌 Executive Summary & User Story

As an audiophile and headphone user,
I want halpradio to automatically equalize broadcast loudness across all stations and provide binaural crossfeed and vintage acoustic filters,
So that I never experience painful volume spikes between streams and can enjoy fatigue-free listening during long coding sessions.


🎯 Problem Statement & Community Context

Different internet radio streams broadcast at wildly inconsistent gain levels (ranging from -24 LUFS classical music to -8 LUFS hyper-compressed pop). Switching stations often causes painful volume jumps. Furthermore, listening to hard-panned stereo over headphones for hours causes ear fatigue.


🏗️ Detailed Functional Requirements

1. Real-Time EBU R128 Loudness Normalizer (Auto-Gain Control)

  • Implement real-time integrated loudness calculation (LUFS) adhering to the EBU R128 / ITU-R BS.1770 standard.
  • Apply a transparent, slow-acting automatic gain control (AGC) with smooth lookahead limiting to prevent clipping.
  • Target loudness configurable in config.yaml (default: -14 LUFS, matching Spotify/YouTube standards).

2. Binaural Crossfeed Filter (Headphone Fatigue Eliminator)

  • Implement Chu Moy / Bauer binaural crossfeed DSP algorithm.
  • Blends a low-pass, delayed fraction of the left channel into the right channel (and vice versa) to simulate speaker acoustic crosstalk, drastically reducing headphone listening fatigue.

3. Lo-Fi / Vintage Cassette DSP Mode

  • Toggleable analog acoustic effect:
    • Subtle analog tape saturation & warm harmonic warmth.
    • Mild high/low-pass roll-off and optional vinyl surface warmth.

4. 10-Band Graphic Equalizer TUI Modal (E key)

  • 10 frequency bands: 32Hz, 64Hz, 125Hz, 250Hz, 500Hz, 1kHz, 2kHz, 4kHz, 8kHz, 16kHz.
  • Built-in presets: Flat, Bass Boost, Vocal Clarity, Electronic, Acoustic, Deep Focus.

🖥️ TUI & Visual Design

┌─ 🎚️ GRAPHIC EQUALIZER & DSP RACK ──────────────────────────────────────────┐
│  Presets: [Flat]  [Bass Boost]  [*Deep Focus*]  [Lo-Fi Tape]  [Custom]       │
│                                                                             │
│  +12dB ───   ─█─   ───   ───   ───   ───   ───   ───   ───   ───            │
│   +6dB ───   ─█─   ─█─   ───   ───   ───   ───   ─█─   ─█─   ───            │
│    0dB ─█─   ─█─   ─█─   ─█─   ─█─   ─█─   ─█─   ─█─   ─█─   ─█─            │
│   -6dB ───   ───   ───   ───   ───   ───   ───   ───   ───   ───            │
│  -12dB ───   ───   ───   ───   ───   ───   ───   ───   ───   ───            │
│        32Hz  64Hz 125Hz 250Hz 500Hz  1kHz  2kHz  4kHz  8kHz 16kHz           │
│                                                                             │
│  [x] EBU R128 Normalizer (-14 LUFS)    [x] Binaural Crossfeed (Headphones)  │
│  [Tab: Select Band | j/k: Adjust dB | p: Presets | Esc: Save & Close]       │
└─────────────────────────────────────────────────────────────────────────────┘

🛠️ Technical Architecture & Implementation Details

  • Package Location: pkg/player/dsp/normalizer.go, pkg/player/dsp/crossfeed.go, pkg/player/dsp/eq.go, pkg/ui/modals/eq_modal.go.
  • Pure Go DSP Pipeline: Operates directly on the 32-bit floating point PCM audio stream buffer before piping to oto/v3 or native audio output.

✅ Acceptance Criteria (Definition of Done)

  • EBU R128 normalizer successfully equalizes loud and quiet stations to uniform target volume without audio pumping.
  • Binaural crossfeed toggles cleanly with audible natural stereo imaging on headphones.
  • 10-band equalizer modal provides interactive slider controls with real-time audio response.
  • DSP settings persist in ~/.config/halpradio/dsp.yaml.
  • Zero measurable CPU lag or dropped audio frames during DSP processing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions