Wine Sound Troubleshooting

According to Winehq Bugzilla entry 10495, As of Jun 09 there no longer is anyone actively maintaining the code for sound in Wine. Also it is known that the architecture for Wine sound needs improvement. Volunteers/patches for any improvements are welcome.

[Ed. It may be interesting to write a new driver, but what wine needs is to fix the existing system for sound. The sound architecture in Wine has a long history, and needs to be upgraded and fixed first] Stefaniuc: winealsa is a copy of wineoss.drv hacked up for ALSA. wineoss.drv using the OSS compatibility interface in ALSA was for many years the better driver than winealsa.drv using native ALSA. [...] winmm has Win16 ancestry and was hacked up in Wine for Win32. I really really doubt that a modern Windows still uses the same stuff for the low level audio stuff; the DSound from DirectX 5 is a prime example.

The "vision" is easy and clear. Move audio in Wine to use the same subsytems/APIs like [more recent versions of] Windows [do].

M. Stefaniuc [wine devel 07 oct] There are already a couple too many sound drivers in Wine and none of which are great. Alexandre [...] would like to have one sound driver working perfect (probably winealsa). Vitamin [Oct09] One of the main reasons Wine runs so many applications is a simple policy
implemented number of years ago of not accepting hacks. [Presently the PA patch is more of a hack..] then a correct working solution. Alexandre said this many times - he has no major issues with PA driver as long as it works _better_ then, and solves problems of what Wine already has. Adding just another driver that happen to work for some programs, is not acceptable. You might as well fix ALSA/OSS instead to work better with PA (if at all possible).

Update: since the last 2009 wineconf, there appears to be progress toward rewriting sound. Unfortunately this will involve large changes to wine, which may give occasional sound problems. Winehq Bugzilla entry 10495 getting the Open AL support into Wine [..] was discussed late last year Winehq Bugzilla entry 21598 setting mmdevapi to disabled [may] help [using winecfg]

M. Lankhorst: reported about the new sound api: Currently it's at http://repo.or.cz/w/wine/multimedia.git/shortlog/refs/heads/mmdevapi but I
will clean it up, split it into separate patches and merge it back to wine slowly. [...] However, this code means that it should eventually be possible to port dsound over to use openal, after mmdevapi is done.

Avoiding Hum

A user reported: there's a lot of humming noise on the input, a lot more than there is in Windows.[...] I'm wondering if there's anybody else with similar experience?

Vitamin [sept 08 wineusr] Make sure all inputs you don't need are muted (not just volume down). The biggest offender is line-in. But lots of cards have number of AUX inputs, CD-in, and so on.

New Sound Drivers

A user suggested a new sound driver: I would like to suggest that eventually Wine would support PulseAudio as a sound output natively. I am already aware of Wine supporting ESD, which PulseAudio can use, but supporting PulseAudio natively I think would be much better.

M. Stefaniuc [wine devel 07 oct] There are already a couple too many sound drivers in Wine and none of which are great. Alexandre won't accept yet another sound driver in Wine. He would like to have one sound driver working perfect (probably winealsa). [..] and these problems in the core sound architecture [will not be] fixed by adding yet another sound plugin based on an incorrect core.

PulseAudio

PulseAudio Issues with Ubuntu and Fedora
With pulseaudio, if Ubuntu and Fedora package maintainers do use the non official pulse audio patch, then they are accepting the responsibility to manage any bugs or technical support relating to Pulse and Wine. Users with prepackaged winepulse drivers that post on the WineHQ forum, users mailing list or IRC channel will, of course, be [..] sent to the relevant distro-specific forum.

One developer has added a bug report with work for Pulse Audio in Winehq Bugzilla entry 10495 However the bug report also notes there is non official wine-pulseaudio-1.1.12-1.fc10.rpm for Wine 1.1.12 in Fedora 10.You can find his latest version on his web page. You may need to compile it.Do not comment in this bug unless you are expecting to write some code. Due to the many posts which are not adding to development on this bug, it is in danger of being closed. A. Julliard wrote: Yes, Wine needs to work with PulseAudio, we know that, we are not complete idiots. It's being worked on. If it's not going fast enough for you, pitch in and help. If you have questions take them to wine-devel.

