I have managed to isolate this issue. It appears to be caused by the
loading/unloading of the sound controller.

If I play a test sinusoid through gstreamer-properties, I can hear it
distorting (clipping) from a fresh reboot. If I open up alsamixer while
the sound is playing and mute-then-unmute the "master" channel, the
sound comes back from the mute undistorted (correct!). If I stop this
undistorted test sound, wait ~10 seconds, and then play the test sound
again, it is fine (undistorted). If I stop the sound, wait ~20 seconds,
then start the test sound again, it is distorted (incorrect!).

To summarize, this procedure is as follows:
1) Play a test sound and hear it's distorted
2) Open alsamixer while the sound plays and mute/unmute the master channel ==> 
sound is undistorted (correct)
3) Stop the test sound
4a) Wait ~10 seconds to start another sound ==> undistorted (correct)
4b) Wait ~20 seconds to start another sound ==> distorted (incorrect)

I noticed that the parameter "power_save" for the snd-hda-intel device
is set to "15" by default. If I do "echo 0 >
/sys/module/snd_hda_intel/parameters/power_save", once I "fix" the
output using the mute/unmute trick, it works indefinitely (no distortion
after any amount of time). Setting the power_save back to 15 makes it
break after some amount of seconds again (probably 15).

Also, if I have power_save set to the default 15, if I instead set the
power_save_controller attribute to "N" instead of the default "Y", there
is no issue once I fix it once, either.

So it seems to me like the controller being unloaded after 15 seconds
causes it to be reloaded on next sound play. During this load (and even
during the first load), some setting is incorrect which causes clipping.
This can be fixed by muting/unmuting the master volume.

Thoughts anyone?

I have come up with a temporary workaround. Simply add the line "options
snd-hda-intel power_save_controller=N" to /etc/modprobe.d/options and
then run the commands (maybe in a script) "amixer set Master mute"
followed by "amixer set Master unmute" whenever you start up or resume
from hibernate/suspend, and the distortion doesn't show up. This is not
ideal, as it prevents the controller from going into a power save state,
and it's annoying to deal with putting in these commands, but it's
better than distorted sound.

-- 
ALSA SPDIF Digital ourput clipping / crackling during playback
https://bugs.launchpad.net/bugs/359361
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to