Yahoo Groups archive

The Logic Off Topic list

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

Message

Re: [L-OT] GEN OT RE: SAMPLING

2001-10-24 by Kool Musick

Debbie wrote:

>I NEED INFORMATION ON OVERSAMPLING AND FORCED SAMPLING.

You DO have a way of asking questions, don't you!!

Basically, oversampling is when you create more samples from a waveform 
that you have already digitally recorded.

In standard CD recording, samples are sent out to a low-pass filter at the 
same rate they were recorded. This is 44.1 KHz. Nyquist's theorem (best not 
get into that right now) tells us that the highest frequency we can record 
at this rate is 22.05 KHz. Even though the human ear cannot hear much 
higher than this this is clearly unsatisfactory. Just think of your 
shimmering violins, for example. Unfortunately, with higher frequencies the 
audio 'reflects' around our sampling frequency. That is to say, everything 
of higher frequency pretty much has an 'alias' of lower frequency which can 
-- and does -- 'stand' in for it. Another name for the low-pass filter is 
'reconstruction filter' -- or anti-aliasing filter. That is what it does. 
That filter is there to block out all the reflections and allow only our 
'true' signal to pass.

Ideally, therefore, we are trying to block everything above the Nyquist 
rate. However, we are at the same time wanting to let everything below that 
frequency pass through unaffected. Problem here is that unfortunately all 
filters have a finite slope. I.e. no real filter is perfect and none of 
them can just 'cut in' or kick in at only and precisely the frequency we 
want to work at. All filters will affect frequencies around and before our 
desired point to a greater or a lesser degree. So ... since sticking to 
exactly 22.05 KHz is impossible we aim for the next best thing ... which is 
maybe to begin blocking out at 20 KHz with a view to getting close to 
infinite blocking (let's say 90db) at our sampling frequency. What this now 
means is that the cutoff of our low pass filter must go from about 0 dB 
attenuation (i.e. not affecting anything) at 20 KHz to an 90 dB at 22 KHz. 
This is still a pretty steep slope, though. Not easy, even with a good and 
expensive analogue filter. We are certain to introduce such things as phase 
shifts, as well -- which is an undesirable thing as we are talking about 
high frequency sounds here, and most people can notice this.

So ... gradually we get to the concept of oversampling. Obviously, if we 
had been sensible enough to do our sampling at a higher rate in the first 
place, then we wouldn't be bumping into the Nyquist limit quite so soon. We 
would then be able to use a cheaper filter with a gentler slope because the 
reflections would be wrapping around some higher sampling frequency (along 
with its multiples). The reflected Nyquist images would therefore no longer 
be within the domain of the music that we wanting to put on our nice bright 
and shiny CD.

So ... what we do now is use some clever maths. It's called 
'interpolation'. We ask ourselves a question. If we HAD sampled at a higher 
rate, then given the information we have in the data we have actually 
recorded, what would those additional samples have looked like? This can 
generally be calculated. If we had sampled at say 8x the rate that we DID 
actually sample at, then we could use a very gentle filter to achieve our 
purpose because instead of only having a 2 KHz headroom to work in (20 to 
22 KHz) we could now do all our filtering in 158 KHz.

Only problem now is ... how do we create those extra samples?

Our original music was analogue. It had a continuous waveform. So ... let's 
look at the other end of the chain. We're going to slap that CD in a player 
and recreate ... a continuous waveform. So ... if we keep looking at this 
other end of the chain then when our low pass reconstruction filter is 
doing its stuff and churning out some output, what it is basically doing is 
converting from our CD sampling rate to the infinitely high sampling rate 
that we actually hear. Since what it puts out is basically an analogue 
signal, then obviously we could sample THAT output at our higher rate. So 
... if we think in terms of monitoring and sampling the output of our 
original recording then we will have increased our sampling rate over what 
we first started with. And ... since we don't actually NEED to convert to 
analogue quite yet (because nobody is listening), then what can do is 
simply use a relatively cheapo DIGITAL low-pass filter to reconstruct our 
digital waveform ... but simply at a higher sampling rate.

That, basically, is oversampling.

So ... all we have to do now is make a suitable interpolating filter. 
Simple, see!!

One options is yer infinite impulse response or IIR filters. These are 
based on feedback. They are very similar to standard analogue low-pass 
filters. The advantage of these is low computation. However, they introduce 
phase shifting. Since analogue filters do this anyway, many people don't 
see this as a problem. In any case, it is possible to make IIR filters with 
no phase shifting but this is both expensive and complicated.

Finite Impulse Response or FIR filters are linear with respect to phase and 
are also relatively easy to create. People do this all the time and they 
are the heart of many reverb units. However, problem here is that when you 
want a complex response, which basically a steep cut-off is, then you 
automatically have lot more computations to do. Check the price of any 
half-way decent reverb unit. For this reason, I don't think you'll find any 
digital reverbs of today that use this method, although I dare say there's 
lots of second-hand ones that do.

But ... with oversampling we're not looking for complicated reverb effects. 
No big rooms or anything. So an FIR filter will do very nicely. These are 
simple. Only really a delay tap. This means that there are only two 
important variables. (A) number of taps; (B) suitable coefficients. 
Multiply the one by the other and add. Not quite that easy because you got 
immediate problems between settling on the number of taps and the number of 
coefficients needed ... but you really just decide what's acceptable given 
your budget and then go with that.

I've tried to make it sound easier than it is because it gets complicated 
in that we're really dealing with moving from a finite number of sample to 
the infinitely many that characterize the analogue domain we live in. Since 
infinity is involved that should immediately tell you that you're going to 
have problems. You will inevitably have some truncating to do, and some 
throwing away of coefficients and stuff like that. The basic principle 
holds, however. The nice thing about FIR, though, is that it does allow us 
to tidy up the signal in several other nifty ways. We've got additional 
bits, for example, that can be put to good use.

OK. I think I've done my bit for now.

Hopefully someone else will come along very shortly to fix up all the 
stupid little mistakes and misunderstandings that I have. Been a VERY long 
time since I had to think of any of this.

And then maybe someone else yet again will be good enough to tell you about 
forced sampling. Don't see much point in going on to that myself in case 
what I've already told you is dead wrong. I'm kind of like that. I always 
like to assume that what I know is dead wrong otherwise there's no scope 
for learning, is there?

  Far as I know what I wrote is right, but I dare say there's a fair few 
people around here who'll disagree. Bit like that around here. Always being 
told by someone or other that I'm a complete idiot who don't know diddly 
squat about anything, but I just keep smiling.

That's it for me.

You have a good night now.

Kool Musick
Keep Musick Kool


_________________________________________________________
Do You Yahoo!?
Get your free @... address at http://mail.yahoo.com

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.