Skip to content

Corrupted FLAC files when recording levels >0dBFS #53

@teodly

Description

@teodly

This will never occur when capturing from (sane) audio interfaces, but may be a problem when capturing output of other apps or "what the user hears" (jack_capture launched without ports specified).

When converting from floats to ints, jack_capture should clamp levels to be between INT_MIN, INT_MAX.

How to reproduce:

  • launch JACK audio server
  • reduce audio interface volume to the minimum
  • jack_capture -c 2 -f flac
  • and in different terminal: ffmpeg -f lavfi -i sine=440,volume=9 -sample_rate 48000 -f f32le - | jack-stdin -e float system:playback_1

You should hear a slightly distorted sine wave (because JACK truncates properly). When you try to open the resulting FLAC file, strange things happen. Audacity will show clipping properly but Amplify effect will indicate that peak is +48dBFS (something impossible in integer FLAC file!). After applying -48dB gain noise can be heard in the distorted fragment.

flac --test jack_capture_01.flac checksum verification will fail.

jack_capture version: 0.9.73 (Ubuntu 20.04)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions