Pi 5 Becomes ALSA-Compatible TOSLINK Sound Card

This is one of those hacks that makes you stop in your tracks and say, “wait, you can do that!?” — before realizing, oh, yes, of course you can do that. With enough computational power, you can do a lot of things, and the Raspberry Pi 5 is a far cry from the single-board computer’s humble beginnings. In this case, the “you can do that!?” is both that [Oliver] was able to get the digital audio TOSLINK working via an LED tied to one GPIO pin on the Pi, but also the larger project that is embedded in: using the Pi as a full featured 8-channel USB sound card called Camilla DSP.

For the first one: the old TOSLink standard is very simple, and all you need to do is blink an LED quickly enough. Considering the clock frequency of the Pi 5 is in the GHz range and the TOSLINK is the same 3.1 Mbit/s S/PDIF signal you could pull off your CD-ROM drive to your Sound Blaster, there’s no problem there. Except, wouldn’t the operating system get in the way? Well, not when you have enough clock cycles to throw at the problem. Using a Pi 5 doesn’t hurt: the RP1 I/O chip included on the board is keeping things smooth with its included PIO while Linux mucks about in the background. There’s a reason we called it the most important product Raspberry Pi ever made.

As for making a USB sound card from an SBC — well, we’re not sure why that got the “you can do that” reaction. The Raspberry Pi family had ‘gadget mode’ for over a decade now, allowing you to present the computer as a USB device, so why not a sound card? That’s a valid class of USB device.

11 thoughts on “Pi 5 Becomes ALSA-Compatible TOSLINK Sound Card

    1. If you’re lucky enough to have an old garage door from before Chamberlain enshittified with DRM and removed dry contacts. Now my OEM wired opener button barely works ~70% of the time, and a DIY version would require cryptography tricks.

      1. It might be the button itself. You can solder wires to the pcb where the switch is mounted and connect an external button. Or an optoisolator driven by a microcontroller. Worked for me. And I relish the thought of sticking it to Chamberlain when I use it

      1. If the point is that it can output 8 separate spdif streams then that should be said in that way (in the article too). 8 channels in audio is also a valid way of talking about a single 7.1 audio stream so that isn’t a good term to use here.

      2. Actually, it’s a USB Audio DAC: I think the specs are that it can do 8 channels of analog audio output, or flash an led to do 2 channels (or stereo) of spdif output. Not sure what it would take to allow ADC analog or spdif input to the computer with this setup, would be interested to find out.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.