[flac-dev] Commonly getting FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA on valid audio

Johnny Rosenberg gurus.knugum at gmail.com
Sat Feb 9 03:13:39 PST 2013

2013/2/8 Erik de Castro Lopo <mle+la at mega-nerd.com>:
> Collin wrote:
>> It turns out it was an error on my part; sorry for the trouble. I misunderstood
>> the format libflac was expecting my samples in. I found the wording in the
>> documentation very confusing.
>> My audio file has 2 channels and 16-bit samples, so I have to pull out each
>> individual sample, push it into a FLAC__int32, and fix endian-ness before I can
>> pass it to libflac.
>> The documentation made me think that libflac just wanted me to shove my 2-byte
>> sample into a FLAC__int32. I wasn't aware that it wanted me to extend the sign,
>> as well.
> At some stage it might make sense for us to make the FLAC API a little
> more user/programmer friendly. Something to match libsndfile's ease of
> use.

That would be great!
I was actually starting my small ”project” with libsndfile, but it was
done in a way that I didn't agree with, and since I only work with
FLAC files (mostly 24 bits) I decided to try to go with libflac
instead, which seems to let me do things the way I want more than

For example, when loading an audiofile with libsndfile, all the
samples are converted to floating point numbers, which is what I want
anyway, but the conversion is done by dividing the integers from the
file with pow(2,bps-1), but when converting back, they multiply with
pow(2,bps-1)-1, so if you just read and then write, you end up with a
slightly lower volume (not that you can hear any difference if you do
it only a few times, but still, it isn't right, AND it is very easy to
do it right, so why don't they?)…

Johnny Rosenberg, the beginner

> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
> _______________________________________________
> flac-dev mailing list
> flac-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/flac-dev

More information about the flac-dev mailing list