If any further messages are posted to this bug I'm going to close it, and revoke bugzilla privileges for the offenders. Enough is enough.

Judging by some developers comments this will not go into an official wine release in it's current state, but at least it is a start. S. Dossinger [Jun 09] Art has done the right thing. Instead of complaining he has actually done some constructive work to fix the problem [with a Pulse Audio driver]. Unfortunately there were technical issues with it [..] Winehq Bugzilla entry 10495 Again, for anyone attempting to fix this bug: This is not a weekend's
task, expect it to take a while, and expect to run into setbacks in the form of incorrect and not accepted solutions. And don't get distracted by flamewars. And you may have to get patches accepted by Pulse, which probably has its own challenges.

May 09 a user reported a bug with Wine which was identified to be caused by pulse audio in Winehq Bugzilla entry 18648 but the user was unable to uninstall pulse: It is impossible for me to remove this one libpulse0, because it means to remove full kde4.

D. Timoshkov advised: Then report the bug to pulse and kde developers, because it's the libpulse which crashes, not wine code.

Jul 08 wine devel a user wrote: I switched my desktop to PA yesterday, [...] All apps that I need use PA natively, only Wine doesn't have a PA sound driver.

S. Dossinger: The point was and is that we don't want yet another half working sound backend in Wine. We will have to maintain the Alsa one because there are things PA won't be able to give us by design, like HW mixing and lowest-latency direct access which is needed for gaming. Of course, as you said, if someone has patches and intends to maintain it we're happy to accept it. But I think none of the current Wine sound developers(aka Maarten) has any intentions to spend time on a PA backend

R. Colenbrander [Jun 09]: we would like not to have a pulse audio driver if it isn't needed[..]. Some suggestions have been made to use some pulseaudio rules of thumb in our winealsa code to improve the situation. This is likely not doable for some of the stuff [...] but fixes in that area could already improve winealsa <-> pulse interaction a lot. Remaining issues might be solvable in cooperation with the pulse developers.

S. Dossinger [jun 09] there is no current maintainer for the Alsa code, since Maarten Lankhorst stopped regular work on Wine. That's why we know what's wrong [..] and nobody [has] fixed it. So I invite everyone who wants PA working to volunteer to take over maintainance of the sound code. Winealsa, dsound and winmm need a maintainer. Before they have one, [loud comments] about PulseAudio go to /dev/null because nobody feels responsible to listen to them.

B. Klein noted that wine is moving to OpenAL for sound: Wine will be able to support pulse via wineopenal.

=Stopping Pulse

A. English regarding ubuntu: There are currently two ways, remove pulseaudio from your system, or manually patch Wine with the winepulse driver patch.

S. Cragin: You probably need to disable pulseaudio, at least temporarily. Here's what I do.

sh winetricks sound=alsa

edit /etc/pulse/client.conf [and ] change:

# autospawn=yes

to

autospawn=no

Then in your startup preferences, uncheck pulseaudio. Or, alternately, just run the following in terminal after you boot up.

killall pulseaudio

That should do it.

ALSA

Winehq Bugzilla entry 18856 Wine uses default ALSA card and does not work with any other sound card unless explicitly configured to do so.

MIDI=

