USB optical S/PDIF sound output for PC

Having successfully converted my buggered Pioneer PD-204 CD player into a standalone DAC with S/PDIF input, the obvious next step was to provide my PC with an S/PDIF output so I could play music off it through the stereo. This, of course, has to be optical, not electrical, in order to provide galvanic isolation, avoid potential problems with ground loops, and also avoid feeding epic amounts of crap and digital hash into the audio system so it sounds like the music is being deep fried, which is what happens when you connect a PC to a stereo with an ordinary electrical link.

And, in turn, the obvious way to do this is to get a sound card with an optical S/PDIF output. Only for the usual kind of shitty capitalist reasons things are not that simple.

The problem that immediately becomes apparent is of course that anything to do with audio is beset by pandering to the kind of fucking idiots who think that gold plated connectors on an optical cable make a vital difference to the sound quality and so does putting magic stones on top of the amplifier and all the other frantically moronic stupid fucking shite that makes these fuckwitted shits so trivially easy to rip off. The result is that sound cards with S/PDIF optical connectors tend strongly to be in the "complete and utter rip off" category and I'm fucked if I'm going to pay through the nose just because some people are so thick they need to be continually reminded to breathe.

There do exist a few sound cards with S/PDIF optical output that are priced sensibly - ie. similarly to a boggo network card or similar, which after all is doing much the same thing in a different format - but they also have an unfortunate tendency to be shite. And I mean genuinely shite, not the not using gold plated magic stones kind of shite. I mean that when you check out the datasheets for the chips they use, you find they do fucking horrible things like run the audio signal through a DAC, pass it through an analogue mixer and volume control block, then feed it to an ADC and feed the ADC output to the S/PDIF interface. Yeah, right, like, just no. That truly is genuinely shite.

Fortunately, there exists the Texas Instruments PCM2704.

USB PCM2704 adaptor modified for S/PDIF output
USB PCM2704 adaptor modified for S/PDIF output

The PCM2704 is a chip with a USB interface at one end and an audio output at the other. It has its own DAC and is used in dirt cheap adaptors, readily available on ebay for a fiver or so, that enable you to run headphones off a USB socket. But as well as the analogue output, it has an S/PDIF digital output - and, crucially, it does no processing at all on the signal it passes to that output. It just takes the raw audio data from the USB and whacks it straight as-is into the S/PDIF output. No fucking around with it whatsoever, either analogue or digital, just a plain straight pure copy.

These adaptors do not of course actually implement the S/PDIF output; they just leave the relevant pin (pin 5) on the chip unconnected. But it is a piece of piss to solder a wire from pin 5 to a suitable connector. (It looks like it's connected to pin 4 in the photo, but that's just parallax error.) A scrap of veroboard attached to the end of the gizmo provides a mounting point for a header, and connects the appropriate pins to ground (picked up off the headphone socket), S/PDIF out (very fine enamelled wire going to pin 5 of the chip), and +5V (yellow wire, which connects to the +5V pin of the USB plug). The black splat is a wee blob of a Chinese magic potion called "T7000 mobile phone glue", which is most excellent stuff, to hold the fine wire in place.

Some years ago I ordered something off Amazon - I can't remember what it was but I think it was a hard drive. When the package arrived, however, what was actually inside was a little adaptor to connect the S/PDIF header on some Asus motherboard to optical and electrical output sockets on a backplate. When I contacted the seller about this they gave me a refund and told me not to bother sending the adaptor back as it wasn't worth it. They actually said to throw it away, but of course I didn't, and it's been sitting under my bench ever since. So I used that to provide the optical output interface for the PCM2704. (It looks like someone made zillions of the things and then didn't know what to do with them, because there are still loads of people selling them on ebay and they're cheaper than buying just the plain optical socket on its own.)

USB PCM2704 adaptor and Asus S/PDIF output backplate
USB PCM2704 adaptor and Asus S/PDIF output backplate

So I put these bits together, plugged the gizmo into a spare USB socket and ran an optical cable to the DIR9001 board in the quondam CD player. And the LOCK light on the DIR9001 board promptly lit up, indicating that it was receiving a valid S/PDIF signal. Excellent. Now all I had to do was figure out how to make the computer route audio signals to the PCM2704 gizmo instead of the onboard sound output.

lsusb showed that the gizmo had been recognised OK by the USB subsystem:

Bus 009 Device 007: ID 08bb:27c4 Texas Instruments PCM2704C stereo audio DAC

and cat /proc/asound/cards showed that ALSA had also figured it out:

1 [DAC ]: USB-Audio - USB AUDIO DAC BurrBrown from Texas Instruments USB AUDIO DAC at usb-0000:00:13.0-3, full s

and after a bit of fiddling around I found that the appropriate invocation of play (from SoX) went like:

AUDIODEV=hw:1 play filename -r 44100 -b 16 -e signed-integer -L

which I stuck in a tiddly shellscript file to save me having to type it all out every time. The "1" comes from the entry in /proc/asound/cards, and the gubbins on the end ensures the output format is the same as you get from a CD.

Useful information: PCM2704 datasheet




Back to Pigeon's Nest


Be kind to pigeons




Valid HTML 4.01!