Hi FLAC team. I feel I have found a super high compression way of FLAC. I have tested a 1 hour WAV file of 440HTZ with a 5,25,50,75,100 normalize volume preset. This dramatically changes the compression size of the end FLAC file even though the WAV file size is identical for all 5 WAV files. Only the volume is different. When you renormalize the WAV to its original volume the file is still 100% original. My tests are the following. source file WAV. 1 hour 440HTZ tone. 600MB. volume at 100. FLAC file size is 184MB. volume at 75. FLAC file size is 166MB. volume at 50. FLAC file size is 143MB. volume at 25. FLAC file size is 109MB. volume at 5. FLAC file size is 96MB. From184MB to 96MB. As you can see from the full 100 normalize volume to the 5 normalize volume it is half the file size. So to put it. I think that you should have your compression of FLAC to also include a normalize volume shift to further compress the end product. Either have a default setting or allow a user to input an option in the command line arguments to add a normalize volume value. Then to uncompress it back to a WAV file FLAC would read the volume header in the FLAC file to apply the WAV original normalize volume and expand it back to its original state. Then have the FLAC decoder for all the players out there to read the volume header so to play the FLAC at the WAV original normalize volume. I hope I have helped to develop FLAC further. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/flac-dev/attachments/20170819/e5426be9/attachment.html>
z1x2c3v4z1x2c3v4 wrote:> I feel I have found a super high compression way of FLAC. I > have tested a 1 hour WAV file of 440HTZ with a 5,25,50,75,100 > normalize volume presetSo this a a test file with just a 440Hz sine wave? That signal is totally unlike actual music that people use FLAC to encode. If you can test with normal music signals and still see the same results then you may get some more interest. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
"z1x2c3v4z1x2c3v4", I think a sine wave is not the best way to test a compression algorithm since the only uncorrelated component is the quantizing error, which is very small. First of all, my test for a 100 % 440 Hz tone yields 24.10 % instead of 30.66 % as yours. Second, for 16 bit, 44100 Hz the slope is so large that if the first sample is 0 then the second sample is about 1854 (being 100% = 32767). This means that atenuating it to a 5 % and then multiplying by 20 probably will recover the signal accurately. But if instead of a full scale sine wave you generate a signal that starts being a sine wave of an amplitiude equal to 10 / 32767 = 0.00030518 (equivalent to an amplitude -70.3087 dB) and then, after, say, 10 s, follows a full scale (100 % = 0 dB) sine wave, then you'll find that the decoded signal is different from the original one if you apply your method, since normalizing to a anythig but 100 % will render the first part severely and unrecoverably distorted. And normalizing to a 5 % actually will make the signal vanish, so no matter by how much you multiply it, it will keep being 0. Federico Miyara On 19/08/2017 18:37, z1x2c3v4z1x2c3v4 wrote:> > Hi FLAC team. > > > I feel I have found a super high compression way of FLAC. I have > tested a 1 hour WAV file of 440HTZ with a 5,25,50,75,100 normalize > volume preset. This dramatically changes the compression size of the > end FLAC file even though the WAV file size is identical for all 5 WAV > files. Only the volume is different. When you renormalize the WAV to > its original volume the file is still 100% original. > > > My tests are the following. > > source file WAV. 1 hour 440HTZ tone. 600MB. > > volume at 100. FLAC file size is 184MB. > > volume at 75. FLAC file size is 166MB. > > volume at 50. FLAC file size is 143MB. > > volume at 25. FLAC file size is 109MB. > > volume at 5. FLAC file size is 96MB. > > > From184MB to 96MB. > > As you can see from the full 100 normalize volume to the 5 > normalize volume it is half the file size. > > So to put it. I think that you should have your compression of FLAC to > also include a normalize volume shift to further compress the end > product. Either have a default setting or allow a user to input an > option in the command line arguments to add a normalize volume value. > Then to uncompress it back to a WAV file FLAC would read the volume > header in the FLAC file to apply the WAV original normalize volume and > expand it back to its original state. > > > Then have the FLAC decoder for all the players out there to read the > volume header so to play the FLAC at the WAV original normalize volume. > > > I hope I have helped to develop FLAC further. > > > > _______________________________________________ > flac-dev mailing list > flac-dev at 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/20170820/0c2902a8/attachment-0001.html>
There are several errors and misinterpretations in your example. Your first error is that at 5% volume, starting with a 16-bit file results in less than 12 bits of resolution. There is no way to get back the original 16-bit quality unless you promote the 16-bit file to a 24-bit file at the same time as you reduce the volume to 5%. While that might work at the expense of using 24-bit FLAC for a 16-bit WAV, it would fail to be lossless if you start with a true 24-bit WAV. In the latter case, your FLAC would only preserve less than 20 bits of audio, and that is not lossless. Your second error is that WAV file sizes are always identical for all WAV files with the same bit depth and time duration (and channel count - in this case, stereo). That is the definition of uncompressed audio file sizes. However, even with identical source WAV file sizes, the corresponding FLAC file sizes are expected to vary a great deal because FLAC is required to be lossless. An MP3 can have a fixed compression ratio because it is lossy - sound quality is lost. FLAC cannot have a fixed compression ratio because is must be lossless, and thus differences in the input audio will change the size. That is expected. The misinterpretation I refer to is that the relationship between the volume level (amplitude) of the original audio and the size of the compressed FLAC file is expected to be exactly like you have discovered. FLAC uses many mathematical algorithms to reduce the size of audio without losing any information. One of these processes is to use differential values rather than absolute values. The second is to use Rice coding so that small values take less space than large values. There's a lot more going on than just those two algorithms, but the point is that sounds with a lower amplitude will always compress smaller than sounds with a higher amplitude. I can guarantee, mathematically, that there is no way to reduce the volume of a 16-bit audio recording to 5% and then restore is to it's original value (at least not without cheating and using 24-bit storage in between) without losing something. Your 5% volume is a reduction in signal-to-noise ratio of 26 dB, and there's no way to get that back losslessly. In other words, your suggestion to add a volume header for normalization defeats the purpose of FLAC, because your technique will not be lossless. There are plenty of compression algorithms that can lose 26 dB of S/N and create smaller files. Thanks for writing, though. It's always fun to discover how FLAC works. In my personal usage, I make live recordings and then use FLAC to archive the originals. Since live recording should never allow the volume to reach the Full Scale limits, my live recordings always compress smaller than the equivalent 24-bit audio for distribution. I discovered the same things you discovered when I went through the mastering process - which increases the volume - and noticed that the final FLAC files were much larger than the original FLAC files. This was really only because I increased the volume. In this case, I might be able to release unmastered audio recordings with a "normalization" value and keep the FLAC files smaller. But that only works because the original audio is already quieter. It doesn't work losslessly if you artificially reduce the volume - because then you're losing information. Brian Willoughby On Aug 19, 2017, at 2:37 PM, z1x2c3v4z1x2c3v4 <z1x2c3v4z1x2c3v4 at hotmail.com> wrote:> I feel I have found a super high compression way of FLAC. I have tested a 1 hour WAV file of 440HTZ with a 5,25,50,75,100 normalize volume preset. This dramatically changes the compression size of the end FLAC file even though the WAV file size is identical for all 5 WAV files. Only the volume is different. When you renormalize the WAV to its original volume the file is still 100% original. > > My tests are the following. > source file WAV. 1 hour 440HTZ tone. 600MB. > volume at 100. FLAC file size is 184MB. > volume at 75. FLAC file size is 166MB. > volume at 50. FLAC file size is 143MB. > volume at 25. FLAC file size is 109MB. > volume at 5. FLAC file size is 96MB. > > From184MB to 96MB. > As you can see from the full 100 normalize volume to the 5 normalize volume it is half the file size. > So to put it. I think that you should have your compression of FLAC to also include a normalize volume shift to further compress the end product. Either have a default setting or allow a user to input an option in the command line arguments to add a normalize volume value. Then to uncompress it back to a WAV file FLAC would read the volume header in the FLAC file to apply the WAV original normalize volume and expand it back to its original state. > > Then have the FLAC decoder for all the players out there to read the volume header so to play the FLAC at the WAV original normalize volume. > > I hope I have helped to develop FLAC further. >
Hi Erik, Sorry to be rude, my name is Shane. Also sorry for my late late reply. I moved home just after my 1st contact to you and have only just setup my PC and got back online. I shall do some testing with actual full album Flac length music and get back to you with my results of normalize volume presets. Cheers. ________________________________ From: Erik de Castro Lopo <mle+la at mega-nerd.com> Sent: Sunday, August 20, 2017 7:45 AM To: z1x2c3v4z1x2c3v4 Cc: flac-dev at xiph.org Subject: Re: [flac-dev] FLAC compression experiment z1x2c3v4z1x2c3v4 wrote:> I feel I have found a super high compression way of FLAC. I > have tested a 1 hour WAV file of 440HTZ with a 5,25,50,75,100 > normalize volume presetSo this a a test file with just a 440Hz sine wave? That signal is totally unlike actual music that people use FLAC to encode. If you can test with normal music signals and still see the same results then you may get some more interest. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ mega-nerd.com<http://www.mega-nerd.com/> www.mega-nerd.com Home Page of mega-nerd.com ... Faster FP to Integer Conversions Audio DSP Tutorial Sample Rate Conversion libsndfile -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/flac-dev/attachments/20171115/04b33b00/attachment.html>