Hello, I'm using flac for an application. The fact is that i'm trying to encode a file that is not necessary a wav file. So, at first, i would like to know if it's possible to encode a file different from the wav file with the flac encoder ? When i put my data into : ok FLAC__stream_encoder_process_interleaved(encoder, pcm, need); after some rounds in my boucl i get : encoding: FAILED state: FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA (<=== what does it really mean ? and what are the reasons to be in this case ? ) I'm not english spoker, so sorry if i'm not very clear. Best regards, Rafael -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20120412/9edf122b/attachment.htm
Rafael Velasquez wrote:> I'm using flac for an application. > The fact is that i'm trying to encode a file that is not necessary a wav > file.Its still audio right? Or something audio like?> So, at first, i would like to know if it's possible to encode a file > different from the wav file with the flac encoder ?FLAC is designed for audio. I would not encode images with it.> When i put my data into : ok > FLAC__stream_encoder_process_interleaved(encoder, pcm, need); > > after some rounds in my boucl i get : > encoding: FAILED > state: FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA (<=== what > does it really mean ? and what are the reasons to be in this case ? )Have you looked at the example code? Another alternative would be to use libsndfile which offers the ability to encode audio data as FLAC using a much simpler API. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
On Apr 12, 2012, at 07:12, Rafael Velasquez wrote:> I'm using flac for an application. > The fact is that i'm trying to encode a file that is not necessary > a wav file. > > So, at first, i would like to know if it's possible to encode a > file different from the wav file with the flac encoder ?First of all, the FLAC API does not work with WAV format data - you must provide raw audio samples. If you have a WAV file, then you should use other code (your own?) to extract the raw audio samples from the file, leaving out the chunk headers and other, non-audio information. You should also make sure that the FLAC object is initialized to accept the same size samples and channel count as you have in your data, and it would probably be a good idea to match the sample rate as well for proper decoding later. Beware that the format you have may not exactly match what the FLAC library wants, so you may have to alter the data slightly before sending it to the API. So, it doesn't matter whether you have WAV, AIFF, SDII, or some other file, because your code must first extract the raw audio samples from the file before calling the FLAC library. Note that you can encode a WAV file as FLAC, and then later decode the FLAC file as AIFF. FLAC does not usually care what the uncompressed foreign file format was (unless you use "preserve foreign metadata"). These operations are supported by the command- line program, but the WAV and AIFF format code is not part of the FLAC library.> When i put my data into : ok = > FLAC__stream_encoder_process_interleaved(encoder, pcm, need); > > after some rounds in my boucl i get : > encoding: FAILED > state: FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA > (<=== what does it really mean ? and what are the reasons to be in > this case ? ) > > I'm not english spoker, so sorry if i'm not very clear.There is documentation for the FLAC API. I do not see anything describing error messages, but you could look into the source code. My guess is that "mismatch" refers to the checksum. I do not have an answer for you here, but perhaps you can continue to work on your code and find the problem. Brian Willoughby Sound Consulting
Hello, in fact : this error(FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DAT) occurs when the sample size is bigger than the exepected size in the encoder. Now, can someone tell me how to model the signal, for example : *using a Fixed linear predictor for the input signal ? * 2012/4/13 Brian Willoughby <brianw at sounds.wa.com>> > On Apr 12, 2012, at 07:12, Rafael Velasquez wrote: > >> I'm using flac for an application. >> The fact is that i'm trying to encode a file that is not necessary a wav >> file. >> >> So, at first, i would like to know if it's possible to encode a file >> different from the wav file with the flac encoder ? >> > > > First of all, the FLAC API does not work with WAV format data - you must > provide raw audio samples. If you have a WAV file, then you should use > other code (your own?) to extract the raw audio samples from the file, > leaving out the chunk headers and other, non-audio information. You should > also make sure that the FLAC object is initialized to accept the same size > samples and channel count as you have in your data, and it would probably > be a good idea to match the sample rate as well for proper decoding later. > Beware that the format you have may not exactly match what the FLAC > library wants, so you may have to alter the data slightly before sending it > to the API. > > So, it doesn't matter whether you have WAV, AIFF, SDII, or some other > file, because your code must first extract the raw audio samples from the > file before calling the FLAC library. > > Note that you can encode a WAV file as FLAC, and then later decode the > FLAC file as AIFF. FLAC does not usually care what the uncompressed > foreign file format was (unless you use "preserve foreign metadata"). > These operations are supported by the command-line program, but the WAV > and AIFF format code is not part of the FLAC library. > > > > When i put my data into : ok = FLAC__stream_encoder_process_**interleaved(encoder, >> pcm, need); >> >> after some rounds in my boucl i get : >> encoding: FAILED >> state: FLAC__STREAM_ENCODER_VERIFY_**MISMATCH_IN_AUDIO_DATA (<==>> what does it really mean ? and what are the reasons to be in this case ? ) >> >> I'm not english spoker, so sorry if i'm not very clear. >> > > There is documentation for the FLAC API. I do not see anything describing > error messages, but you could look into the source code. My guess is that > "mismatch" refers to the checksum. I do not have an answer for you here, > but perhaps you can continue to work on your code and find the problem. > > Brian Willoughby > Sound Consulting > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20120419/ddeb2eda/attachment.htm