Re: Question about upsampling methods
Miller Puckette via Pd-list <[email protected]>
| Newsgroups | gmane.comp.multimedia.puredata.general |
|---|---|
| Message-ID | <[email protected]> |
I ended up doing 'ZOH' after noticing that you get really strange results if you upsample a signal with zero-padding and then try to use it as the frequency of an oscillator... the oscillator's frequency drops by the upsampling factor. Another wa to say the same thing: the DC gain of a zero-padding upsampler is 1/N where N is the sampling factor. You could correct this by multiplying the zero-padded signal by N but then what of someone tries to downsample it again... it then gets multiplied by N unless the downsampler averages all the N samples... and then we're back to something that resembles the ZOH filtering effect on the way back down. If I weren't able to specify a choice of upsampling methods, an alternative would be to make a special ugen that filters its input but only looks at 1/N samples. cheers Miller On 4/9/25 1:07 PM, Christof Ressi wrote: > > Hi, > > I have made a PoC for adding upsampling and reblocking support to > SuperCollider: https://github.com/supercollider/supercollider/pull/6702 > > One thing I have been thinking about is the default upsampling method. > Currently, I'm using zero-order-hold (ZOH), aka "sample and hold", > which is also the default for Pd's [inlet~]. The other practical > alternative would be zero-padding. Letting the users choose the method > is not a real option, so I need to settle on a good default. > > Generally, upsampling is done by zero-padding + low pass filtering. > > ZOH is basically a low-quality low-pass filter. It's like a FIR filter > that consists of a series of 1s and the frequency response is that of > a Sinc function. AFAICT, it introduces high frequency noise, but I'm > wondering how relevant that is when the output runs through an > antialiasing filter anyway. > > Zero-padding without low pass filtering results in repetitions of the > original spectrum above the original Nyquist frequency. (It's like > multiplying the signal with an impulse train, which results in the > spectrum being convolved by an impulse train, resulting in a regular > repetition.) I think that an *unfiltered*//zero-padded signal can lead > to strange result. For example, a slowly moving ramp would almost look > like an impulse train. > > In my understanding, a zero-padded signal *must* be filtered, while an > unfiltered ZOH signal may be acceptable for many use cases. Is this > correct? @Miller: Is this maybe also the reason why Pd 0.44 has > switched from "pad" to "hold" as the default upsample method in [inlet~]? > > Zero-padding has the advantage that low pass filtering can fully > restore the original signal, which apparently is not the case for a > ZOH signal. On the other hand, it's always possible to zero-pad the > input signal after the fact. > > At the moment I'm tending to keep ZOH as the default upsampling > method, but I would be curious about other people's opinions. > > Christof > > --- [email protected] - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/[email protected]/message/YTQLO35UO4XHQT7GVNTMY43S3CAL4S57/ To unsubscribe send an email to [email protected] mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/