What You Need
The best way to transfer sound via HDMI is, surprisingly, using your video card. After all, one of the biggest advantages of HDMI is that you do not need to have numerous audio and video connections. Recent video cards, like ATI Radeon 3xxx and 4xxx series, as well as Nvidia's 9xxx and GTX series, include the ability to output sound. And they're not bad, either - compared with some of the finest sound cards available, there is no apparent difference in quality. In addition to these video cards, many motherboards using ATI or Nvidia integrated graphics have HDMI outputs which will put out both video and audio.
If you have one of the ATI video cards or a motherboard with HDMI, then you're done. These examples do not require any special connections. Simply place your video card in your computer, install the latest Radeon drivers, and you're set. All you need to do at that point is attach a DVI-to-HDMI adapter to the DVI port on your Radeon card, and then attach the HDMI capable that runs to your home theater system.
If, however, you have a Nvidia card, there is one extra step you need to take. Nvidia's cards can output sound, but they actually require a SDPIF connection from your motherboard to your video card in order to function. In other words, you have a SDPIF cable as a physical bridge between the connection on the video card and the connection on your sound card or motherboard. Once you've done that, however, you simply attach a DVI-to-HDMI adapter to use the audio.
Note that some video cards, particularly those aimed towards HTPC users , actually take out the need for an DVI-to-HDMI adapter by including a HDMI output standard.
Once the connection has been made and the video card drivers installed, your computer should be able to output audio via HDMI without issue. But the key word is "should."