From: smee@bristol.ac.uk (Paul Smee)
Newsgroups: uk.misc
Subject: Re: Record shops (LPs)
Date: 21 Dec 92 12:52:00 GMT
Reply-To: P.Smee@bristol.ac.uk (Paul Smee)
Distribution: uk
Organization: University of Bristol

In article <1992Dec18.174753.2864@lsl.co.uk> snail@lsl.co.uk writes:
>OK folks, simple lesson in smapling, and then a real DSP expert can come in
>and fix up the few bits I get wrong.
>
>Shannon's Sampling Theroem states that, at the very least, the sampling
>frequency must be two times that of the highest frequency to be sampled.
>If you don't do this you get an effect known as aliasing where a frequency
>'appears' in the sound, which is a a frequency which is the difference between
>the sampling frequency and the frequency being sampled. I experimented with
>aliasing as a musical effect pedal I built - unusable, horrible, bleugh!

True, with the minor fiddle that the sampling frequency must be
strictly greater than the 2x the highest freq to be sampled.  (Not much
greater, though.)  Also, people looking for references will do better
to look under Nyquist rather than Shannon.

>Given this 44.1KHz instantly comes down to 22.05 KHz bandwidth. However this
>alos means that a sine wave at 22.05 KHz would at best be represented by a
>triangle wave and at worst by a flat line. As the frequency being smapled
>decreases (with sampling rate staying constant) the effect accuracy of the
>digital representation increases. Realistically you need to sample at 5 times
>the highest frequency you want to sample. Most people will tell you a value of
>3 is adequate. 

No, ALL people who understand sampling will tell you that 2+ is totally
sufficient.  Worse, they can prove it mathematically, and demonstrate
it by building the circuits.  Yes, everything coming out is 'steppy'.
(Your example of a 22.05kHz since is spurious, since 44.1k isn't
sufficient to sample 22.05k; however, it is enough to sample
22.049999...k, and more than enough to get up to 20k.  

What you're missing is that the reconstructed signal IS steppy coming
out of the D/A, but the steps are caused by higher frequency harmonics
-- e.g. the nasty shape you get from sampling and reconstructing a
20kHz wave is the sum of a 20kHz sine wave, plus sinusoidal components
at 40k, 80k, 160k, ...  When you filter out the higher components, you
get your pure sine back.

Now you don't, for sure, get any of the higher harmonics.  It's
debatable whether you can really hear them or not anyway, but
statistically it's probably true that some people can, and if they can,
they may fall among the CD dislikers.  It's also true that if you build
the filtering stage wrong (which some makers seem to manage), you can
create frequency dependent phase shifting which may, again bother some
people.  (Oversampling players allow an easier filter design.)

Finally, it's true that the sampling only provably works with
steady-state signals.  Basically, a sine wave which suddenly starts
(because you've just plucked your guitar string) and then stops
(because you've muted it) breaks down into a pure sine at the frequency
involved, plus a LOT of high-freq stuff representing the start and the
stop.  Sampling will lose some of that.  It doesn't take an awful lot
of cycles before 'steady-state' rules apply, but it's again possible
that this could cause an effect that some people could detect.  (Note,
though, that LPs can't represent the entire range of freqs necessary
either, so we're talking magnitude, rather than existence, of the
effect.)

There are also quantisation effects (since the sampling theory was
originally designed around analog sampling -- infinite range of
possible values); these can cause problems that anyone can hear in a
bad player, and there are probably some people who can detect them in a
good player.  There's also a possibility of non-linearity in the D/A;
this is a 'solved' problem, but at a cost, and cheaper players may still
suffer from it to some extent.

In compensation, with CD you get a higher dynamic range than is
possible with vinyl, and you get consistency.  LPs begin losing hi-freq
information owing to needle friction from the moment you first listen
to them.  You also get less background noise with CD.  (Yeah, I know, a
good turntable minimises that.  I've got a good turntable, and have
heard even better ones, and it never goes away completely.)  The two
media do have different strong points and flaws, and you pays your
money and takes your choice.

-- 
Paul Smee, Computing Service, University of Bristol, Bristol BS8 1UD, UK
 P.Smee@bristol.ac.uk - ..!uunet!uknet!bsmail!p.smee - Tel +44 272 303132