Lossless audio compression with libpng
github.com
github.com
Comparing it to any archival compression algorithm (PNG uses DEFLATE with some pre-filtering) is not an apples to apples comparison.
The utility of a streaming format is that, (a) your listeners can start the stream at any offset without having the preceding blocks, (b) the CPU overhead is generally stable and (c) decoding requires a minimal amount of memory and IO.
sox piano.flac piano.wav
gzip -c < piano.wav > piano.wav.gz
brotli-encode < piano.wav > piano.wav.brotli
ls -l piano2.wav piano2.wav.gz piano2.wav.brotli piano2.flac
and gotten: -rw-r--r-- 1 robryk users 40056 Jun 14 19:15 piano2.wav.gz
-rw-r--r-- 1 robryk users 87656 Jun 14 19:13 piano2.wav
-rw-r--r-- 1 robryk users 34221 Jun 14 19:14 piano2.wav.brotli
-rw-r--r-- 1 robryk users 52372 Jun 14 19:13 piano2.flac
Either I'm doing something wrong or even plain gzip fares better than flac (edit: in this particular case, obviously). brotli-encode compresses using brotli[1] using the font mode.[1] https://code.google.com/p/font-compression-reference/source/...
that said, this approach may obviously be applied more generally, but it remains to be seen if it will perform so well. self-similarity seems so obvious as a compression technique that i would be.. surprised if this sort of compression wasn't attempted before.
Maybe autocorrelation is not very explored in conventional codecs (FLAC/MP3 because it has a too small gain to be justifiable - in a general purpose situation)
In real life situations the autocorrelation is much smaller, even a constant note will have a small variation in time
That's an essential feature for a media compression format.
Of course there are FLAC players, but without one of those you would need to uncompress it to wav before playing.
At the same time, most compression formats are very unsuited to starting decompression from any other point than the beginning of the stream. I don't know how easy it is to seek in FLAC files, but to my best knowledge it's at least possible.
> The sample audio I chose is one of the best case signals for this kind of compression, a single gradually decaying piano note.
Anyone know if this approach has any use in real-world scenarios?
Each "sample" is a small unit of sound: a piano note, a symbol crash, a snare hit, a single guitar pluck, etc. In most tracker music files, most of the space is due to the compression of the raw sample waves; only a little space is used by the actual arrangement of the music notes themselves.
https://www.youtube.com/watch?v=7MSFW8pZ-_4
It has a pretty distinct feel to it, IMHO.
https://www.youtube.com/watch?v=2yDVM77lGlM
Also noteworthy is that you can open these games' soundtracks in a tracker like http://openmpt.org/ to see the arrangements and play samples individually. I tried making music that way a while back and was sad that all my tunes sounded as shitty as the samples I was working with, then opened up the Deus Ex OST and found that his samples were worse, and he was working with fewer channels and filters; it's just pure skill in arrangement that makes the music so great :)
Some other good sites to look at:
http://modarchive.org/ - huge tracker music archive site
https://www.scene.org/ - demoscene information and archive
https://pouet.net/ - demoscene information and archive
Has that been tried before? Would be willing to spend a few evenings hacking on this myself.
Then you need to compress each of those individually.
The reason being that autocorrelation (and convolution in general) is meaningful when the input signal is linear time invariant. Read more about that here: https://en.wikipedia.org/wiki/LTI_system_theory#Impulse_resp...
It is certainly not a recently discovered or difficult concept to grasp, so if it was that useful I would think that it was already included in things like FLAC...
Btw, I like your handle. What kinds of things have worked on? You should post some links in your profile!