[nas] got a handle on it: nas enabled mpg123 sounds slow and scratchy?

Scott Presnell srp at tworoads.net
Tue Mar 4 13:01:10 MST 2003


Jon Trulson wrote:
>>
>>from NetBSD sys/audioio.h
>>
>>u_char	error;		/* non-zero if underflow/overflow ocurred */
>>
>>So it sounds like the driver is responding with "overflow ocurred"?
> 
> 
> 	Or underflow.  Sure would be nice to know which ;-) ...
> Definitely a good hint... Anyway to tell which it is?
> 

Eureka!

Taking your lead on a possible underflow I played with the following:

at server/dda/voxware/auvoxware.c:  line 536 we have

    timer_ms = (auMinibufSamples * 700) / rate;
    ntval.it_interval.tv_sec = 0;
    ntval.it_interval.tv_usec = timer_ms * 1000;
    ntval.it_value.tv_sec = 0;
    ntval.it_value.tv_usec = timer_ms * 10 ;

Listening how the song was "extended" in realtime time, and fairly
"regularly" choppy, and looking at old code/patches included in the
BUILDNOTES I took a shot and reduced:

	ntval.it_interval.tv_usec = timer_ms * 1000;
to:
	ntval.it_interval.tv_usec = timer_ms * 100;

And that solved the issue @44100hz! (PIII + PCI audio card).
Can you explain further, the math you are using to setup this timer?

This is probably irrelevant, but I note atleast one other place you are
doing math apparently with a 1/2 second buffer expectation, but from
audio(4) in NetBSD:

        blocksize sets the current audio blocksize.  The generic audio
        driver layer and the hardware driver have the opportunity to ad-
        just this block size to get it within implementation-required
        limits.  Upon return from an AUDIO_SETINFO call, the actual
        blocksize set is returned in this field.  Normally the blocksize
        is calculated to correspond to 50ms of sound and it is recalcu-
        lated when the encoding parameter changes, but if the blocksize
        is set explicitely this value becomes sticky, i.e., it is remains
        even when the encoding is changed.  The stickyness can be cleared
        by reopening the device or setting the blocksize to 0.

Does this imply something about the fragsize, or number of fragments required
to keep the pipe filled, or is it completely about the timer above?

	Thanks.

	- Scott




More information about the Nas mailing list