forcing more sound buffering

Julian Stacey jhs at
Wed Jan 16 17:51:04 PST 2008

Hi multimedia@ people,
I had sticky (intermittent breaks) sound on 2 slow hosts with 7-PRERELEASE
The causes of the stickiness are various &/or compound,
	(eg slow CPU, DMA off (must be on mine), & PS2 mouse Giant
	on 7 generic src/ etc) & I ve been reading & posting over
	on stable@ about issues, & noting my configs for hosts lapd
	& lapn at:
Issues causing breaks are dealt with on stable@, not here, but 
sound specific work- rounds to breaks discussed here:

    hw.snd.feeder_buffersize=65536	# default 16384, read only after boot.
	# Helped my intermittent music playing a lot (for .wav perfect,
		mp3 improved from awful.
		Maybe it should be ref'd in more manuals/ docs?
		& docs should explain what it is:  Buffer size in bytes maybe ?
		& how it relates to max delay expected from disc feeding
		audio data.  ie (I'm guessing, it's late & I haven't
		read source yet) if file reports eg
  audio_01.mp3: MPEG ADTS, layer III, v1, 128 kBits, 44.1 kHz, JntStereo
		Does 64K give me just a half second of buffer ?
		(not enough here !)

I guess ksmp3play uses less internal buffering than mplayer, ? With a .jpg:
 133MHz hw.snd.feeder_buffersize=16384 mplayer   : ran a bit rough.
 133MHz hw.snd.feeder_buffersize=65536 ksmp3play : awful
 133MHz hw.snd.feeder_buffersize=65536 mplayer   : still a bit broken.
 166MHz hw.snd.feeder_buffersize=16384 ksmp3play : awful
 166MHz hw.snd.feeder_buffersize=16384 mplayer:  : much better
 166MHz hw.snd.feeder_buffersize=65536 ksmp3play : broke up 
 166MHz hw.snd.feeder_buffersize=65536 mplayer   : pretty good, not perfect.

hw.snd.feeder_buffersize Max is 64K. 
	I need more. Dont know if 64K is a horrible Intel
	'86 IO seg limit, or just random choice. I'll try to tweak it.

What is the lowest speed CPU for playing `normal mp3 music (ie `file' above)
Am I being over ambitious or reasonable ?
What about decompression load on CPUs, buffering etc ?

BTW I earlier tried tweaking hw.snd.latency (without knowing what it was)
beyond max 10, but despite tweaking header (below) it went silent > 10.

Anything else I should be tweaking ?


Experimental patch for my slow 7-PRERELEASE hosts by
to allow more than hw.snd.latency=10 in /boot/loader.conf

It applies & runs, but if you use above 10, no sound.

If you reduce to 5, sound seems somewhat worse, more interrupted,
but even with this patch, beyond 10 it goes silent.

See Also

*** 7.0-PRERELEASE-ctm-79/src/sys/dev/sound/pcm/channel.h	Wed Jan 16 16:19:03 2008
--- jhs-experimental/src/sys/dev/sound/pcm/channel.h	Wed Jan 16 16:20:37 2008
*** 343,349 ****
  #define CHN_N_TRIGGER		0x00000010
  #define CHN_LATENCY_MIN		0
! #define CHN_LATENCY_MAX		10
--- 343,350 ----
  #define CHN_N_TRIGGER		0x00000010
  #define CHN_LATENCY_MIN		0
! /* #define CHN_LATENCY_MAX	10	JJDEBUG */
! #define CHN_LATENCY_MAX		40	/* used by channel.c & feeder.c */

Julian Stacey.  Munich Consultant: BSD Linux Unix.

More information about the freebsd-multimedia mailing list