You are not logged in.

#1 2014-08-19 09:01:09

Hudd
Member
Registered: 2014-08-17
Posts: 22

Wine sound delay

All of apps (or at least most of them) have approx. 1s sound latency. I tried to search for solution, but everything that I found is either didn't work or was outdated.

I tried installing oss from AUR, but it didn't work at all.

I also tried installing alsa-oss, lib32-alsa-oss, lib32-alsa-lib, then I set wine to use OSS via winetricks:

# winetricks sound=oss

Even so, sound delay was still present.

Any suggestions?

Offline

#2 2014-08-19 10:09:18

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Wine sound delay

What is the output device for wine? What are its parameters? Any dmesg relevant information? Any setup files for alsa (~/.asoundrc, /etc/asound.conf) or anything else relevant? Do you use pulseaudio? And of course, you provide no information on your hardware.

aplay -lL;
lspci -nn | grep -i audio;
lsmod | grep ^snd;
systool -v -m snd_hda_intel

Offline

#3 2014-08-19 11:53:08

Hudd
Member
Registered: 2014-08-17
Posts: 22

Re: Wine sound delay

I forgot to post my hardware information, sorry.

I'm using USB soundblaster, here is some information: https://gist.github.com/anonymous/d75ba5e7272acddd536b .
The output device in winecfg is set to (System default). I don't have pulseaudio installed, and I don't have any config for alsa.

Offline

#4 2014-08-19 12:13:08

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Wine sound delay

# aplay -lL;
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=HD
USB Sound Blaster HD, USB Audio
Default Audio Device
sysdefault:CARD=HD
USB Sound Blaster HD, USB Audio
Default Audio Device
front:CARD=HD,DEV=0
USB Sound Blaster HD, USB Audio
Front speakers
surround21:CARD=HD,DEV=0
USB Sound Blaster HD, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=HD,DEV=0
USB Sound Blaster HD, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=HD,DEV=0
USB Sound Blaster HD, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=HD,DEV=0
USB Sound Blaster HD, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=HD,DEV=0
USB Sound Blaster HD, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=HD,DEV=0
USB Sound Blaster HD, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=HD,DEV=0
USB Sound Blaster HD, USB Audio
IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=HDMI,DEV=0
HDA ATI HDMI, HDMI 0
HDMI Audio Output
hdmi:CARD=HDMI,DEV=1
HDA ATI HDMI, HDMI 1
HDMI Audio Output
hdmi:CARD=HDMI,DEV=2
HDA ATI HDMI, HDMI 2
HDMI Audio Output
hdmi:CARD=HDMI,DEV=3
HDA ATI HDMI, HDMI 3
HDMI Audio Output
hdmi:CARD=HDMI,DEV=4
HDA ATI HDMI, HDMI 4
HDMI Audio Output
hdmi:CARD=HDMI,DEV=5
HDA ATI HDMI, HDMI 5
HDMI Audio Output
**** List of PLAYBACK Hardware Devices ****
card 0: HD [USB Sound Blaster HD], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: HD [USB Sound Blaster HD], device 1: USB Audio [USB Audio #1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: HD [USB Sound Blaster HD], device 2: USB Audio [USB Audio #2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 11: HDMI 5 [HDMI 5]
Subdevices: 1/1
Subdevice #0: subdevice #0
# lspci -nn | grep -i audio;
01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] [1002:aab0]
# lsmod | grep ^snd;
snd_hda_codec_hdmi 45117 1
snd_usb_audio 135316 0
snd_usbmidi_lib 27484 1 snd_usb_audio
snd_rawmidi 26806 1 snd_usbmidi_lib
snd_seq_device 13132 1 snd_rawmidi
snd_hda_intel 26327 0
snd_hda_controller 26727 1 snd_hda_intel
snd_hda_codec 108552 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_controller
snd_hwdep 17244 2 snd_usb_audio,snd_hda_codec
snd_pcm 88487 5 snd_usb_audio,snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_hda_controller
snd_timer 26614 1 snd_pcm
snd 69340 10 snd_usb_audio,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_rawmidi,snd_usbmidi_lib,snd_hda_codec,snd_hda_intel,snd_seq_device
# dmesg | grep snd;
[ 6.287516] usbcore: registered new interface driver snd-usb-audio
[ 6.874366] snd_hda_intel 0000:01:00.1: Handle VGA-switcheroo audio client
[ 6.874371] snd_hda_intel 0000:01:00.1: Force to non-snoop mode
[ 6.874417] snd_hda_intel 0000:01:00.1: irq 44 for MSI/MSI-X
[11689.051297] snd_hda_intel 0000:01:00.1: irq 44 for MSI/MSI-X
[25580.555556] snd_hda_intel 0000:01:00.1: irq 44 for MSI/MSI-X
 
