Ubuntu – Wine sound is played way too fast and crackles horribly

13.10wine

Sounds in my applications are played in super speed and are crackling horribly. In Spotify, the songs are actually playing at around 3x speed. I have Googled this quite a bit and all I can come up with is a bug report from January 2012 which is marked as closed.

I have tested Spotify and Hearthstone using PlayOnLinux with Wine versions 1.5.0, 1.6, 1.6.0, 1.7.0, 1.7.8 as well as the system Wine which is version 1.4.1. They all have the exact same terrible crackling sound issue. This leads me to assume that this is not a bug with Wine.

The steps to reproduce from the bug report:

Steps to Reproduce:
1. winecfg
2. go to Audio tab
3. Test Sound

Actual results:
crackling sounds produced

Expected results:
normal output

Are also producing crackling noises for me. While doing it, winecfg printed the following to the terminal:

p11-kit: couldn't load module: /usr/lib/i386-linux-gnu/pkcs11/p11-kit-trust.so: /usr/lib/i386-linux-gnu/pkcs11/p11-kit-trust.so: cannot open shared object file: No such file or directory
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred

(The first line showed up as I opened winecfg, the last 5 showed up when I clicked Test Sound)

Any clues what could be wrong? Let me know if I can provide any more information.


pulseaudio 1:4.0-0ubuntu6 amd64

Best Answer

Since this is the first result returned by Google, I'd thought I share my experience here. For those who look for a quick fix, put the following in your ~/.bashrc or /etc/profile for system-wide change:

alias wine='PULSE_LATENCY_MSEC=60 wine'

This is the same fix that's used for Skype and PulseAudio 4.0 and above, which is behaving the same way as wine. Hope this helps!

Edit (12.01.2016):

You can enable this variable globally by adding this line to ~/.bashrc and logging out/rebooting

export PULSE_LATENCY_MSEC=60

If you're experiencing audio issues in other applications after this, simply delete the line and logout or reboot. If you want to test it temporarily, open a new terminal and paste that line. Now every application that you invoke from this terminal will have the variable set and PulseAudio will set the latency.

More information on this problem and the 'fix': http://arunraghavan.net/2013/08/pulseaudio-4-0-and-skype/

Related Question