Many consumer-grade computer sound cards (including ones built in to the motherboard) have digital S/PDIF outputs, however not the high quality outputs found on professional audio equipment. In my music server I have a SoundBlaster Audigy2 connected to my Sony surround receiver using a RG-59 coaxial cable from the 1/8" mini S/PDIF connector on the sound card to the digital audio input on the receiver.
This works great, however when the cable is connected a hum can be heard through the speakers, not mattering what input is selected on the receiver. In my experience with professional analog audio equipment, I instantly recognized it as a ground-loop hum. For those without electrical engineering degrees or unfamiliar with ground-loop problems, a ground-loop in an undesired effect occurring when there is a grounding potential difference on the main power supply of two separate devices and when a cable connects the two devices, connecting the devices' ground planes which will cause an electrical current to flow over the wire connecting the two grounds. This potential difference, although usually very small (in my case, less than a volt) can be amplified in analog sound amplifiers and heard in the speakers as a 60Hz hum. Even though we're using a completely digital audio connection, a ground-loop is still created because the shield of the coaxial cable used connects the ground plane of the PC with the ground plane of the Sony receiver.
For a while I considered getting some extra equipment to use a Toslink optical connection between the computer and the receiver, but instead I decided to apply some knowledge I had used when working with professional audio equipment, and that is inserting an isolation transformer between the two devices. Obviously, since this is a high-speed serial digital data connection and not an analog audio connection, we're going to have to think about this a little bit.
It turns out that we can fix this problem very easily, and probably with parts you already have lying around.
Step 1: Getting Things Together to Make a Better Cable
With a little research I found out that high-end professional gear comes from the manufacturer with an isolation transformer built in to the S/PDIF output which completely separates the sheild of the digital cable from the ground plane of the device. We should be able to simply modify our cable to include such a transformer near the output of the sound card.
What we need is a pulse transformer -- a transformer which is designed to transmit digital signals -- and one which is capable of at least 20MHz to support our 192kHz PCM S/PDIF audio signal. With a little thinking outside of the box, we realize that every computer Ethernet card has one such transformer to galvanically isolate the network interface circuitry from the transmission medium, the Ethernet cable. All we need to do is find an old 10/100 Ethernet network card and steal its pulse transformer -- I had an old AMD PCnet 10/100 card lying around which had a Pulse-brand transformer on it. Most common on Ethernet cards are Pulse or Bel-brand transformer. Any transformer suitable for FastEthernet should be suitable for our S/PDIF needs.
Just salvage this transformer from your old Ethernet card, grab a soldering iron, some solder, a knife and a side cutter, and you should have all you need to get on your way to digital audio bliss. It will also help to search the Internet to find a datasheet with a schematic of the internals of your particular pulse transformer so you know what pins to connect your cable's conductors. In my case, I found out I needed to connect the sound card side of the transformer to pins 15 and 16, and the receiver side of the transformer to pins 10 and 11. Because we're dealing with an isolation transformer, it doesn't much matter which pins we connect the shield or the core -- although if you can, you should try to match up shield-shield and core-core leads on the transformer. In my case, I attached the shield to pins 16 and 10 (the "top" leads) and the core to pins 15 and 11 (the "bottom" leads).
Step 2: Putting It All Together 1/2
Now that we have everything we need to accomplish this amazing feat of digital audio goodness, simply cut your digital cable as close to the sound card side of the cable as you are comfortable doing. Strip the cable to reveal the shield and core conductor of each side of the cable. I bent the leads of my cable so that I could more easily put the assembly in a small plastic case I had lying around when its all said and done.
Step 3: Putting It All Together 2/2
So, now all we have to do is solder the cable's leads to the correct leads on our pulse transformer. With a little clean up, anyone else would swear it was supposed to be there!
Step 4: Conclusion
Now all thats left to do is plug it in and test it. The first time I did this I was quite afraid it wasn't going to work, as there was absolutely no noise from the speakers when I plugged the cable in to the computer. Completely silent. I clicked play in my favourite music player on the PC, and I was instantly transported to a place where Rush is played in crystal clear audio throughout my living room. Success!
If you're lucky enough like me to just happen to have a small plastic case lying around which is suitable to encase your latest electronics project, just cut out some holes for the cable and snap on around the simple passive device.