# systool -v -m snd_hda_intel;
Module = "snd_hda_intel"
Attributes:
coresize = "26327"
initsize = "0"
initstate = "live"
refcnt = "0"
taint = ""
uevent = <store method only>
Parameters:
align_buffer_size = "-1"
bdl_pos_adj = "32,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
beep_mode = "Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y"
enable_msi = "-1"
enable = "Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y"
id = "(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)"
index = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
jackpoll_ms = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
model = "(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)"
patch = "(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)"
position_fix = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
power_save = "0"
power_save_controller= "Y"
probe_mask = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
probe_only = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
single_cmd = "N"
snoop = "Y"
Sections:
.bss = "0xffffffffa057da80"
.data = "0xffffffffa057d000"
.data.unlikely = "0xffffffffa057d7d0"
.exit.text = "0xffffffffa057a930"
.gnu.linkonce.this_module= "0xffffffffa057d800"
.init.text = "0xffffffffa0383000"
.note.gnu.build-id = "0xffffffffa057b000"
.rodata = "0xffffffffa057b040"
.rodata.str1.1 = "0xffffffffa057bf02"
.rodata.str1.8 = "0xffffffffa057c2e0"
.smp_locks = "0xffffffffa057c618"
.strtab = "0xffffffffa0386508"
.symtab = "0xffffffffa0384000"
.text = "0xffffffffa0578000"
__mcount_loc = "0xffffffffa057c848"
__param = "0xffffffffa057c628"
__verbose = "0xffffffffa057d640"
 
# systool -v -m snd_usb_audio
Module = "snd_usb_audio"
 
Attributes:
coresize = "135316"
initsize = "0"
initstate = "live"
refcnt = "0"
taint = ""
uevent = <store method only>
 
Parameters:
autoclock = "Y"
device_setup = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
enable = "Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y"
id = "(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)"
ignore_ctl_error = "N"
index = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
pid = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
vid = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
 
Sections:
.bss = "0xffffffffa07850c0"
.data = "0xffffffffa0780000"
.exit.text = "0xffffffffa0776ee9"
.gnu.linkonce.this_module= "0xffffffffa0784e40"
.init.text = "0xffffffffa078a000"
.note.gnu.build-id = "0xffffffffa0777000"
.rodata = "0xffffffffa0777040"
.rodata.str1.1 = "0xffffffffa077ccfe"
.rodata.str1.8 = "0xffffffffa077e360"
.smp_locks = "0xffffffffa077fed8"
.strtab = "0xffffffffa0791d08"
.symtab = "0xffffffffa078b000"
.text = "0xffffffffa0767000"
__mcount_loc = "0xffffffffa077f978"
__param = "0xffffffffa077f878"
__verbose = "0xffffffffa0784670"

Other might come here, because of these information.

Since this is about a usb device, try setting nrpacks to 2 or 1.

Alsa documentation wrote:

NB: nrpacks parameter can be modified dynamically via sysfs.

Other than that, the buffer size might be set to maximum.

Offline

#5 2014-08-19 15:09:25

Hudd
Member
Registered: 2014-08-17
Posts: 22

Re: Wine sound delay

Hmm, there seems to be no such option:

# ls /sys/module/snd_usb_audio/parameters
autoclock  device_setup  enable  id  ignore_ctl_error  index  pid  vid

I also tried adding

options snd-usb-audio nrpacks=1

to /etc/modprobe.d/modprobe.conf, but it didn't work.

Offline

#6 2014-08-19 15:20:45

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Wine sound delay

Did you look in dmesg or journactl? Did you reboot after adding modprobe options? 'modprobe.conf' is of little description, 50-usb-audio.conf or the basic 50-alsa-base.conf would do better. You could just create the file. If it still does not work, use vid and pid for module options from 'lsusb'.

Offline

#7 2014-08-19 15:32:32

Hudd
Member
Registered: 2014-08-17
Posts: 22

Re: Wine sound delay

Yes, I did reboot. Just looked into journalctl, it says that 'nrpacks' is unknown parameter.

# journalctl | grep -i snd_usb_audio
Aug 19 10:51:24 arch kernel: snd_usb_audio: unknown parameter 'nrpacks' ignored
Aug 19 11:35:28 arch kernel: snd_usb_audio: unknown parameter 'nrpacks' ignored

