View Single Post
 07-28-2009, 04:48 AM #16 liteon Human being with feelings     Join Date: Apr 2008 Posts: 510 oversampling with "zero-stuffing" method "oversampling" in dsp therms is "processing at a higher sample rate, then restoring to the original sample rate" or related to a dsp effect which is "oversampled". The most common use is in cases, where effects produce the reflection like artifact of "aliasing" (or static distortion). Nx oversampling requires execution of the same process Nx times. a 4x os scheme for a non-recursive [fx]: usf - up-sample dsf - down-sample bl - band-limit (aliasing reduction or anti-aliasing) Code: ``` -->- [fx0] [bl] -->- / \ [usf] [dsf] / \ / \ / -->- [fx1] [bl] -->- \ / \ [usf] [dsf] \ / \ -->- [fx2] [bl] -->- / \ / \ / [usf] [dsf] \ / -->- [fx3] [bl] -->-``` the above scheme is only for a non-recursive fx (not using previous sample values) in the lines of y(n)=sin(x(n)). for a recursive fx in the lines of y(n)=sin((x(n-1)+x(n))*0.5), the following must be done: one should think of the two outputs of an up-sample filter as a sequence in a discrete signal: out0 is followed by out1, but to make an recursive fx work, you should feed the result of processing of out0 into fx1, since out0 is previous to out1. and then for the next call the processed output of out1 should be fed into fx0. if we block-diagram this: Code: ``` --[out0] ->--------- [fx0] -- [result0] ->- ... / ...(result1) ->----/ [usf] \ --[out1] ->--------- [fx1] -- [result1] ->- ... ...(result0) ->----/``` a triangular window filter as an example: Code: ```//usf usout0=(usout1+input)*0.5; usout1=input; //fxout0 = process -> usout0; //fxout1 = process -> usout1; //bandlimit -> fxout0; //bandlimit -> fxout1; //dsf output=0.25*(dsmem0+2*dsmem1+fxout1); dsmem0=fxout0; dsmem1=fxout1;``` notes: - up/down sampling introduces aliasing of its own. - the quality of the up/down sample and band-limit filters is of great importance (high order filters required). the above triangular filter requires "signal restoration" in the form of high-shelf boost or similar since it also affects the audible range. - oversampling ends up as a resource expensive process, so it is best to be avoided, unless more resources are available. extended information: http://ccrma.stanford.edu/~jos/resample/resample.html (by jos - ccrma @ stanford) http://synthmaker.co.uk/dokuwiki/dok...s:oversampling (by andrew j - sm) --- lubomir __________________ Blog / Articles / Music / Reaper DJ tutorial JS plugin pack/ JS Wiki / JS tips / JSfxGen Holos / GitHub / GoogleCode / G+ Last edited by liteon; 08-01-2009 at 08:09 PM.