From: matthews@eecs.ucdavis.edu (Thomas W. Matthews)
Newsgroups: rec.audio
Subject: Re: CD Sound Quality
Date: 30 Dec 92 17:34:50 GMT
Organization: Division of Electrical Engineering and Computer Science, UC Davis

I've been following the discussion about "CD sound quality" with
interest.  Right now, the focus seems to be on how a CD player
that only gets 44.1 k samples/sec produces two, four, or eight times
that many samples to feed to its D to A converter.  

In <lk1erdINNrtg@exodus.Eng.Sun.COM>,  chased@rbbb.Eng.Sun.COM (David Chase)
asked about an interpolation scheme in which the player generates an extra
sample between original 44.1 kHz samples by linear interpolation.  I used to
wonder about that also, but I think that andrey@cco.caltech.edu (Andre T. Yew)
is on the right track.

I will be so bold as to present my understanding of how this is done, and
hopefully others will correct, refine, and/or confirm it.

Let's say we're oversampling 4X.  Let T = 1 / (176.4 kHz) so that T is the
sample time at the higher 4X oversampling rate.  Then the original samples
off the CD are only available at the rate of one every 4T, and we would like
the D to A converter to receive samples at the rate of one every T.  How do
we generate the extra samples?

First, we generate a sequence that has extra zeros in it.  If original samples
are denoted by "S" and zeros by "0", then the new sequence looks like:

     S 0 0 0 S 0 0 0 S 0 0 0 S etc.

At first, this seems like a meaningless step.  But note that now the sequence
has samples every T seconds, not just every 4T seconds.  And the filtering
and conversion operations to follow are accomplished at the higher rate.

Below I have drawn the topology of an FIR filter.  The input is the sequence
of original samples with the zeros added (the one typed out above).  The output
is C1*X1 + C2*X2 + C3*X3, . . . Cn*Xn.  In words, each signal Xn is multiplied
by a constant (coefficient) and all the products thus formed are added up
to produce an output.  Note that each Xn can have a different Cn.  It is the
selection of all the Cn that gives the filter its characteristics.  

                  _____       _____                   _____       _____
                 |  T  |     |  T  |                 |  T  |     |  T  |
      Input------|delay|-----|delay|- - mamy more - -|delay|-----|delay|--
               | |_____|   | |_____|                 |_____|  |  |_____|  |
               |           |                                  |           |
               |           |                                  |           |
               X1          X2                                 X16         X17

I haven't drawn the multipliers and the finnal summer to save space.

Example:  If the input samples are all zeros except for a single sample
which has value "1", the "1" will appear at X1, then after T seconds it
will appear at X2, then at X3, etc.  In this case the output of the filter
will be C1, C2, C3, etc.  This is called the impulse response of the filter.
Because the response to an impulse will cease after the "1" has been shifted
through the last delay element, this is called a Finite Impulse Response filter.

If the Cn are calculated from a sinc function, the filter is a good
approximation to a "brick wall" filter (a box filter).  The Cn can be
chosen so that the filter cuts off at 20 kHz (the clock frequency
of 176.4 kHz. must be considered also when determining the cutoff
frequency).  

Note that X1 is the present input and that X2, X3, etc. are just input samples
that have been delayed.  I don't know how many delay stages are actually 
used in a CD player (anyone?).  At one instant in time, if one were to read
the values X1, X2, etc. one would be reading the present input sample, then the
sample from one T ago, then the sample from two T ago, etc.  Hence at any given 
time, only one-fourth of the Xn are non-zero.  But note that an output sample is
generated every T seconds!  And the output has been bandlimited to 20 kHz.  The
output still has "images" of the input signal centered around multiples of the
sampling frequency, but above 20 kHz there is nothing to worry about until
176.4 kHz - 20 kHz = 156.4 kHz.  

The actual implementation of the filter is not done with separate delay
elements as drawn, but the concept is the same.  I hope that this article is
useful.

Tom Matthews
Newsgroups: rec.audio