Add loudness data to recording metadata

This commit introduces the `Loudness` struct to store replay-gain data
(mean, max, and calculated gain in dB) derived from `ffmpeg`'s
`volumedetect`.

The `RecordingMeta` struct is updated to include an optional `loudness`
field. This allows for consistent playback volume across recordings with
varying microphone levels by applying gain in the browser.

Additionally, new `server/src/loudness.rs` and
`server/src/transcribe/ffmpeg.rs` modules are added. The former defines
constants for replay-gain targets and logic to compute gain, while the
latter handles audio analysis using `ffmpeg` to extract loudness
metrics.

The `#[serde(default)]` attribute on the `loudness` field in
`RecordingMeta` ensures backward compatibility with older metadata files
that do not contain this field. Tests are included to verify round-trip
serialization and parsing of older formats.
This commit is contained in:
2026-04-27 16:11:02 +02:00
parent 8a531144af
commit 427a28ac6b
7 changed files with 310 additions and 1 deletions
+1
View File
@@ -6,6 +6,7 @@ pub mod csrf;
pub mod error;
pub mod events;
pub mod gazetteer;
pub mod loudness;
pub mod magic_link;
pub mod models;
pub mod oneliner_locks;