freesound icon indicating copy to clipboard operation
freesound copied to clipboard

Wrong bitdepth in (some) FLAC files

Open ffont opened this issue 2 years ago • 5 comments

As reported by a user in the forums: https://freesound.org/forum/freesound-project/44089/?page=1#post101133 At least some FLAC files seem to show wrong bitdepth information. We should check that the part in which we get sound's info works correctly for FLAC files. Here is an example FLAC file that displays being 24bit but it is actually 32 bit: https://freesound.org/people/saorenjoyer/sounds/688065/

ffont avatar May 22 '23 16:05 ffont

In utils/audioprocessing/processing.py function convert_to_pcm relies on the system installed flac which is probably outdated (1.3.X, while 32 bit support appears in 1.4.0).

FreesoundAudioProcessor in freesound_audio_processing provides the file info (bit rate included) via the function stereofy_and_find_info, but only after calling convert_to_pcm, which probably produces the 24 bit temp file.

UPDATE: flac 1.3.2 actually fails the conversion (tested manually on the file at https://github.com/ietf-wg-cellar/flac-test-files/blob/main/uncommon/05%20-%2032bps%20audio.flac) so the processor should set self.set_failure(e) and fail before calling stereofy_and_find_info; 24 bit is then probably a sensible default set somewhere else?

flac 1.4.X converts the file without problems and the result is a regular 32 bit file which then stereofy_and_find_info should classify correctly.

P-D-E avatar May 23 '23 12:05 P-D-E

Maybe the simplest solution would be to upgrade the stereofy base image to debian 12 which comes with flac 1.4.2?

Bomme avatar Dec 30 '23 15:12 Bomme

Thanks for finding this @Bomme, I guess the issue is before, when we first convert to pcm so we should update the base docker image. Whoever we use python:10 image, and we don't control the os version there. We should probably look at installing more modern flac tool in the base image, and yes also update stereofy's image just in case.

ffont avatar Jan 11 '24 15:01 ffont

The python:3:10 image is debian bookworm

$ !cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

And debian bookworm ships flac 1.4.

So I think this issue was fixed with #1682.

Can we try reprocessing this sound @ffont?

Bomme avatar Jan 12 '24 22:01 Bomme

I just tried re-processing the sound and it still reports 24 bit, but I did not look into detail as in what point it is not working as expected.

ffont avatar Jan 15 '24 11:01 ffont