Offline

#8 2014-08-19 15:56:56

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Wine sound delay

Yes, it is not listed by systool either. I found this
http://article.gmane.org/gmane.linux.us … ch=nrpacks
Seems like a patch removed it in that particular scenario and the documentation is out of date.

Then reduce your buffer size/period number in alsa configuration. According to '/usr/share/alsa/pcm/dmix.conf' one of these should work:

$ cat ~/.asoundrc
defaults.dmix.N.periods 4
defaults.dmix.periods 4

Try a different number, the default is 16, I would go as low as 2, since the period_size is usually 1024. You may also want to use the card name reference instead of a number reference N from 'cat /proc/asound/card*/id' for your appropriate sound card.

Last edited by emeres (2014-08-19 15:57:50)

Offline

#9 2014-08-21 13:49:53

Hudd
Member
Registered: 2014-08-17
Posts: 22

Re: Wine sound delay

Hmm, that still didn't fix the issue. But I found out that only some apps have the sound delay, which I think use directsound API.

Last edited by Hudd (2014-08-21 13:50:47)

Offline

#10 2014-08-21 14:02:29

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Wine sound delay

Hudd wrote:

Hmm, that still didn't fix the issue. But I found out that only some apps have the sound delay, which I think use directsound API.

Can you list them?

Offline

#11 2014-09-03 10:01:59

Hudd
Member
Registered: 2014-08-17
Posts: 22

Re: Wine sound delay

Sorry for a long delay, I wanted to test more apps before posting, but was unable to do as much as I wanted.

So far, I clearly got a delay in Gothic 1, 2 and Warcraft III world editor, and laggy sound in bink video.

Also, there is a sound delay in apps using BASS library, but results are inconsistent.

Some apps which do not have any sound lag: Command & Conquer 95, Tiberian Sun, Heroes of Might and Magic III, IV, windows version of Audacity, foobar2000

Offline

#12 2014-09-03 10:24:07

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Wine sound delay

And wine is still set up to use the default sound device? Did you run winetricks sound=alsa afterwards? You could recreate the dmix device with specified buffer/period sizes:

$ cat ~/.asoundrc
defaults.pcm.dmix.channels 8

pcm.!dmix {
	@args [ CARD DEV SUBDEV FORMAT RATE CHANNELS ]
	@args.CARD {
		type string
		default {
			@func refer
			name defaults.pcm.dmix.card
		}
	}
	@args.DEV {
		type integer
		default {
			@func refer
			name defaults.pcm.dmix.device
		}
	}
	@args.SUBDEV {
		type integer
		default 0
	}
	@args.FORMAT {
		type string
		default {
			@func refer
			name defaults.pcm.dmix.format
		}
	}
	@args.RATE {
		type integer
		default {
			@func refer
			name defaults.pcm.dmix.rate
		}
	}
	@args.CHANNELS {
		type integer
		default {
			@func refer
			name defaults.pcm.dmix.channels
		}
	}
	type dmix
	ipc_key {
		@func refer
		name defaults.pcm.ipc_key
	}
	ipc_gid {
		@func refer
		name defaults.pcm.ipc_gid
	}
	ipc_perm {
		@func refer
		name defaults.pcm.ipc_perm
	}
	slave {
		pcm {
			type hw
			card $CARD
			device $DEV
			subdevice $SUBDEV
		}
		format $FORMAT
		rate $RATE
		channels $CHANNELS
		period_size 1024
		buffer_size 4096
	}
	hint {
		show {
			@func refer
			name defaults.namehint.extended
		}
		description "Direct sample mixing device"
		device $DEV
	}
}

Change buffer and period size and test again, sound needs to stop before changes take effect. Channels in defaults node might need readjusting to your hardware.

Offline

#13 2021-07-17 23:14:17

Ammako
Member
Registered: 2021-07-16
Posts: 2

Re: Wine sound delay

I'm going to necrobump this, because this is where Google took me.

Running La-Mulana on Wine, which requires directmusic with Winetricks. Just pulseaudio, nothing fancy.

There was a pretty bad delay on music and sound effects, which I pretty much completely solved by installing lib32-mpg123.

Hopefully this helps the next person who ends up here through Google search.

Offline

#14 2021-07-18 11:58:02

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 3,657

Re: Wine sound delay

Closing this old topic now.

Offline

Board footer

Powered by FluxBB