I am using the soundcard "Asus Xonar STX" (PCI version) to output coaxial S/PDIF to my DAC near my stereo setup. I have configured MPD (Music Player Daemon) to play FLAC files from my digital music library. I have set up MPD so it will output RAW PCM to S/PDIF, so that no upsampling/downsampling occurs as well as the volume control in various MPD clients have no effect. This used to work just fine and my DAC indicates the correct sample rate. Wonderful sound...

However, in the last few days - all I hear is a heavily distorted version of the songs I play, even when the DAC is receiving the correct sample rate. I have tried both regular 16-bit 44.1 kHz and 24-bit 96 kHz files. The sound is distorted. So, I restarted my computer. No change. Power down and power up. No change. I also tried playing with VLC instead. Same distorted sound. I have no idea why this is happened since I have NOT changed anything in my kernel or ALSA related stuff. I was wondering if my sound card is broken, so I booted up Windows 7 and the sound was perfect through S/PDIF as it used to be in Gentoo. So it must be Gentoo-related. I have tried the low-level command "aplay" and playing WAV files at various sample rates and bit depth. Aplay plays the same distortion through S/PDIF.

How can that happen and what do I do? I have even done the same tests before I logged in on my Gentoo box in case that the desktop environment or web browsers could affect sound settings. Same distortion again.

Everything worked just fine a couple of days ago - I swear I have not changed anything in my system. No kernel updates, no new software, nothing.

The analog output to headphone from Asus Xonar STX still works like it should and the sound is not distorted. The problem is only S/PDIF, ALSA and/or Gentoo related.

Thanks in advance - any help is appreciated!

Last edited by pvh1987 on Thu Dec 20, 2012 10:58 pm; edited 1 time in total

I just updated my kernel. As I expected, it did not solve the problem.

So, I need to try something else. That could be to explicitly tell my sound card to output S/PDIF at a specific sample rate. In that way, everything played with a matching sample rate would come out undistorted, right? So, how do I do that? At least it could narrow the problem down so I can be more accurate in my search for a solution.

The command "aplay -l" lists the available sound devices in my system. The first two devices are the built-in on-board sound card on my motherboard. The last two is the Asus Xonar STX. I guess that the S/PDIF is the last device (1,1).

It would be nice to disable analog outputs on the Asus Xonar STX as well, so it will ONLY output through S/PDIF.

I still don't get how my computer suddenly outputs distorted S/PDIF since I have not changed any config file or similar. It used to work just fine. As I said in my last post - S/PDIF does work in Windows 7 on the same computer with the same sound card, with no distortion, at all sample rate settings - so, the sound card is definitely NOT broken.