So some research and experimentation I think I found the problem, but I'm not sure how to go about fixing it. If I import one of the wav files into Audacity then export them as "16 bit PCM" then they encode to flac and play fine. The files bitrates are currently at 24. If I export them from audacity as a 24 or 32 (anything higher than 16), flac fails on me. With a bitrate of 24, the file is encoded but won't play. With a bitrate of 32, flac says it can't do it. Questions in no particular order: 1) I assume converting from 24 bits to 16 bits results in a loss of information, right? 2) Is there a faster way to convert rather than going in and out of audacity. 3) Is there a way to make 24 bit files work with flac? Thank you again, Matthew On Feb 6, 2008 1:48 PM, Erik de Castro Lopo <erikd-flac@mega-nerd.com> wrote:> Matthew Davis wrote: > > > And more info... > > > > Screen capture of the WAV file's hex. This tells me little, but maybe > > someone out there knows more about this than me. > > > > http://img139.imageshack.us/my.php?image=screenshot251awavghexnd1.png > > I don't see anything wrong there. > > Have you tried running it past sndfile-info which is part of > libsndfile: > > http://www.mega-nerd.com/libsndfile/ > > Does the flac encoder you're using do small files correctly? It may > be a miscompiled FLAC encoder. > > Erik > -- > ----------------------------------------------------------------- > Erik de Castro Lopo > ----------------------------------------------------------------- > "I wouldn't be surprised to see "Duke Nukem Forever" get > released before Perl 6." -- Rob on the LAU mailing list > _______________________________________________ > Flac-dev mailing list > Flac-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/flac-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20080206/92ef300e/attachment.html
Matthew Davis wrote:> If I import one of the wav files into Audacity then export them as "16 bit > PCM" then they encode to flac and play fine.Ok.> The files bitrates are currently at 24.Sorry to be a pedant, but you mean sample bitwidth of 24 rather than bitrate.> If I export them from audacity as a 24 or 32 (anything > higher than 16), flac fails on me. With a bitrate of 24, the file is encoded > but won't play. With a bitrate of 32, flac says it can't do it.Looks like this *might* be a bug in the FLAC WAV reading code.> Questions in no particular order: > 1) I assume converting from 24 bits to 16 bits results in a loss of > information, right?Yes.> 2) Is there a faster way to convert rather than going in and out of > audacity.sndfile-convert from libsndfile.> 3) Is there a way to make 24 bit files work with flac?I tried converting a 24 bit WAV using sndfile-convert and it worked as expected although the output file was 72% of the size of the input file. Obviously, sndfile-coonvert uses libsndfile's WAV reading code. The sndfile-convert program is part of libsndfile and you can grab the latest libsndfile pre-release here: http://www.mega-nerd.com/tmp/libsndfile-1.0.18pre20.tar.gz Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "In civilian equipment, such as computers, the number of components alone makes miniaturization essential if the computer is to be housed in a reasonable-sized building." Electronics Oct. 1, 1957, p. 178
I have one theory about your playback problem: Many flac solutions load the entire flac and decompress the samples before passing them on to the player. In your case, the conversion code may be running out of memory on 24-bit files where it does not run out of memory on 16-bit files of the same duration. Another possibility is that the flac player does not support 24-bit data properly. As Erik mentioned, conversion to 16-bit is a loss of quality. Even if you are willing to do this, you should have a very good dithering algorithm to avoid quantization noise. The problem you are having is not with flac. Your problem is with your player. The encode and decoder both support 24-bit files all the way up to the 4 GB limit. I have made several 24-bit multitrack recordings, and flac always handles these files without loss of data. The flac players I have fully support long 24-bit files. It seems that you need to replace your player if it cannot handle large 24-bit files. You don't want to reduce the quality of your source or abandon lossless coding just because the players are buggy! Brian Willoughby Sound Consulting On Feb 6, 2008, at 13:57, Matthew Davis wrote: So some research and experimentation I think I found the problem, but I'm not sure how to go about fixing it. If I import one of the wav files into Audacity then export them as "16 bit PCM" then they encode to flac and play fine. The files bitrates are currently at 24. If I export them from audacity as a 24 or 32 (anything higher than 16), flac fails on me. With a bitrate of 24, the file is encoded but won't play. With a bitrate of 32, flac says it can't do it. Questions in no particular order: 1) I assume converting from 24 bits to 16 bits results in a loss of information, right? 2) Is there a faster way to convert rather than going in and out of audacity. 3) Is there a way to make 24 bit files work with flac? Thank you again, Matthew
Brian Willoughby wrote:> The problem you are having is not with flac. Your problem is with > your player.If you want to try another player, try sndfile-play from libsndfile which compiles and works on Linux, win32 and Mac OSX. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- Fundamentalist : Someone who is colour blind and yet wants everyone else to see the world with the same lack of colour.
I have exactly the same problem. I encoded a BWF file to flac and then then decoded back to wav, using --keep-foreign-metadata, and I ended up with a bit-perfect copy of the original BWF. So I was fairly confident that the flac encoding is working correctly, the problem definitely appears to be with the flac players. Unfortunately it seems that the majority of flac players cannot play 24bit files - winamp, windows media player (with flac plugin), vlc, amarok, kaffeine and a few others ALL failed to play the file. I would either get silence, static, or a complete refusal to play the file. The only player that played it successfully was Foobar 2000 on Windows. More seriously from my point of view is the Java flac plugin also fails, which has major repercussions for the project I work on (the National Archives of Australia Xena project - http://xena.sourceforge.net). I don't know how much the flac developers have to do with the player implementations, but this does seem to be a major problem across almost the full board of flac players. J. On Feb 7, 2008 9:59 AM, Brian Willoughby <brianw@sounds.wa.com> wrote:> I have one theory about your playback problem: Many flac solutions > load the entire flac and decompress the samples before passing them > on to the player. In your case, the conversion code may be running > out of memory on 24-bit files where it does not run out of memory on > 16-bit files of the same duration. Another possibility is that the > flac player does not support 24-bit data properly. > > As Erik mentioned, conversion to 16-bit is a loss of quality. Even > if you are willing to do this, you should have a very good dithering > algorithm to avoid quantization noise. > > The problem you are having is not with flac. Your problem is with > your player. The encode and decoder both support 24-bit files all > the way up to the 4 GB limit. I have made several 24-bit multitrack > recordings, and flac always handles these files without loss of > data. The flac players I have fully support long 24-bit files. It > seems that you need to replace your player if it cannot handle large > 24-bit files. > > You don't want to reduce the quality of your source or abandon > lossless coding just because the players are buggy! > > Brian Willoughby > Sound Consulting > >