


#372 Noisy/distorted FLAC playback


Encoding a certain set of WAV files produces FLACs that verify correctly, but that are noisy/distorted, or fail to play, when I play them in certain players. Different compression levels make no difference.

Why do I think this is a FLAC bug and not a bug with the player(s) in question? Well, the WAVs themselves plays fine, and if I decode the FLAC to a new file, that too plays fine. But playing the FLAC itself? Results vary, as follows:
* I get the distorted sound from several players (Amarok, Bangarang, Dolphin's preview player), though I think they all use the same KDE playback backend.
* VLC actually gives me no sound whatsoever.
* Mplayer plays without distortion. But...

The other noteworthy thing is that in every player, whatever I hear, it doesn't last as long as the original file. I've created a snippet [1] of one of the files and encoded it; the WAV is about 11 seconds, but the FLAC [2] goes silent after less than a second and stops playing after about 6 seconds.

Also, a FLAC encoded with flake 0.11 [3] works fine, but the encoder complains about the result not being lossless:
Flake: FLAC audio encoder
version 0.11
(c) 2006-2007 Justin Ruggles

WARNING! The chosen encoding options are
not FLAC Subset compliant. Therefore, the
encoded file(s) may not work properly with
some FLAC players and decoders.

block time: 105ms
variable block size: none
prediction type: levinson-durbin
prediction order: 1,8
partition order: 0,6
order method: estimate
stereo method: mid-side
header padding: 4096

input file: "battle1.wav"
output file: "battle1.flac"
Unsigned 8-bit 11025 Hz stereo
WARNING! converting to 16-bit (not lossless)
samples: 1559548 (2m21.455s)
block size: 1152

Version and system info:
* flac 1.2.1
* Kubuntu 10.10 (Linux 2.6.35-23-generic, KDE SC 4.5.1)
* Intel Core2 Duo E7400

The WAV files are fairly old (from the soundtrack of 1996 game "Lords of the Realm II"), so maybe there's something unusual about their format; wavinfo [3] gives me this information for one of the files:
Header info for: battle1.wav
WaveHeader Size: 12
ChunkHeader Size: 8
FormatChunk Size: 16
Total Size: 3119132
Chunk ID: fmt
Chunk Size: 16
Compression format is of type: 1
Channels: 2
Sample Rate: 11025
Bytes / Sec: 22050
wBlockAlign: 2
Bits Per Sample Point: 8
wavDataPtr: 44
wavDataSize: 3119096

[1] Even snipped, it's just slightly too large to upload, but decoding the attachment should recover it correctly
[2] See attachment


  • Tim

    FLAC showing the problem

  • This is an 8-bit file, which is fairly uncommon these days, and apparently Flake doesn't support that, so that part isn't related to this bug.

    The test-file you attached plays fine with Amarok here (probably they've fixed it), ffmpeg and MPlayer but VLC indeed crashes. It does chrash on other 8-bit FLAC-files as well, but it doesn't crash on the decoded WAV-files, just as you observed.

    As I am not able to reproduce this bug (except with VLC), I think this might have been a bug in libavcodec (which a lot of players use) but has been fixed in the meantime. Probably one should file a bug report with VLC for chrashing on 8-bit FLAC files.