You are not logged in.

#1 2012-05-24 07:20:20

Enverex
Member
From: UK
Registered: 2007-06-13
Posts: 159
Website

Issues with ALSA PreAlloc Buffer Size

I have a 4 speaker setup via HDMI to my amp and generally it works well, but I noticed stuttering in the sound when watching a video on YouTube yesterday and saw that this was an apparent fix:

echo 128 > /proc/asound/NVidia/pcm9p/sub0/prealloc

Sure enough that fixed the stuttering audio. But then when I fired up XBMC, the video now played fast (I only have MKV video files but I assume all would be affected) and the sound was time-stretched (not sped up). Changing the prealloc buffer back to 64 fixes XMBC, but I get crackling audio in YouTube again (and I assume other Flash videos).

Am I going about this all wrong? Should I be fixing the crackling some other way, or is there an easy fix for XBMC?

For reference my /etc/asound.conf is:

pcm.!default {
	type plug
	#slave.pcm "Basic"
	slave.pcm "AmpHDMI"
	#slave.pcm "AudioGD"
}

pcm.AmpHDMI {
   type dmix
   ipc_key 1024
   ipc_key_add_uid false
   ipc_perm 0660
   slave {
      pcm "hw:1,9"
      rate 192000
      channels 4
      format S32_LE
   }
}

pcm.AudioGD {
	type hw
	card PCH
	device 1
}

pcm.Basic {
	type hw
	card NVidia
	device 9
}

(basic is for when I want to avoid re-sampling and AudioGD is for when I want to use optical-out to my headphones, so you can ignore both of those)

Last edited by Enverex (2012-05-24 07:21:51)

Offline

#2 2012-05-24 08:58:45

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Issues with ALSA PreAlloc Buffer Size

Try specifying period_size and buffer_size - see my config below, for more info.

In my experimentation, flash needs a buffer_size of over 6000, roughly.

E.g.:

period_size 1024
buffer_size 8192

Offline

Board footer

Powered by FluxBB