Skip to content

Audio output has fixed ~+2.5 dB gain applied during render, causing clipping on normally-leveled sources #361

@endymuhardin

Description

@endymuhardin

Describe the bug

hyperframes render applies a constant ~+2.5 dB (ratio ~1.34×) gain to audio output, regardless of source configuration or data-volume setting. Sources with peaks already near -2 dBFS (common for voice recordings) are pushed past 0 dBFS, producing audible distortion.

Link to reproduction

https://github.com/endymuhardin/hyperframes-audio-gain-repro

Steps to reproduce

git clone https://github.com/endymuhardin/hyperframes-audio-gain-repro.git
cd hyperframes-audio-gain-repro
npm install
./generate-sample.sh   # deterministic 1 kHz sine, peak -6 dBFS
npx hyperframes render --quality draft --output renders/out.mp4
ffmpeg -i assets/sample.mp4 -af astats -f null - 2>&1 | grep "Peak level"
ffmpeg -i renders/out.mp4  -af astats -f null - 2>&1 | grep "Peak level"

Expected behavior

Output audio matches source levels (unity gain). Peak ≈ -5 dBFS in → peak ≈ -5 dBFS out.

Actual behavior

  • Source peak: -5.12 dBFS → output peak: -2.19 dBFS (+2.93 dB)
  • Source RMS: -9.05 dBFS → output RMS: -6.44 dBFS (+2.61 dB)
  • Sample-by-sample cross-correlation against source shows an optimal scalar gain of 1.3517 (+2.62 dB)
  • Residual after removing the gain is -47 dB below output — pure scalar multiplication, not a filter or mixed-in source
  • The render also introduces a 1024-sample (~21 ms, one AAC frame) delay relative to source

A second reproduction against a voice recording (peak -2.17 dBFS source) measured gain 1.3325 (+2.49 dB) — magnitude consistent across content.

Workaround

data-volume="0.75" (≈ 1/1.3325) on the audio-bearing element restores unity output: measured gain 1.0020 (+0.02 dB). Requires the author to know about and manually compensate for a hidden boost.

data-volume="0" does not suppress the gain — audio still passes through at +2.5 dB.

Environment

Version          0.4.11 (latest)
Node.js          v25.9.0 (darwin arm64)
CPU              8 cores · Apple M1
FFmpeg           8.1
Chrome           system

Additional context

Reproducible both with single audio source (audioCount: 1, embedded video audio) and separate <audio> element (audioCount: 2). Gain is constant across both configurations. No mention of audio normalization/loudness in hyperframes docs topics or the installed skill references.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions