Tanu Kaskinen wrote: > On Tue, 2013-02-12 at 08:54 +0100, David Henningsson wrote: >> On 02/11/2013 11:03 AM, Dmitri Paduchikh wrote: >> > Hello, >> > >> > When I play a sound using paplay (or aplay with ALSA configured to use >> > PulseAudio) there is a big pause between two successive runs. For >> > example: >> > >> > $ paplay sound1.wav; paplay sound2.wav >> > >> > The pause between these sounds is something about two seconds. I've >> > tried to adjust latency (through --latency-msec=50) but this doesn't >> > seem to change much. >> > >> > Couldn't you explain what is the cause of this pause? Is it possible to >> > eliminate it? >> > >> >> This is a well-known issue which we discussed briefly at PulseConf. >> Fixing it is not trivial, unfortunately. >> >> I did a quick test here; and for me the delay is 250 - 500 ms, which is >> consistent with the output of pacmd list-sinks: >> >> configured latency: 0.00 ms; range is 0.50 .. 371.52 ms >> >> Is your maximum latency going up to about 2000 ms? What distro are you >> running? >> >> There was some effort a while ago to try to increase this to 2000 ms in >> order to reduce power consumption, and I think we had that in Ubuntu too >> at some point? I don't know why this is now down to 371 ms, but given >> that gstreamer has a latency or similar magnitude (200 - 400 ms, IIRC) >> for media playback anyway, I see little reason to investigate it >> further. And in addition, it helps a bit against this bug. :-) > In case you didn't know, the maximum hw buffer size for HDA is defined > by this kernel configuration option: CONFIG_SND_HDA_PREALLOC_SIZE. The > default is 64 (kB), which results in 271.52 ms with 2 ch, 16 bit, 44.1 > kHz. It is recommended to change this value to e.g. 2048 on systems that > use PulseAudio. Since Debian still doesn't enable PulseAudio by default, > Debian's kernel uses the default value. Perhaps that has propagated to > Ubuntu by accident at some point? Here, on Arch Linux, the value of CONFIG_SND_HDA_PREALLOC_SIZE is set to 4096. Am I understanding correctly that maximal latency depends not only on this buffer size but also on the sound format used? I was experimenting with sound of 8-bit unsigned encoding, 1 ch, rate 11025 Hz. Then the buffer size only explains latency of 371.52 ms. But delay is much higher: $ pacmd list-sinks; time paplay ~/sounds/ringin.wav Welcome to PulseAudio! Use "help" for usage information. >>> 1 sink(s) available. * index: 0 name: <alsa_output.pci-0000_00_1b.0.analog-stereo> driver: <module-alsa-card.c> flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY FLAT_VOLUME DYNAMIC_LATENCY state: RUNNING suspend cause: priority: 9959 volume: 0: 98% 1: 98% 0: -0,40 dB 1: -0,40 dB balance 0,00 base volume: 100% 0,00 dB volume steps: 65537 muted: no current latency: 121,40 ms max request: 23 KiB max rewind: 344 KiB monitor source: 0 sample spec: s16le 2ch 48000?? channel map: front-left,front-right ?????? used by: 1 linked by: 1 configured latency: 125,00 ms; range is 0,50 .. 1837,50 ms card: 0 <alsa_card.pci-0000_00_1b.0> module: 4 properties: alsa.resolution_bits = "16" device.api = "alsa" device.class = "sound" alsa.class = "generic" alsa.subclass = "generic-mix" alsa.name = "ALC892 Analog" alsa.id = "ALC892 Analog" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.device = "0" alsa.card = "0" alsa.card_name = "HDA Intel PCH" alsa.long_card_name = "HDA Intel PCH at 0xf7e10000 irq 43" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1b.0" sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.id = "1e20" device.form_factor = "internal" device.string = "front:0" device.buffering.buffer_size = "352800" device.buffering.fragment_size = "176400" device.access_mode = "mmap+timer" device.profile.name = "analog-stereo" device.profile.description = "?????????? ??????" device.description = "?????????? ????? ?????????? ??????" alsa.mixer_name = "Intel PantherPoint HDMI" alsa.components = "HDA:10ec0892,18498892,00100302 HDA:80862806,80860101,00100000" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" ports: analog-output: ?????????? ????? (priority 9900, latency offset 0 usec, available: unknown) properties: analog-output-headphones: ?????????? ???????? (priority 9000, latency offset 0 usec, available: no) properties: device.icon_name = "audio-headphones" active port: <analog-output> >>> real 0m2.339s user 0m0.007s sys 0m0.000s $ soxi ~/sounds/ringin.wav Input File : '/home/dmai/sounds/ringin.wav' Channels : 1 Sample Rate : Precision : 8-bit Duration : 00:00:00.91 = 9981 samples ~ 67.898 CDDA sectors File Size : 10.0k Bit Rate : 88.6k Sample Encoding: 8-bit Unsigned Integer PCM $ -- With best regards Dmitri Paduchikh