Geeks of a certain vintage will have fond memories of games that were simplistic by today’s standards, but drew one in all the same. Their low fidelity graphics were often complimented by equally low fidelity music being forced through the afterthought of a speaker that inhabited most computers. Despite the technical constraints of the era, these games didn’t just offer gameplay. They told stories, and they were immersive in a way that some would think wouldn’t be relatable to a younger generation.
That didn’t stop [Thanassis Tsiodras] from sharing the classic “The Secret of Monkey Island” with his niece and nephew when they were young. Excited to see his family after a year of separation due to COVID-19, [Thanassis] wanted to give them a handmade gift: The music from “The Secret of Monkey Island” on a custom player. What an uncle!
[Thanassis] could have just recorded the music and played it back using any number of chips made for the purpose, but being a long time software engineer, he decided to take the scenic route to his destination. First, DOSBox was hacked to dump the speaker output into a file. Python, C, and 30 years of experience were leveraged to squeeze everything into the 8 KB storage of an ATtiny85. Doing so was no small feat, as it required that he create a custom implementation of Huffman compression to get the data small enough to fit on chip. And when it fit, but didn’t work, even more optimization was needed.
The end result was worth it however, with the music from “The Secret of Monkey Island” playing in its original form from a speaker driven by the ever so humble but useful 2n2222. [Thanassis]’ site is replete with details too intricate to post here, but too neat to miss. Watch the video below the break for a demonstration.
Certainly the ATtiny85 is a miniscule but handy little creature. You may enjoy seeing it pressed into service as a game console, or even as a Spectrum Analyzer. Do you have your own ATtiny85 hack you’d like to share? Be sure to let us know about it via the Tip Line!
“And when it fit, but didn’t work, even more optimization was needed”.
Correct me if I’m wrong, but that’s bugfixing, not optimising… :-)
And giving someone that music? Pure evil, it’s one of the most pervasive earworms ever!
Ok, I’ve read the (excellent) write up, and I see what you mean.
A gift for your enemies then?
The year was 1675. We were on a course towards the wreck of The Rattling Phlegm.
Our days were filled with songs of the voyage and the untold riches we’d find at our destination.
Two months into our journey, we realized something was horribly wrong. We were all stricken with a melody…
…a diabolical song that I shall never forget.
All too catchy for a crew of fifty men confined to a ship hundreds of miles from port.
No one could think of anything else, and many threw themselves into the sea rather than hear any more of the incessant humming.
We returned with but eight of our crew left.
The doomed voyage of The Obsessivo-Compulsivo will haunt me forever.
— Edward Van Helden, on the Monkey Island™ theme
Really nice work and documentation effort! I can see using this myself as a gift to friends and family :)
Maybe you can first extract the notes such as in MIDI for further compression
Isn’t that what he did?
I just realized why I always hated musical cards, it’s just because music is crap. Turn them into such 8bit wonders and I’ll deplete the batteries listening to them… and actually enjoy getting one for my birthday obviously.
Nice work Thanassis!
I wonder why he didn’t convert the frequencies to note numbers, delays to the smallest representation possible while still maintaining reasonable timing. It probably could be squeezed into a single byte, note and delay. 5 bits for 32 notes (2.6 octaves) and 3 bits for note length or something. Maybe a header that can transpose the octaves up and down depending on song. Then use a lookup table for note number to frequency.
But nice project nonetheless, and kudos for using the Monkey Island score, it’s a true classic!
You are 100% right, this seems like a very convoluted way to tokenise the raw frequencies instead of turning them into conventional notes and note lengths. The problem domain is quite small and could be manually encoded into something very straight-forward. Huffman coding is a generalisation of this process that works on arbitrary data, but the data here is not arbitrary at all.
A binary version of RTTTL, if you will…
I want to be like this person when I grow old, seems like he had a lot of fun while making this
Is it me, or has the alliteration of the titles been ramped up even more recently?
Now do the theme from Leisure Suit Larry…