Flac has -6dB gain in mixxx 2.1.0
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mixxx |
Fix Released
|
High
|
Jamie Gifford |
Bug Description
In Mixxx 2.1.0, FLAC files are decoded with a -6dB gain. Tested on Linux and Mac.
The problem is reproducible always. Eg, create a 440Hz full-scale sine in both WAV and FLAC formats with "sox -r 44100 -n a440.wav synth 20 sine 440" and "sox -r 44100 -n a440.flac synth 20 sine 440". The WAV file plays correctly; the FLAC file will play at -6dB.
Looks to me that the problem is in soundsourceflac
m_sampleScaleFactor = CSAMPLE_PEAK
Since FLAC samples are signed, a FLAC full-scale sample will only reach bitsPerSample-1, not bitsPerSample (eg, in a 24 bit stream the maximum sample magnitude would be 1<<23). This means that m_sampleScaleFactor is out by a factor of two, hence -6dB.
I think the code should read
m_sampleScaleFactor = CSAMPLE_PEAK
Changed in mixxx: | |
assignee: | nobody → Jamie Gifford (jamie.gifford) |
status: | Confirmed → In Progress |
importance: | Undecided → High |
milestone: | none → 2.1.1 |
Changed in mixxx: | |
status: | In Progress → Fix Committed |
Changed in mixxx: | |
status: | Fix Committed → Fix Released |
I /thought/ my FLAC files sounded quieter! Thank you very much for the detailed analysis! (Do you use GitHub and want to make a pull request so you get credit in the commit history?)