The MIDI mapper is set to Wine Midi Mapper in TablEdit (it doesn't work if set to Port 0 either).

vitamin feb 10: On most systems to have MIDI sound you need to run software MIDI emulator such as timidity.

Wine and MIDI with ALSA

A user asked how to route MIDI in a Windows application through to the (working) ALSA MIDI devices.

Here's the answer for wine-20050628. You need to load regedit and then create the following keys:

Create HKCU\Software\Wine\ALSA, and add two string values:

"MidiPort"="72:0"
"PlaybackDevice"="default"

72:0 happens to be the MIDI serial port on my machine. If you are using Timidity, it should probably be 128:0. The command pmidi -l should provide you with a list of available ports.

Create HKCU\Software\Wine\Drivers, and add a string value:

"audio"="alsa"

If the keys already exist, just modify them. In fact, I'm not sure that you necessarily need the ALSA key, but I haven't tried it without. The other key is essential though. Wine Archive

Alsa mixing

C. Robinson [jun 09] [ALSA's] 'default' device will use dmix by default on cards that need it, and use hardware mixing when possible. But even if not, you can make a ~/.asoundrc config to override ALSA's 'default' device to use dmix:

pcm.mydmix {

type dmix

ipc_key 1024

ipc_key_add_uid false # let multiple users share

ipc_perm 0660 # IPC permissions (octal, default 0600)

slave {

pcm "hw:0,0" # whatever hw output device you want

rate 48000

channels 6 # use this for 5.1; you can set whatever you want

period_size 1024

buffer_size 8192 # could set this lower, but Wine doesn't like it

}

}

ctl.mydmix {

type hw

card 0 # the same card as the one listed in the pcm slave above

}

pcm.myasym {

type asym

playback.pcm "mydmix"

capture.pcm "hw:0,0" # same as the pcm slave in mydmix

}

pcm.!default {

type plug

slave.pcm "myasym"

hint {

show on

description "ALSA Default"

}

}

Then use 'default' or 'mydmix' in your ALSA apps. [..] PulseAudio is [not] needed to get sound from multiple apps.

OpenAL

A user posted Dec 08: There have been several efforts of creating an OpenAL backend for Wine. Shouldn't this solve many of the issues?

Vitamin:there were few. But they won't solve everything. Last time I've checked state of OpenAL on Linux is was horribly lagging behind Creative's OpenAL on Windows. Also there are no native OpenAL drivers for Linux so not everything supported by hardware is available.

The user asked: Have these projects been abandoned?

Vitamin: Pretty much.

MP3

If your version of wine does not play mp3, wine may have been compiled without it's support because of patent concerns. Winehq Bugzilla entry 20277 Presumably they're disabling mp3 support, possibly because of patent issues. Check is the '--without-mpg123' configure option is being used.

USB mic configuration

Winehq Bugzilla entry 12706 Comment #12 [Mar 09] 03-31 This is still an issue in wine 1.1.18. USB Microphones in alsa have *only one* control, and it is the microphone control. They have zero output/master controls, which wine seems to require. Using the following '.asoundrc' file, i can specify a new default pseudo-device that has my speakers as an output and the USB mic as an input:

This functions as a workaround and my mic works fine in wine. Use 'aplay -l' to get device IDs (instead of 0,0 and 2,0, yours may be different). You can also set a specific name for this pseudo-device (instead of !default) and then select that new device in winecfg.

A patch was suggested in bug 12706. A. English recommended for it to be submitted and possibly included in wine. This apparently lists the speakers as an output visable in winecfg.

Sound Tests

In May J. White [May 06] pointed to a post by R. Reif: The task is to perform a basic test of Wine's audio support to make sure it's a stable platform for us to build upon; what a great way for all you lurkers to help us out <wicked grin>.

The basic procedure is - get a current version of Wine, test the sound, and send the results in. It won't take long (took me ~30 minutes), and it'll be very helpful.

More details:

Checkout Wine from CVS or git

Figure out if you're using OSS, Alsa, or Alsa in OSS emulation mode (lsmod is your friend, and winecfg is quite nice as well)

As it runs, you should hear a nice steady set of soothing beeps, all at the same pitch and duration. If you hear any variation from that, make a note of it, so you can report it. It's important to listen the whole way through; a tad boring, I know, but important; it'll shift to a virtual device half way through and it's important to hear if it keeps on working or not.

Report your results:

Pack up your output files, and report your results along with your sound driver info. Failures are obviously the most interesting, but success on not previously validated hardware/driver combos are likely to be useful too.

Tested under winealsa, as well as wineoss with OSS emulation All sounds played flawlessly. Alsa runs reported 0 failures. OSS runs reported 48 failures; not clear if that was relevant Only anomaly is that the modem driver is treated as an OSS sound card, and so has a number of flawed attempts to play against it Full log files of the runs attached.

T. Booker: [Please when posting to the list, do not cut and paste your console output] I cannot read it in my gmail web interface,[...] Again, I ask everyone to please attach console output, do not paste it in
either bugs on bugzilla, nor here. wine archive

Wine Sound Troubleshooting using the WineTests

Wine Archives
F. Gouget: Sound depends a lot on the sound card. Some sound cards support only specific sampling rates while others are more accommodating. And that's just one issue. For the Wine operating system, side there are a number of other issues such as mmap support, full duplex support and DSP_GETOSPACE support that vary from one sound card to the next (and to some extent varies even from one Alsa configuration / OSS emulation version to the next), all of which cause problems with sound.

Wine sensitive to these issues, even more so if the application uses DirectSound. Part of this is because the Windows API is painful to emulate, but another part of it is the lack of debugging of basic sound. Unfortunately, debugging supposes one has a sound configuration that does not work which makes it even trickier.

What this means is that each Wine developer who has sound problems can essentially only count on himself to debug them. To help these ones I would recommend the following steps:

R. Rief: [May 06] There is a bug in the wave test and I just submitted a fix so please retry with CVS once the bug fix gets committed. wine archive

Wine Sound Forum Comments

A developer noted [Jun 06]: I have started work on an openal driver for wine... So far I have playback and recording working (with minor issues) (for some reason the DSound HEL is unhappy with my driver) wine archive

A poster asked: if MIDI is supported under wine?
E. Pouch [May 06]: Midi playback and record should work fine with both OSS and ALSA drivers, and is not supported with the other drivers. wine archive

M. Hearn [Apr 05] Posted the latest version of his patch for improving sound and added: I think I will investigate this a bit more, but perhaps later. For now this is fine for RPMs and packages etc, which install to /usr, as they can simply "chmod +s wineserver" and have apps with solid audio. wine archive

A Very long thread devoted to improving wine and sound is found in the April 06 Wine-devel Mailing list. For example C. Kolivas commented: Apart from legacy, is there a reason you haven't moved en-masse to alsa? It is the only supported driver in current kernels now. Talking to oss, the oss compatibility module or worse through a sound driver like esd, arts, gstreamer, jack... etc just adds more potential for desynchronisation. wine archive

No sound

Wine user feb 10 I don't get any sound in wine: Audio test failed. Maybe some other app caught the audio driver?

Vitamin: Yes, find which one is it and kill it:Code:

lsof /dev/snd/*

Surround Sound

wine user Aug 08 asked about if wine supported surround sound.

A. English: No one with the coding skills required to implement it needed or wanted that feature, so it hasn't been done.

Filing Bugs

If you find a problem has developed with sound one developer noted [Oct 07 wine devel]: Have you considered filing a bug report, and do a regression test? It's easy to do and would allow you to find the exact cause of the glitch, and if it's obvious you could even fix it yourself. [otherwise fill out a bug report for the crack bug zapping team]

In the .wine dir there is no longer a config file. How does one change the sound driver type if there is no config file?

J. Hawkins: We are in the process of removing the config file so we don't include it in .wine by default anymore. [It is available in the cvs attic, but has been superseded by winecfg. Update aug 08, winecfg has replaced the winecfg and wine has progressed so far since the config file, it is unlikely you would even consider using such an old version of wine]

As the config file has been obsolete since June 2005, this message will need updating. Apparently a cvs comment mentions a registry key to be altered: Software\Wine\AppDefaults\app.exe\DirectSound.

A User then asked: I can't see where "app.exe" is added to the key; should the comment be fixed?

H. Bostick: I haven't looked at the comment, but I think that "app.exe" is meant to be an example, and "app.exe" is meant to be replaced by the actual name of the executable in question (i.e. Software\Wine\AppDefaults\Starcraft.exe\DirectSound), in order to make a per-application setting that will relate only to that particular *.exe, and not all the others you may run.

W. Pettersson: You can also set the global preference in CURRENT_USER\Software\Wine\DirectSound. Just make a new string variable called "HardwareAcceleration" and give it the value "Emulation".

Terrible Sounds with "HardwareAcceleration" = "Emulation"
--ibr 11:45, 11 Jul 2005 (PDT) I had terrible sounds (like a radio not tuned on a particular station) after playing StarCraft for a while with "HardwareAcceleration" = "Emulation". I could solve the problem using ALSA. I removed "HardwareAcceleration" = "Emulation" from .wine/config, configured ALSA using winecfg, and created the following entries in /dev/snd:

M. Hearn: Try resubmitting [the patch with the suggested fix] to wine-patches. I suspect the reason is that we already support a million and one sound servers, but esound is so common it should definitely be in there.