Printing Music

I explain how I set up MPlayer as a printer driver so I could add a distributed print queue for music. (AKA a JukeBox.)

In this day of 3D printing it's interesting to think about what can be printed in the future. In this post, however, I'll attempt regale you with what I have been able to print in the past. Nearly two decades ago I set up a service to print music–and I don't mean sheet music, but audible music played through my stereo.

I was using Linux and wanted to set up a networked music jukebox for playing MP3s and Ogg Vorbis files, but couldn't find any software to do that. (That I liked, anyway.) I seem to remember that with the best Linux-based player it was possible to list music to "play next", but that added things to the top of the playlist rather than at the bottom of the queue. It was also only useable locally.

Enter the Line Printer Daemon. This manages a queue of files for printing. You can use the lpr utility (it's what I used) to queue files to be printed, or to alter a previously submitted request. It's also networked, and provides an admin with the ability to manage the queue. (For example deleting repeated jobs.) I ended up writing lpd configuration and a few lines of shell script that acted as a printer. This "printer" would read files off the print que and use MPlayer1 to "print" them2. Voilá! I and other users3 could now "print" music through my stereo.

I remember trying a different app first, but MBPlayer's edge was that it introspected the byte stream to detect the file type, rather than rely on file name suffix. This meant it was able to handle situations where music was piped in rather than provided in a named file. (It also handled cases where .mp3 files had been labelled as .ogg so its owner could appear cool.)

Disclaimer

This transpired so long ago (1998-99) that I don't remember all the details. I cannot even remember whether it was my own invention or if I got the idea from someone else. Nevertheless it was a fun experiment at the time.

My endeavours was before the initial release Common UNIX Printing System (CUPS) and its filter system but it looks like it should be possible to do the same with that as I did back then. (And possibly rather a lot simpler too!)

Thanks

Thanks to Kristian Glass for reviewing a draft of this article. (And requesting that I write the post in the first place, after it came up in a conversation on Slack.)

1

Now probably known as MPlayerX? I haven't really kept up…

2

I.e. play music.

3

I say other users, but I was the only Linux user in my halls of residence and noone else ever used it.

Date: 23 October 2017

Author: Stig Brautaset

Validate