Subject: Re: eap recording broken?
To: Current Users <current-users@NetBSD.ORG>
From: Jukka Marin <>
List: tech-kern
Date: 10/20/2006 20:50:16
On Wed, Oct 11, 2006 at 08:14:59PM +0300, Jukka Marin wrote:
> I'm trying to bring a -current system into production use.  One of
> the problems I'm seeing is that recording from Ensoniq AudioPCI
> card produces 8 wrong samples at regular intervals which generates
> a ticking background noise in the recorded audio.  The samples
> seem to be part of the recorded audio signal, they just come from
> a wrong place.  The number of wrong samples always seems to be 8.

I did some more experimenting and then enabled the eap_intr hack
in eap.c.  It seems enabling the hack solves the problem I had
(although I managed to get one corrupted recording even with the
hack enabled).  I added a counter which is incremented every time
the hack delays the data read and the counter shows that the delay
is activated relatively often.

Before enabling the hack, I experimented with read() buffer sizes
and it seemed that when the read buffer size (in userland) was
less than half of the audio device blocksize, the problem went
away (but with small values of blocksize (like 128 bytes), the
problem gets extremely bad and can't be fixed with any size of
read buffer).

The machine I'm using has a dual-core CPU - maybe this affects the
eap driver, enabling it to read the data faster from the hardware
and causing the problem.

> I recorded a 1 kHz size wave which makes the problem clearly visible:

It looks like the 8 "wrong" samples were not updated in the ring buffer
when the data was copied, so delaying the copy sounds right.

I'll be back if the problem shows up again ;-)