I have built the most inconvenient way of playing music! It is lo-fi awfulness and cyberpunk grungy.
Thanks! I hate it!
As I discussed yesterday, it's possible to fit half an hour of speech on a single floppy disk. The best band in the world are The Beatles, and their shortest album is A Hard Day's Night - at 30 minutes, 45 seconds. Beatles audio was designed to be played over crappy AM radio in mono, so is well suited to being compressed using the latest audio codecs.
OK, I also got sent a USB floppy drive to review and wanted to do something interesting with it!
Compress your audio
A floppy disk can hold a maximum of
Using the Opus Audio Codec, you can squish audio to miniscule file sizes.
I got a single WAV of the album, and ran this command - which is about the best quality within the target filesize:
opusenc hdn.wav --downmix-mono --bitrate 6.7 --framesize 60 --discard-comments --discard-pictures --cvbr hdn.opus
That got it down to a trim
1,429,105 bytes. Enough space left over for some low-resolution cover art!
You can shrink the audio by a few more bytes by using removing the default metadata from .opus files.
How does it sound?
The copyright for Hard Day's Night should have expired in 2014. Sadly, the law was changed in the UK in 2013. So it doesn't expire for another 14 years. Here are some samples which I am using for non-commercial research purposes. This, I hope, falls under the fair dealing exception.
Not much worse than fading medium-wave station, right? RIGHT!?
(I've re-encoded it to MP3 in order for it to play in the browser.)
Sadly, the Pi Zero doesn't have an an audio out jack. But the USB floppy drive is pretty big, so we don't lose much space by going for a full-sized Pi. The Pi has a weird combined video / audio jack. I powered it using a USB Battery.
All held together with rubber-bands. Classy!
Here's a high tech block diagram:
🔋---→💻---→ 🎧 ↑ | 💾
Run these magic commands
I used Raspberry Pi OS Lite which doesn't have a desktop manager, and fits on a 4GB microSD card.
Set the audio output to go via the headphone jack:
Then choose: Option 7 (Advanced Options), then A4 (Audio), then 1 (Headphones).
Set the headphone volume to 100% (or whatever you fancy):
amixer sset "Headphone" 100%
Make sure you have the Opus tools and codecs installed:
sudo apt install opus-tools
Make sure that the floppy disk has been detected:
It will probably show us as
sda - mount it with
sudo mount /dev/sda /mnt
Go to the directory with your audio in it:
Decode the file and pass it through to
aplay - this should start playing music straight through your headphones.
opusdec --force-wav --quiet hdn.opus - | aplay
Depending on the speed of your drive, and the framesize of your audio, you may experience buffer-underruns. This will cause the audio to skip. Just like jogging with a CD Walkman!
I printed the album cover on a Bluetooth Thermal Printer.
- Build a circuit to let me press buttons to play, pause, and skip tracks.
- Make it auto-play when the disk is inserted.
- Use the Rockband Moggs to make acapella / vocal only disks. Should be better quality without the backing music.
- 3D print a case so I can go jogging with it while wearing a shell suit.
- Register a patent on the blockchain so people have to pay me a trillionth of a EdentCoin every time they play music using my brilliant invention.
Put your ideas in the comment box.
Huge thanks to Alistair for sending me a bunch of old floppies to play with.
Enjoyed this post?
If you like the silly things I do, you can say thanks by:
Or, just leave a supportive comment.