kmatheussen / jack_capture

A program for recording soundfiles with jack
http://www.notam02.no/arkiv/src/
Other
75 stars 28 forks source link

Corrupted FLAC files when recording levels >0dBFS #53

Open teodly opened 1 year ago

teodly commented 1 year ago

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:

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)