Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] D/A noise

2006-01-19 by Karl Olsen

---- Original Message ----
From: "tengelberth" <tengelberth@...>
To: <lpc2000@yahoogroups.com>
Sent: Thursday, January 19, 2006 6:53 PM
Subject: [lpc2000] D/A noise

> I am trying to use the LPC2138 part as a simple voice device (play 16
> khz voice).  Currently I am using a Keil MCB2130 eval board and
> running a simple example program that plays 16 bit 8khz wav files via
> the D/A port through a LM386 to the on board speaker (the wav file has
> no hiss on my PC).
>
> The process works but there is a low level hiss or static in the
> audio.  I have take the Aout and filtered it with a RLC filter to get
> rid of the tinness from the audio but still has the hiss.  I also
> tried using an off board amp and speaker but still have the
> hiss/static in the audio.
>
> If the D/A is not changing then the hiss/static goes away so it does
> not seem to be noise coupling over.
>
> I tried looking at the signal on the scope but can not see anything
> above the scope noise.
>
> I am weak on audio stuff and am hoping to get some pointers.
>
> 1. Is this hiss just from the D/A S/N ratio and I am stuck with it??

Probably not.


> 2. Is caused by the Vref and V3A being tied with the Digital Vcc?  (If
> this I would assume it would still get the noise when the D/A is not
> changing)

Yep, I'd assume that too.


> 3. Do I need to filter the Aout better?

When you output 8k samples/sec, you need to filter everything at 4 kHz and
above away.  Does the hiss sound high-frequency?

An analog filter with a sharp cut-off at just below 4 kHz is tricky.  The
early CD players had some very high-order analog filters to remove the 22050
Hz (half of the 44100 Hz sampling frequency) and above.

You can make it easier by oversampling: Create an AOUT signal with finer
steps that are easier to smooth out by outputting at 16 or 32 kHz (2x or 4x
oversampling), and create the intermediate values in software by
interpolating between the known samples.  At 2x, you can do linear
interpolation by simply outputting the average of the two neighboring known
samples.  At 4x or 8x, you might need something more advanced than linear
interpolation -- you want to synthesize a signal that has no frequency
content above 4 kHz.  At 4x oversampling, your analog filter just needs to
keep the signal below 4 kHz, and cut away above 16 kHz (half the output rate
of 32 kHz).  Such a filter is much easier to make.  At 8x oversampling, the
noise to filter away even gets above the human audible range.


> 4. Any other test I should try??

Since the AOUT is only 10 bit, you remove some information from the 16-bit
signal.  You thereby introduce a rounding error, or distortion, that is
heard as quantisation noise.  The brain perceives the distorted signal as
the ideal signal plus some hiss noise.  Each bit gives 6 dB of signal/noise
ratio, so with 16 bit you can get ~96 dB, with 10 bit ~60 dB of S/N, because
of quantisation.  You obviously only hear this noise when you output a real
signal, not when outputting silence.  60 dB is pretty good, so it is
probably not that you are hearing.

While outputting values with rounding errors gives quantisation noise, just
as bad is it to output them at the wrong time.  Outputting a sample a little
too early or late will also introduce distortion to the smoothed analog
signal.  So you want to output them with as little jitter as possible.

If you output them from a timer interrupt, you'll get a jitter typically a
few clocks, depending on whether the foreground program had just started a
multi-cycle instruction that needed to be completed.  In the foreground
program, you should of course avoid disabling interrupts that could delay
the interrupt handler excessively.  The best case would probably be if the
foreground program could be in idle mode every time the interrupt fired,
this should give zero jitter.  This can of course be difficult if the CPU
has other tasks than outputting sound.  Try something like this in your
foreground program:

while (1)
{
  /* Enter idle mode, and re-enter it after each interrupt */
  PCON = 0x01;
}

To remove jitter you could also try making an external analog sample-hold
circuit, see http://groups.yahoo.com/group/lpc2000/message/12460 .


Karl Olsen

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.