Using S/PDIF to send audio from your PC

The following is an article from another of my colleagues on the Windows Vista Sound team, Kristin Carr.  Kristin is a Program Manager and works with Steve Ball, who previously has shared his insights into how Windows Vista handles sound.  If you have questions for Kristin, please leave a comment below.

Many people have a general idea of what S/PDIF is -- perhaps by seeing it as a label on an audio output, or on a feature list for a product.  But what is it exactly, and how do you use it?  This post will cover some of those details.

On a PC, the audio is stored and processed digitally until the final output stage when it is usually converted to an analog signal that directly feeds your speakers.  However, there may be times when you want to transmit the signal digitally to a different device that will be used to play the sound, such as a receiver.  In these cases, you may want to postpone converting the signal to an analog one, and instead transmit the signal digitally to avoid any degradation and additional noise that may occur when transmitting an analog signal.

For this purpose, S/PDIF (Sony/Philips Digital Interconnect Format) was developed.  Often referred to by the name of the connector (including Toslink, RCA, or simply "Optical" or "Digital Out"), S/PDIF specifies a method of transmitting a digital signal so that it can be received and interpreted correctly by the connected device.  You may ask yourself, "How complicated is it to transmit a signal?  Why do we need a special protocol?"  Consider that the digital signal consists of a series of bits, and within that series, the bits are grouped to correspond to a sample of audio, and an even larger subset of those are grouped to correspond to a particular channel.  In order to enable a receiver to properly interpret all of those bits in the correct order, it is necessary to have a format for transmitting those bits.  This is where S/PDIF comes in.

S/PDIF can be used to transmit two channels of digital audio in real time over a single connection.  S/PDIF specifies a particular bit pattern that a receiver can use to latch onto the stream.  Once the receiver has synced up with the stream, S/PDIF specifies the order of the audio bits and how they should be arranged in a stream so that the receiver can properly interpret it.

However, there may be times when you wish to transmit more than two channels of audio over the S/PDIF link.  This is where compressed audio can be used.  Audio compression is a technique used to transmit equivalent information using fewer bits.  This is done through a number of techniques.  Some techniques, referred to as perceptual coding, take advantage of the fact that humans can only hear certain sounds.  These methods of compression usually involve discarding bits that only contribute a minimal amount to what a listener needs to recognize a given sound.  Other methods take advantage of numerical redundancies in the signal in order to effectively transmit the same information in a smaller amount of space.  Dolby Digital and DTS are two common types of compression.  Regardless of the technique, compression enables a digital audio signal to use fewer bits to transmit the audio.

The result of this compression is that it enables you to transmit the content for up to 5.1 channels of audio over S/PDIF in space that would have only fit 2 channels if the audio had been uncompressed.  This is great once the signal has been encoded (synonymous with compressed), but once a signal has been encoded, that same signal must also be decoded after it has been received so that it can be sent to speakers.  This means that your receiver must be capable of decoding the compressed audio signal in order for you to hear the correct sound.  This is the tradeoff necessary to allow you to transmit more than two channels of audio over S/PDIF.

Another direct consequence of transmitting a compressed audio signal instead of an uncompressed audio signal (more commonly known as PCM) is that the volume of that signal cannot be modified once it has been encoded.  Because the bits in an encoded signal no longer directly correspond to the volume of that signal, it is impossible to increase the volume until it is decoded.  This explains why your PC cannot control the volume of your sound when you are using Dolby Digital or DTS as the output.  The connected device will be the only place where the volume can be changed.

To recap, in order to avoid the electrical interference and noise present on an analog connection, consider using S/PDIF to transmit the signal digitally.  If you'd like to transmit more than two channels, consider sending encoded content which allows you up to 5.1 channels over S/PDIF.  You may also want to consider HDMI, but that's a post for another time!


