[sdiy] [synth-diy] numerically controlled superoscillator without hard sync
Tom Wiltshire
tom at electricdruid.net
Sun Feb 9 22:55:18 CET 2014
Hi Brian,
> The problem with PWM is that it's even worse than a square wave.
For the purposes of what Damian is talking about, it doesn't make any difference. He's got a waveform look-up table into which you can put an arbitrary waveform.
> When you generate a square wave as a wave table by just plugging in values, the discontinuity when it jumps from the bottom to the top, and from the top to the bottom, creates an infinite series of harmonics. But the harmonics above Nyquist can't really be reproduced at their actual frequency, so they are reproduced as aliased frequencies that aren't part of the real square wave. That's why a (poorly implemented) digital square wave sample sounds "digital" compared to an actual analog square wave circuit. But this can be fixed in the digital version by summing sines instead of naively filling in the sample values with discontinuities.
>
> PWM has the same problem with discontinuities in the digital domain, but it's worse because the aliased frequencies are shifting all around. I don't know of a simple way to create a PWM waveform by sum of sines, because of the changing pulse width, so I don't know how to avoid the aliases. Does the David Jaffe article on band-limited waveform generation cover this topic?
I don't remember if the Jaffe article is the one with "BLEPs" and "MinBLEPs", but they're the way to do band-limited PWM in the digital domain at a fixed sample rate. Essentially you correct a naive ramp with a band-limited step function to generate a band-limited ramp. The difference of two band-limited ramps is a band-limited pulse wave of some width, depending on the phase difference between the two ramps.
> The problem I describe assumes you're generating samples and sending them to a DAC at some sample rate (it doesn't really matter whether the sample rate is fixed or variable).
Not true. It matters a good deal.
If the sample rate is a multiple of the output frequency, then any aliasing *has to* be harmonically related to the output frequency. To alter the output frequency, you alter the sample rate, not the number of samples you read out - your waveform starts of with (say) 256 samples, and it still has 256 samples when it's up at 10KHz, not the dozen samples (if we're lucky) we usually get if we've got a fixed sample rate.
Obviously it is possible to put non-bandlimited data into the waveform table (a simple incrementing count as a ramp wave will do it..) and this *will* produce aliasing - but that aliasing will all be harmonically related, so the effect is of waveform distortion rather than "aliasing" as usually understood. It's simply as if you put a slightly different set of data into the table from what's really there. Te important bit is you *don't* get the "unrelated frequencies coming down as pitch slides up" effect which is so obvious with digital aliasing.
Regards,
Tom
More information about the Synth-diy
mailing list