# [PD] Bandlimited waveforms

Frank Barknecht fbar at footils.org
Sun Dec 2 20:11:37 CET 2007

```Hallo,
Roman Haefeli hat gesagt: // Roman Haefeli wrote:

> hey frank
>
> oh! this is great! i don't have time right now to dig into it, but i
> sure will after the semester is over (in a few days). i was always
> looking for a way to create pwm (or other changeable bandlimited
> waveforms).
>
> On Sun, 2007-12-02 at 15:19 +0100, Frank Barknecht wrote:
> > This approach has one big advantage over bandlimiting with
> > pre-calculated wavetables as realized in some old patches by Guenther
> > Geiger and newer ones by Roman: The waveforms can be changed on the
> > fly, for example to do PWM on a rectangle wave, which is hard or
> > impossible with pre-calculated bandlimited waveforms
>
> yeah, i am looking forward to see an implementation of bandlimited pwm
> square (or making my hands dirty by trying it myself).

It's in the help-file, see the subpatch "even.odd". Or try attached
variation.

> i once  read the chapter in millers book and also had a look at the
> example, but i haven't understood it. i hope your patches will help me
> understand better.

Well, the idea of transition splicing is quite simple: Every time you
have a jump in a waveform, you replace that jump with the jump of a
bandlimited square wave, scaled so the endpoints of the square and

If you do this for a [phasor~], you can construct all other waveforms
with jumps, especially of course square/rectangle waves, but also more
complex jump-waves using the technique of J02.trapezoids.pd (put
[splicetrans~] after the [wrap~] there and connect the frequency
inlets of it as well to try. I haven't yet managed to apply this
technique for corners like in a triangle wave, but foldover isn't that

The square wave jump is constructed to be heavily bandlimited: It only
consists of the first two or three square wave harmonics (1 and 3 and
5 times the fundamental). So whereas normally a jump will generate a
lot of loud alias harmonics, using spliced transitions you can be sure
to only get harmonics at the jump that are up to 3 rsp. 5 times the
fundamental frequency. Then you're fine up to a fundamental of
Nyquist/3 or Nyquist/5 - which would be 8000 rsp. 4800 Hz @ 48 kHz SR.
This is already quite high for an oscillator: For 3951 Hz the midi
note number is 107!

The tricky part is to actually patch the transition in Pd, but
thankfully Miller already did it. ;) And now it's an easy to use
abstraction as well.

Ciao
--
Frank Barknecht                                     _ ______footils.org__
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pwm-square.pd
Type: application/puredata
Size: 3804 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20071202/4a38accf/attachment.bin>
```