[rec.audio] Adjust-Speed CD player?

mhorne@ka7axd.WV.TEK.COM (Michael T. Horne) (09/23/89)

> 	I know nothing about DSP other than what I've figured out
> on my own, based on simple common sense, but it seems to me that
> there's a better way to lower pitch than just doubling samples.
> Seems to me that you should interpolate them; if you have three
> samples, 1000, 500, 250, and you want to make five samples out of
> them, it seems to me that instead of doing 1000, 1000, 500, 500, 250
> you should do 1000, 750, 500, 375, 250.  That's a reasonably simple
> add-and-shift-right-one-bit algorithm that shouldn't take too long
> and would preserve more of the fidelity than sample doubling.

This is certainly one of the better methods for `slowing down' a sampled
source, however, I suggest interpolating between the samples by simply
convolving the data stream with a sinc function.  Once could easily setup
an FIR filter with variable coefficients.  The main advantages are 1) you can
interpolate at virtually any sample increment you want (i.e. you can do more
than just generate intermediate samples), 2) by the nature of the operation,
the result will be phase linear (i.e. no phase distortion), and 3) you can
achieve greater interpolation accuracy, depending on the length of the filter.

There are disadvantages to this system, the most important being whether or
not you calculate the interpolation filter coefficients on the fly.  The other
alternative is to pre-calculate the coefficients, storing them in ROM, for
example.  All of this depends on what range of `slowing down' you want to
support.  Another problem is that you are generating more samples than what the
source is generating, so you'll have to throttle the input if you wish
to output
the results of the interpolation at the same rate as the input.  As you
can see,
all of this is application dependent.

> 	Also, if you're going to remove samples, I think you
> shouldn't use a simple kill-every-nth-sample procedure...

If you want to throw away samples, you *really* need to filter the data before
doing so, otherwise you will see (hear) aliasing of the data, depending upon
the spectra of the input and how often you are throwing away samples.  When
you decimate any sampled data set, you must low-pass filter the data at half
the new sample rate (Nyquist rule) unless you are sure that the data has
no spectral components above half the new sample rate.

All this said, I don't think this is the optimal method for tone shifting,
however it might work for `fast/slow-forward' effects.  If you wish to shift
the tones while retaining the same sample rate, I would suggest some sort of
frequency scaling algorithm, perhaps by doing a digital mix with a reference
(digital) carrier (i.e. ref = 100 Hz for a 100 Hz shift upward in frequency),
followed by a carrier and lower sideband suppression (Hilbert transform filters
are very easy to implement digitally).  At a fast glance, I think this might
work well for moving the spectra of an audio source up/down some arbitrary
frequency, and should be doable with some of the common DSP chips currently
available.

Mike Horne
Visual Systems Group
Tektronix, Inc.
mhorne@ka7axd.wv.tek.com