Hi,
I'll preface these comments by stating I've limited h/w knowledge, so
can't comment on the analog stage.
However, I can confirm Karl's observations below on the effects of
both quantisation noise (i.e. using 10- rather than 16-bit samples),
and most especially the effects of jitter. See a recent message post
(message 12456) on this: it's an unfortunate design feature of the
DAC that there's no clock signal that can be fed into it to clock out
the samples at a precise (well to 1/60Mhz resolution) time.
We had a similar issue with a software modem: we initially couldn't
get it to work at V.22bis speeds (2400 bps) because of these issues.
To reduce effects of quantsaition, you can upsample: we use a simple
4-tap interpolating filter to upsample from 8Kz to 40Khz.
To get rid of jitter, you should code your o/p interrupt so that the
code from the start of the interrupt through to where the sample is
o/p has no "if" statements or similar (i.e. it must execute the same
number of instructions for each interrupt). You then have to try and
ensure that the program being interrupted is always on an instruction
that takes the same number of cycles to execute. One way of doing
this is to set up a timer interrupt to happen just before the o/p
time. We use this approach, and jump to a (lot of "nops"). Karrl's
suggestion (go to idle mode) is probably better than this, as it
saves code space). The "real" interrupt can then be used to knock you
out of this to o/p the sample. This will not remove jitter entireley,
but it makes a significant difference.
Unfortuntely I don't have any figures to hand that give the level of
noise reduction each of these achieves, but I do recall it was
significant.
It's a lot of messing to do to get good results, but it does work.
Hope this is of some help!
Brendan Murphy
--- In lpc2000@yahoogroups.com, "Karl Olsen" <kro@p...> wrote:
>
> ---- Original Message ----
> From: "tengelberth" <tengelberth@y...>
> 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-holdShow quoted textHide quoted text
> circuit, see http://groups.yahoo.com/group/lpc2000/message/12460 .
>
>
> Karl Olsen
>