[PD] Wave Shaping

Frank Barknecht fbar at footils.org
Fri Feb 4 21:36:15 CET 2005


Hallo,
Frank Barknecht hat gesagt: // Frank Barknecht wrote:

> I would guess, that tabread4~ indeed is faster here, but I didn't do
> any benchmarking, which should be easy to do with an abstraction for
> each approach and copying it a lot of times using Pd's internal
> messages like in:  [until 100]---[; pd-subpatch 10 10 my_test_abstraction(

As Johannes predicted, tabread4~ is WAY faster, as you can test
yourself with the little benchmark patch attached. Using 15 objects,
expr~ in this case already has 80% cpu on my good ol' Athlon 900MHz
while tabread4~ using a 1027 element table is at about 18%.

Ciao
-- 
 Frank Barknecht                               _ ______footils.org__
-------------- next part --------------
#N canvas 0 0 450 300 10;
#X obj 56 127 expr~ $v1 - ($v1*$v2) + if($v1<=0 \, -pow(-$v1 \, 0.15)
\, pow($v1 \, 0.15)) * $v2;
#X obj 55 79 osc~ 440;
#X connect 1 0 0 0;
-------------- next part --------------
#N canvas 0 0 450 300 10;
#X obj 128 162 tabread4~ ws;
#X obj 128 134 *~ 1024;
#X obj 128 99 osc~ 440;
#X connect 1 0 0 0;
#X connect 2 0 1 0;
-------------- next part --------------
#N canvas 307 230 868 464 10;
#N canvas 0 0 450 300 bm 0;
#X obj 10 10 ws-tab;
#X obj 10 30 ws-tab;
#X obj 10 50 ws-tab;
#X obj 10 70 ws-tab;
#X obj 10 90 ws-tab;
#X obj 10 110 ws-tab;
#X obj 10 130 ws-tab;
#X obj 10 150 ws-tab;
#X obj 10 170 ws-tab;
#X obj 10 190 ws-tab;
#X obj 10 210 ws-tab;
#X obj 10 230 ws-tab;
#X obj 10 250 ws-tab;
#X obj 10 270 ws-tab;
#X obj 10 290 ws-tab;
#X restore 308 28 pd bm;
#X obj 26 382 s pd-bm;
#X msg 146 320 clear;
#X obj 368 29 table ws;
#X obj 424 306 expr~ $v1 - ($v1*$v2) + if($v1<=0 \, -pow(-$v1 \, 0.15)
\, pow($v1 \, 0.15)) * $v2;
#X obj 425 273 line~;
#X obj 521 79 loadbang;
#X obj 537 381 tabwrite~ ws;
#X msg 425 201 1024;
#X obj 515 103 t b b b;
#X msg 588 80 bang;
#X obj 783 267 sig~ 1;
#X floatatom 783 242 5 0 0 0 - - -;
#X msg 425 251 -1 \, 1 \$1;
#X obj 425 228 / 44.1;
#X obj 559 151 samplerate~;
#X obj 559 178 / 1000;
#X obj 26 270 until;
#X obj 26 201 t b b;
#X floatatom 130 118 5 0 0 2 howmany - -;
#X obj 26 245 f;
#X msg 652 123 \; pd dsp 1 \; ws resize 1027;
#X obj 236 151 bng 32 250 50 0 empty empty test-tabread4 0 -6 0 8 -258699
-1 -1;
#X obj 26 147 bng 32 250 50 0 empty empty test-expr 0 -6 0 8 -24198
-1 -1;
#X text 506 49 make the shaper table "ws";
#X msg 26 319 obj 10 \$1 ws-ex;
#X obj 26 295 f 10;
#X obj 59 294 + 20;
#X msg 70 270 10;
#X obj 236 378 s pd-bm;
#X msg 356 316 clear;
#X obj 236 266 until;
#X obj 236 197 t b b;
#X obj 236 241 f;
#X obj 236 291 f 10;
#X obj 269 290 + 20;
#X msg 280 266 10;
#X msg 236 315 obj 10 \$1 ws-tab;
#X text 24 64 first select \, how many objects to create \, then create
them in [pd bm] by pressing the colorful bngs.;
#X connect 2 0 1 0;
#X connect 4 0 7 0;
#X connect 5 0 4 0;
#X connect 6 0 9 0;
#X connect 8 0 14 0;
#X connect 9 0 8 0;
#X connect 9 1 7 0;
#X connect 9 2 15 0;
#X connect 9 2 21 0;
#X connect 10 0 9 0;
#X connect 11 0 4 1;
#X connect 12 0 11 0;
#X connect 13 0 5 0;
#X connect 14 0 13 0;
#X connect 15 0 16 0;
#X connect 16 0 14 1;
#X connect 17 0 26 0;
#X connect 18 0 20 0;
#X connect 18 1 2 0;
#X connect 18 1 28 0;
#X connect 19 0 20 1;
#X connect 19 0 33 1;
#X connect 20 0 17 0;
#X connect 22 0 32 0;
#X connect 23 0 18 0;
#X connect 25 0 1 0;
#X connect 26 0 27 0;
#X connect 26 0 25 0;
#X connect 27 0 26 1;
#X connect 28 0 26 1;
#X connect 30 0 29 0;
#X connect 31 0 34 0;
#X connect 32 0 33 0;
#X connect 32 1 30 0;
#X connect 32 1 36 0;
#X connect 33 0 31 0;
#X connect 34 0 35 0;
#X connect 34 0 37 0;
#X connect 35 0 34 1;
#X connect 36 0 34 1;
#X connect 37 0 29 0;


More information about the Pd-list mailing list