Inspiration

I love quines. Quines are basically programs that print themselves. Now, you may think of coding a program that opens another file containing the program, but that is actually against the rules of what defines a quine. "A quine must rely on itself to print itself". That's meta. Although quines have little practical use outside of their novelty, they are beautiful and there are actually some things you can do with a quine. You can make videos, audio, animations, etc. I've worked with quines before but to no avail, now I finally got a quine working, and it plays sound at that!

What it does

It's a ruby-scripted quine that plays music while it prints itself.

How we built it

The old method, from what I found, was to just use this arbitrary Linux directory called: /dev/dsp. This directory manages audio devices in Linux by directing audio to audio cards back in the day. Fortunately, this directory no longer exists in modern versions of Linux (if it did, it'd be a huge security risk). It was deprecated ~11 years ago with the end of Ubuntu 10.04. I don't have Ubuntu 10.04, and since I'm running Linux Mint 20, a LTS version of Ubuntu, I don't have /dev/dsp. What next? Well, I searched around and searched again and again until I found a StackOverflow post on /dev/dsp alternatives. I used this legacy package that creates a proxy of /dev/dsp via creating daemon. Using pulseaudio compatibility libraries in order to interface with the proxy, I was able to run the quine and play music. I felt so much pleasure flow through my body when I first heard the sound from my terminal. (These kinds of things excite me, you know).

Challenges we ran into

Well, the biggest challenge was finding a way to get /dev/dsp on my machine with the packages/libraries somehow. I tried booting up a VM of Ubuntu 10.04 on my machine but that didn't work because it was so damn old that I couldn't install anything on the machine because of an SSL error.

Accomplishments that we're proud of

I'm finally understanding the hidden power of quines. They can do so much more than what they may seem to be able to do.

What we learned

I learned how to create a quine in ruby, play audio via opening /dev/dsp and playing audio via terminal.

What's next for Musical Quine

I would've liked to create a more complex quine with more instruments or a bigger song, or even create a quine that plays music programmatically by converting a midi into the specific 'piano roll' notation that I have, but I didn't have enough time.

Simply delicious.

Built With

  • music
  • quine
  • ruby
  • tetris
Share this project:

Updates