Comments

  1. Posted on: July 30, 2008 at 8:02AM  

    Guys, I just replaced my old dimension with a dell xps 630 with vista.  My prior setup had the digital output (s/pdif) running into my home stereo while at the same time running my 5.1 computer speakers.  It was nice, they sounded great together or separate.  Now I am told that due to piracy concerns this is no longer possible.  I think I have a realtek sound card.  My computer has s/pdif, analog and Hdmi outputs.  Any suggestions?

  2. Wendy
    Posted on: November 01, 2008 at 3:08PM  

    When playing songs on my computer,  I can hear through both speakers.  But when playing songs into paltalk or yahoo rooms, the sound from only one speaker is transmitted, greatly affecting the sound quality I'm sending.  This is especially true for older songs that were meant to play different sounds/voices on different channels.  Is there any solution?

  3. Tim
    Posted on: March 25, 2009 at 2:10AM  

    Good info,

    PC: Gateway GZ7220

    OS: Windows Vista Home Premium 32-bit

    Sound card: IDT High Definition Audio

    Amplifier: Peachtree Decco

    Speakers: Vienna Acoustics Bach Grand

    Settings:

    Formats supported

    DTS Audio (no sound)

    Dolby Digital (default; works)

    Micorsoft WMA Pro Audio (have not tried)

    Sample rates:

    44.1 KHz (only one that works)    96.0 KHz (amp supports)

    48.0 KHz    176.4 KHz

    88.2 KHz    192.0 KHz

    Level: set @ 24

    all enhancements disabled

    Formats:

    only 16 bit 441000 Hz works but

    44100, 48000, 96000, & 192000 Hz available in 16 & 24 bit

    I use toslink to connect to my amplifier, USB worked for awhile and then suddenly produced static, digital coaxial (digital audio) produced a hum, it was nice having multiple options. The only problem I have is not being able to use any of the sampling rates other than 16 bit 44100 Hz, my amp supports 16 bit 96000 Hz pcm when I set the default format to anything else there is no sound (not even when I click on the "test" button). I believe I can get better sound quality than what I get currently. I mostly listen to soundscapes (meditative/classical) and smooth jazz via music choice (internet)

    Any suggestions on what I should do to get optimum sound quality from this configuration?

  4. Posted on: November 10, 2009 at 11:29AM  

    Vista/Win 7 Audio Stack and Room EQ questions…

    1. Any easy way to get bit-perfect output via USB, FW, S/PDIF?

    a. People on the forums are clamoring for this, and are presently running into various issues with third-party drivers (Lynx, M-Audio) not really being up to speed in Win 7.

    b. This approach allows doing PCM, 16 and 24 bit HDCD decoding, etc., externally, and thus people with expensive DACs will feel they’re getting their money’s worth .

    2. The room EQ and related features are tremendous. And they’re even available in the Windows 7 starter edition! Imagine, a $359 HP mini as a digital media server, but it works. The beneficial effect is clearly apparent. I’m using a calibrated microphone and medium-level electronics in my office; moving this to the reference system will be very interesting.

    a. Is HDCD content be decoded “prior” to going through the EQ?

    b. In other words, can the room EQ take advantage of the extra quality available in HDCD encoding?

    c. Is it possible to export the EQ settings to another computer? The laptop used to make the measurements might not be the one used as an audio server, even though the DAC will be the same.

    3. Are the effects of room EQ, etc., once set up for the main USB audio device, also available via S/PDIF?

    a. There’s a mysterious “disable system effects” check box there, and we’re wondering what it does?

    b. I personally would rather do the EQ in the computer, and from there, to the DAC.

  • Page:
  • 1
  • 2

Trackbacks

  1. Posted by: Ian Dixon's Blog on March 05, 2008 at 4:04AM

    Have you ever wondered what S/PDIF is and how you can use it to connect up your Media Center PC to your

  2. Posted by: how to sell digital products on ebay on July 31, 2008 at 11:01AM

    Fujifilm is one of the leading providers of imaging and information products. Fujifilm and its employees are committed to providing consumers and professionals with the most innovative and highest- quality imaging and information products and services.