[sdiy] Digital filtering (Oversampling and downsampling)

Andy Eakin aeakin1 at matrixblues.com
Tue Aug 4 17:12:17 CEST 2009


Tom Wiltshire wrote:
> Hi All,
> <mega snip>
>
> Is this really true? How far does this go? Would I do better still 
> trying to run at 192KHz?
>
> Balancing these competing demands without a lot of previous experience 
> seems to be very difficult and very much an art not a science. If 
> anyone has any useful experience or pointers to offer, I'd be grateful 
> for any help I can get.
>
> Thanks,
> Tom
Tom,

I will qualify this with 3 things, First, I am not a "practicing" EE 
although I do have a pretty sheet of paper from quite a few years ago 
that mentions something about Electrical Engineering. Second, I always 
sucked at Calculus.  Third I am still a newbie a teh list.  But follow 
my exercise (or excise) and lets think this out.

So, lets back up and look at the issue of generating and downsampling a 
generated waveform.  I truly believe that this falls right into the art 
of math rather than any defined rule set.
It would stand to reason that in any given simple waveform being 
generated, you would know in advance the point at which your 96k or 48k 
would be the middle ground (notice I did not say mathmatical middle) and 
give the least amount of artifacts. This really implies a basic Fourier 
Series. In this case a Time limited Fourier Series can be used and 
reused  as long as there is no change in the x or y axis, but even then 
you would "know in advance" the appropriate transformation to apply to 
the existing dataset to be able to maintain a very smooth waveform with 
little or no induced artifacts.

Ahh, but this is the real world and I am assuming that a nice clean 
ramp, square or sin is not in the plans for this device.  So lets look 
at the "art" side of things.  With a complex waveform, we are in Nobel 
Prize Territory when it comes to the appropriate way to handle this.  It 
further stands to reason stands to reason that in the 8 samples of 
section or point "B" (where you are looking at "A" as being the previous 
8 samples and "C" as being the next or upcoming samples we should have 
the necessary data be able to derive an approximation of the appropriate 
data points for our newly downsampled waveform.  Unfortunately, without 
delving into quantum formulae (sucked at those too BTW) we cannot 
predict  points A , B and C in our new waveform with any degree of 
accuracy PERIOD. It is simply impossible to obtain an errorless 
calculation without knowing the full dataset before and ahead of the 
point you are creating.  Even if you looked at datapoints "A-1" and 
"C+1" you could only get as accurate as your store of previous data is 
large and your latency will allow you to go into the "future".

Sorry about that was a book, and my brain feels better after the 
exercise :) .
So this bears a few questions.  First where does the waveform go after 
it is downsampled?  Is there any chance of jitter or error being 
injected prior to its sweet (or sour) sound reaches the analog realm?  
What kind of tolerance for artifacts do you have in this system? Did you 
leave the iron on? (uncertainty principle) How much DSP power do you 
have?  and What is your latency Tolerance?

Your DSP may have Fourier commands built in or included in its 
codebase.  Have you tried those?  Does your DSP have an anti-aliasing 
routine in its library?

/TLDR -- It Depends.

Andy E




More information about the Synth-diy mailing list