Link shorteners have been a staple of the online world for over two decades now, but theyβve got some issuesβ for one thing, itβs totally non-transparent where the link actually goes, leaving you open to all sorts of shenanigans, of which RickRolling is probably the best case. For two, your traffic is going through an external service who may have their own nefarious intent. [PortalRunner] had an idea: donβt shorten the link, but compress it.
You see, a traditional URL shortener like tinyurl just generates a random code and associates that with your original link in its database. Thatβs fine, but youβre relying on a third party database. The alternative is to take the URL, encode it in some way, and apply some compression algorithm to the data. If the encoding and compression are open-sourceβ which [Portal ]βs absolutely areβ then you can check yourself before following the link, and/or self-host the whole thing for piece of mind. As a bonus [Portal]βs Ha.mrβ thatβs pronounced Hammerβ also gives you a QR code optimized for easy scanning. QR codes have a specific alphanumeric character set built in, and it isnβt the full UTF-8β if you naively use random text, youβre in byte mode, which needs a lot more QR real estate. Or inverting that, the fewer bits it has to store, the easier a qr code is to scan at the same size. The text version of the compressed links can use UTF-8β including emoticonsβ but they donβt have to.
The whole project has a βwhy isnβt everyone doing it this wayβ vibe about it. Weβd probably want to self-host this if we were using it seriouslyβ [Portal] put this together on a lark and makes no promises it will be online foreverβbut again, this is open source, so we can. [Portal] is using normal compression algorithms here, but if you really want to squeeze text, use a neural net.Β
Some projects seem too good to be true until you dig into it and find the secret magic that makes it all work. Take Paper Tunes by [Makestreame], a project which purports to store a song on a single sheet of paper via QR code and transmit the data over LoRA. If it was a MIDI sequence, maybe. But the promise of Paper Tunes is to take any MP3 and give it this treatment, and that just seems like an impossible level of compression at first glance.
The music is heavily compressed, make no doubt about that. Thereβs samples in the Instructables link above and in the video below, but it sounds far better than it has any right to. The secret is Metaβs EnCodec neural codec, which like youβd guess uses neural nets to squeeze the absolute minimum information needed to reconstruct a sample. With it [Makestreame] is able to get a 2.9 MB MP3 file down to just 21.44 kB.
Of course, thatβs still not going to fit in a 3.3 kB QR code. But by simply making eight of them, [Makestreame] is able to fit the song onto the front and back of a piece of paper. Yes, each song has an βAβ and a βBβ side β and you thought flipping a record halfway through got old fast. Having to scan eight codes to get one song may strike some as a bit silly, but we do enjoy some silly things here.
The same EnCodec compression that gets the song so tiny as to fit in a brace of QR codes is obviously also what enables its transmission over LoRA. While itβs got far lower bandwidth than something like WiFi, 21 kB is well within its limits. Itβs often said that LoRA isnβt suitable for audio, but this project is another example that one personβs βunsuitableβ is another personβs βchallenge acceptedβ.