feat: per-track loudness normalization and server audio info
CI / chart (push) Successful in 3s
CI / test (push) Successful in 2m6s
CI / chart-push (push) Successful in 3s
CI / image (push) Successful in 3m31s

- measure downloads with ffmpeg's EBU R128 filter and store gain/LUFS
- backfill the existing library one file at a time
- expose gain on songs and a /info endpoint for source quality
- chart knobs LOUDNESS_ENABLED and LOUDNESS_TARGET_LUFS
This commit is contained in:
TapTap committed 2026-11-19 16:38:21 +00:00
1 parent 6763a83b03
commit 91312faa1c
15 files changed
+387 -9

No files matched your search

+23 -6
View File
@@ -144,6 +144,11 @@ cases (auth, ownership, streaming, transcription, permissions).
ids) or `"dz:<trackId>"` for Deezer.
- MP3 only (`yt-dlp -x --audio-format mp3 --audio-quality 0`), embedded
metadata and thumbnail.
- Loudness: after indexing, ffmpeg measures `input_i`/`input_tp` with
`loudnorm`. `gain_db = min(target - input_i, truePeak - input_tp)` is stored;
clients apply it per track. New downloads are measured inline, the existing
library is backfilled one file at a time. `LOUDNESS_ENABLED` and
`LOUDNESS_TARGET_LUFS` control it.
- The scanner walks `MEDIA_DIR`, extracts `(source, externalId)` from the top-level folder,
reads tags/cover, and upserts the song. The downloader can call the same
indexer for one file to avoid waiting for a full scan.
@@ -724,16 +729,28 @@ Phases 1-8 are implemented in both repositories.
### Client
- Models, `ApiClient`, `AppCache` (version 3) and `AppStore` match the new API.
- Screens are `Moods | MoodDetail | Search | Downloads | Settings`.
- Models, `ApiClient`, `AppCache` (version 3 + separate client settings file) and `AppStore` match the new API.
- Screens are `Moods | MoodDetail | MoodSettings | Search | Downloads | Settings |
NowPlaying`.
`LibraryScreen`, longform UI, seed management and global shuffle are gone.
- Search supports a target-mood picker, a **Deezer / YouTube Music** source
selector, downloaded badges and paste-a-URL.
- Mood detail shows songs, add music, recommendation states (Add / Not
interested / Retry), next batch and the new options.
- Playback, sleep timer, queue editing, Android media session and device
downloads are unchanged apart from song-keyed covers.
- Tests: 17 client tests; desktop, Android debug and Wasm compile.
interested / Retry). The preview/next-batch section and the inline settings
form are gone: mood settings (including source and the offline switch) live on
a dedicated screen, with Delete at the bottom.
- **0.4.0 playback**: Android's `MediaSessionService` owns a Media3 timeline,
so notification/headset next/back and gapless playback use real media items.
Previous keeps the 2 s restart rule. The app mirrors the index, appends the
next server batch and still reports skipped/completed events.
- **Audio**: server gain is applied by an Android PCM `AudioProcessor` (boost and
attenuation) and by the desktop mixer; the full-screen player shows source and
bitrate. Android has an optional 0–8 s fade between tracks.
- **Offline moods**: a per-mood switch downloads every song and keeps new
additions in sync on unmetered networks, three at a time.
- **Sleep timer** adds "Finish this track"; the full-screen player shows large
artwork, transport, add-to-mood, queue and Up next.
- Tests: 21 client tests; desktop, Android debug and Wasm compile.
### Known follow-ups