Subject: Re: SB16 clicks, pops and crackles
To: None <gson@araneus.pp.fi>
From: Mike Long <mike.long@analog.com>
List: port-i386
Date: 07/10/1995 11:01:26
>Date: Mon, 10 Jul 1995 15:23:46 +0300
>From: gson@araneus.pp.fi (Andreas Gustafsson)
>
>I'm trying to use a SoundBlaster 16 card with the "sb" driver in a
>NetBSD-current snapshot from around March 17, 1995.  It almost works:
>when I send a Sun (u-law) audio file to /dev/audio using "cp" or
>"cat", the sound that emerges from my speakers is quite recognizable
>but it is mixed with a rather loud, crackling interference.
>
>I also tried a driver from early June with an AWE32, with similar
>results.

You should track -current a bit more closely; the audio drivers have
changed a lot since June, never mind March.  The last changes were
made July 8, and include some bug fixes from John Kohl that may help
prevent this problem.

The sb driver still doesn't support the SB16 all that well.

>I also tried increasing the DMA block size to 1024 bytes (by changing
>the last line of audio_calc_blocksize() to "return 1024;").  After
>this change, the character of the noise changed into a series of
>distinct clicks or pops spaced at about 1/8 of a second, suggesting
>that the interference is due to some event occurring once per DMA
>block.

This happens because of a delay between the end of one DMA block and
the beginning of the next.  Events occur as follows:

1) SB finishes DMA block
2) SB asserts IRQ
3) PC acks IRQ and starts next DMA block

If the time it takes to do all that is longer than a sample period,
then you will hear a click.

>My final test was to play a 1 kHz sine wave and digitize the resulting
>audio output.  At the end of this message is a plot of the waveform
>from about 1 ms before to 1 ms after one of the clicks (turn your
>head 90 degrees to the right to fully enjoy the ASCII graphics).


>                       """$ooo$
>                              $""$ooo
>                              $     """"$ooo
>                              $            """$ooo
>                              $                  """$oo
>                              $                       ""$o
>                              $                        oo$$
>                         ooooo$oooooooooooo$""""""""""""
>     ooooo$"""""""""""""""    $
>     """"""""$oooooooooooooooo$
>                              $"""""""""""""""$oooooooooo

I don't know what this is; perhaps off-by-n error(s) in the driver.

>                              $        ooooooooooooo$""""
>                          oooo$"""""""""
>                   ooo$""""   $
>             ooo$"""          $
>        oo$"""                $
>    oo$""                     $
>   $"                         $
>   $o                         $
>    "$o                       $
>      ""$ooo                  $
>           ""$ooo             $
>                """$ooo       $
>                      """"$ooo$
>                             """$oooo
>                              $     """"$oooo
>                              $             """$oo
>                              $                  ""$o

DMA block 1 stops here

>                              $                     $
>                              $                    $"
>                              $                   $"
>                              $                  $"
>                              $                  $o
>                              $                   $
>                              $                   $
>                              $                   $
>                              "                   $
>                              $                   $
>                              $                   $
>                              $                   $
>                              $                   $

CLICK!

>                              $                   $
>                              $                  o$
>                              $                  $
>                              $                  $
>                              $                  $
>                              $                  $
>                              $                  $
>                              "                  $
>                              $                  $
>                              $                  $
>                              $                  $
>                              $                 $"

DMA block 2 starts here

>                              $                 $o
>                              $                  $o
>                              $                   $
>                              $                  o$
>                              $              ooo$"
>                              $        ooo$"""
>                              $oooo$""""
>                        oooo$"""
>                 ooo$""""     $
>           ooo$"""            $
>       oo$""                  $
>    o$""                      $
>  o$"                         $

It would be interesting to see a similar graph with the state of the
SB's IRQ signal superimposed.
-- 
Mike Long <mike.long@analog.com>           http://www.shore.net/~mikel
VLSI Design Engineer         finger mikel@shore.net for PGP public key
Analog Devices, CPD Division          CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA                assert(*this!=opinionof(Analog));