[PD] Re: [PD-announce] PWM in Pd

Frank Barknecht fbar at footils.org
Thu May 25 17:47:26 CEST 2006


Hallo,
Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:

> Ah yes, [pwm~] is using zexy's [>~].  I was looking at [pwm].  That  
> example (I am looking at K01.pulse.width.mod.pd from 0.38.4) is very  
> simple, but as it is, it is not usable.  Notice how the LOW and HIGH  
> change values.  PWM needs be 0 for LOW and 1 for HIGH.  That example  
> is usable in an audio context, since DC offset doesn't really  
> matter.  I guess you could rely on the DAC in the soundcard to remove  
> the DC, but that is probably asking for trouble.

Well, the phasor-substraction is the classical analog synth pwm, where
you can do pwm with substracting two sawtooth waves. It is limited
because of the DC wandering, but it works quite okay for sound. 

Attached is your patch where I replaced the zexy object with a crude
waveshaper. I also replaced the phase-inlet with a frequency inlet,
because I think, this is more useful to have than an inlet to reset
the phase. Of course both inlets would be useful in the end.

Attached patch is more a proof of concept and not recommended for real
use.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 549 241 441 432 10;
#X obj 54 55 inlet;
#X obj 180 349 outlet~;
#X text 104 16 after an idea from Roman Haefeli;
#X text 40 16 [pwm~];
#X obj 180 57 inlet;
#X obj 54 89 t a b;
#X obj 57 144 s \$0-lookup;
#X msg 103 114 const 1;
#X obj 180 142 phasor~ \$1;
#X obj 201 278 table \$0-lookup 515;
#X obj 181 226 *~ 512;
#N canvas 0 0 471 382 comp 0;
#X obj 167 68 inlet;
#X obj 224 222 until;
#X obj 194 198 moses;
#X obj 224 308 outlet;
#X obj 224 258 f 0;
#X obj 254 259 + 1;
#X obj 167 172 t a b;
#X msg 269 221 0;
#X obj 224 284 pack 0 0;
#X obj 168 148 expr 515 - 515 * $f1;
#X connect 0 0 9 0;
#X connect 1 0 4 0;
#X connect 2 1 1 0;
#X connect 4 0 5 0;
#X connect 4 0 8 0;
#X connect 5 0 4 1;
#X connect 6 0 2 0;
#X connect 6 1 7 0;
#X connect 7 0 4 1;
#X connect 8 0 3 0;
#X connect 9 0 6 0;
#X restore 38 112 pd comp;
#X obj 181 253 tabread4~ \$0-lookup;
#X connect 0 0 5 0;
#X connect 4 0 8 0;
#X connect 5 0 11 0;
#X connect 5 1 7 0;
#X connect 7 0 6 0;
#X connect 8 0 10 0;
#X connect 10 0 12 0;
#X connect 11 0 6 0;
#X connect 12 0 1 0;


More information about the Pd-list mailing list