Playing Music with your PC-Speaker on Linux

If you are still a "fan" (It is just very useful to have when troubleshooting, OK?) of PC-Speaker (the thing that beeps at you when your PC starts) like me you defiantly wondered at least once if you can make noise inside of your OS with it. Turns out you can.

It is as easy as making sure that this file dose not exist "/etc/modprobe.d/nobeep.conf" which would disabled the speaker hardware for the normal OS, giving normal users access to it with this rule "ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="PC Speaker", ENV{DEVNAME}!="", TAG+="uaccess"" in this file "/etc/udev/rules.d/70-pcspkr-beep.rules" and after one reboot the fun can begin. (It is highly recommended that you use the Arch Wiki for all steps, rather than blindly copying the information provided: https://wiki.archlinux.org/title/PC_speaker)

There are some, not many, people who have created music for this purpose. There are even tools to convert music files into beep commands. beep is the software that gives you easy access to the speaker. The most common command converter is wavtobeep (requires: beep, python3, pip, scipy and sox), which converts wav files into a beep command. There are also some miditobeep converter out there (several with the same name). I have only played around with wavtobeep. It works great as long as you make the wav files mono and prepare them a bit (as little background noise and unneeded stuff as possible).

I linked a few cool things I found while researching in the Sources section.

One really cool thing you can do is to take a startup and shutdown sound (from Windows XP for example) and turn it into a beep command. Using wavtobeep I did this with an 8-bit version of it and when I turn my PC on or off it sounds like a old school Windows XP PC but the sound is coming from the PC itself lol. This was already annoying after a few times hearing it, but it was still funny. You could use any sound that can be reproduced with a PC speaker. So many possibilities :D. Unfortunately, I cannot provide the commands for them because of copyright. But I can linked to the 8-bit version I used to create it and you can go from there: https://onlinesequencer.net/932148

Thats it. Just wanted to share this funny beep thing I found.



Sources: