Hi guys.
As I said before I wanted two complements to the wonderful solution by Matt
Barber, and I just did the first!
Is a patch that outputs bangs at random delays between them. The user can
set the minimum and maximum duration between bangs (all in ms) and a setp
size.
This last one is easier to explain by an example: If the user set the
minimum duration as 100ms, maximum as 2000ms and step size as 10ms the
delays between bangs can be 100, 110, 120, 130 and so on, but never 115 or
127 for instance.

Also, the patch runs a stopwatch that can be programed to... stop at a given
time

Everything can be saved to a text file, witch will contain the time of the
bang (given by the stopwatch) and the time difference between bangs.
This will allow me to create note attacks with durations that sound very
random and non-directional.

I putted all the commands inside a "graph on parent" so it can be used as an
abstraction. I plan to create a bigger patch with Matt's, this one and at
least one more.

Hope you enjoy and give me feedback.
Caio Barros

PS: This was the first time that i realized that you can do a graph on
parent inside a graph on parent. cool!
#N canvas 337 82 857 622 10;
#X obj 30 554 s rebang;
#X obj 57 384 random;
#X floatatom 35 37 7 0 0 2 min - dmin;
#X obj 57 471 +;
#X obj 90 291 -;
#X obj 30 499 del;
#X obj 30 172 t b b;
#X floatatom 87 37 7 0 0 2 max - dmax;
#X obj 105 238 r dmin;
#X obj 90 148 r dmax;
#X obj 30 123 r rebang;
#X obj 30 531 spigot;
#X obj 291 119 r rebang;
#X obj 63 509 r onoff;
#X obj 137 38 tgl 15 0 onoff timeout START/STOP 0 -7 0 10 -262144 -1
-1 0 1;
#X obj 185 38 bng 15 250 50 0 clear empty Clear 20 7 0 10 -262144 -1
-1;
#X obj 348 289 r cent;
#X obj 319 268 r seg;
#X obj 306 245 r min;
#X obj 291 313 pack f f f;
#X msg 291 338 \$1:\$2:\$3;
#X obj 291 394 pack s f;
#X msg 291 421 add \$1 \$2;
#X msg 360 418 set;
#X obj 360 397 r clear;
#X obj 92 123 r onoff;
#X obj 414 208 r total_time;
#X obj 426 319 -;
#X obj 399 235 f;
#X obj 399 263 t f f;
#X msg 448 285 0;
#X obj 448 262 r clear;
#X obj 291 273 f;
#X obj 291 149 t b b;
#X obj 377 533 textfile;
#X msg 377 464 clear;
#X obj 377 442 r clear;
#X msg 429 491 write \$1;
#X obj 429 471 savepanel;
#X obj 429 446 r save;
#X obj 185 59 bng 15 250 50 0 save empty Save 20 7 0 10 -262144 -1
-1;
#X obj 291 474 outlet;
#X floatatom 35 71 7 0 0 2 step_size stepsizedefault stepsize;
#X obj 105 168 r stepsize;
#X obj 90 217 +;
#X obj 90 361 /;
#X obj 105 312 r stepsize;
#X obj 57 425 *;
#X obj 72 404 r stepsize;
#X obj 72 447 r dmin;
#X obj 105 192 t b f;
#X obj 105 262 t b f;
#X obj 105 335 t b f;
#X obj 110 73 nbx 5 14 -1e+37 1e+37 0 0 empty realmax real_max 0 -8
0 10 -262144 -1 -1 2000 256;
#X floatatom 302 18 5 0 0 1 : - sprog;
#X floatatom 259 18 5 0 0 1 : - mprog;
#X floatatom 344 18 6 0 0 0 - - cprog;
#X obj 389 19 tgl 15 0 tgltimeoff empty On/Off 0 -7 0 10 -262144 -1
-1 0 1;
#X text 257 0 Set Time Limit;
#X obj 643 76 * 1000;
#X obj 702 75 * 10;
#X obj 587 76 * 60000;
#X obj 579 176 select;
#X obj 579 17 r total_time;
#X msg 579 260 0;
#X obj 579 310 s timeout;
#X msg 579 285 set \$1;
#X obj 612 141 expr $f1 + $f2 + $f3;
#X obj 702 110 t b f;
#X obj 643 107 t b f;
#X obj 587 48 r mprog;
#X obj 643 48 r sprog;
#X obj 702 48 r cprog;
#X obj 579 236 spigot;
#X obj 612 212 r tgltimeoff;
#X text 9 105 REBANG AT EVERY RANDOM SECONDS;
#N canvas 120 228 450 300 debug 0;
#X floatatom 105 118 5 0 0 1 - - -;
#X obj 142 118 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 177 164 spigot;
#X obj 177 201 print;
#X obj 177 31 inlet;
#X obj 172 118 tgl 15 0 empty empty print? 20 7 0 10 -262144 -1 -1
0 1;
#X text 71 8 Sub-patch to see the output of objects;
#X connect 2 0 3 0;
#X connect 4 0 0 0;
#X connect 4 0 1 0;
#X connect 4 0 2 0;
#X connect 5 0 2 1;
#X coords 0 -1 1 1 130 40 1 100 100;
#X restore 695 522 pd debug;
#X obj 104 384 s rndarg;
#X obj 577 375 r rndarg;
#X obj 577 401 i;
#X obj 577 466 *;
#X obj 592 445 r stepsize;
#X obj 577 509 +;
#X obj 592 487 r dmin;
#X obj 577 422 - 1;
#X obj 577 532 s realmax;
#X text 238 103 WRITE TOTAL AND RELATIVE TIME TO A TEXT FILE;
#X text 352 123 relative time is the time;
#X text 352 132 difference \, in ms \, between;
#X text 352 141 current bang and the last one;
#X text 571 -5 SET THE TIME LIMIT TO THE STOPWATCH;
#N canvas 381 305 702 312 stopwatch 0;
#X obj 504 50 metro 10;
#X obj 504 160 i;
#X obj 534 160 + 1;
#X msg 522 137 0;
#X obj 551 193 select 100;
#X obj 419 148 + 1;
#X obj 383 148 i;
#X msg 394 124 0;
#X obj 426 192 select 60;
#X obj 331 118 + 1;
#X obj 297 118 i;
#X msg 310 93 0;
#X obj 310 70 r zero;
#X obj 394 80 r zero;
#X obj 522 93 r zero;
#X obj 551 217 s bngseg;
#X obj 426 215 s bngmin;
#X obj 411 101 r bngmin;
#X obj 541 114 r bngseg;
#X obj 383 47 r bngseg;
#X obj 297 46 r bngmin;
#X obj 504 217 s cent;
#X obj 383 215 s seg;
#X obj 297 144 s min;
#X obj 234 120 bng 15 250 50 0 zero clear Reset 0 23 0 10 -262144 -1
-1;
#X obj 621 116 i;
#X obj 651 116 + 1;
#X msg 641 93 0;
#X obj 641 69 r zero;
#X obj 621 145 s total_time;
#X obj 504 -3 r onoff;
#X obj 621 48 metro 1;
#X obj 109 121 nbx 3 14 -1e+37 1e+37 0 0 empty min min 0 20 0 10 -262144
-1 -1 0 256;
#X obj 188 121 nbx 3 14 -1e+37 1e+37 0 0 empty cent cent 0 20 0 10
-262144 -1 -1 90 256;
#X obj 148 121 nbx 3 14 -1e+37 1e+37 0 0 empty seg seg 0 20 0 10 -262144
-1 -1 15 256;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 0 4 0;
#X connect 1 0 21 0;
#X connect 2 0 1 1;
#X connect 3 0 1 0;
#X connect 4 0 15 0;
#X connect 5 0 6 1;
#X connect 6 0 5 0;
#X connect 6 0 8 0;
#X connect 6 0 22 0;
#X connect 7 0 6 0;
#X connect 8 0 16 0;
#X connect 9 0 10 1;
#X connect 10 0 9 0;
#X connect 10 0 23 0;
#X connect 11 0 10 0;
#X connect 12 0 11 0;
#X connect 13 0 7 0;
#X connect 14 0 3 0;
#X connect 17 0 7 0;
#X connect 18 0 3 0;
#X connect 19 0 6 0;
#X connect 20 0 10 0;
#X connect 25 0 26 0;
#X connect 25 0 29 0;
#X connect 26 0 25 1;
#X connect 27 0 25 0;
#X connect 28 0 27 0;
#X connect 30 0 0 0;
#X connect 30 0 31 0;
#X connect 31 0 25 0;
#X coords 0 -1 1 1 170 50 1 100 100;
#X restore 242 40 pd stopwatch;
#X text 574 354 CALCULATE THE REAL MAXIMUM DURATION;
#X text 630 400 of the step size the max is;
#X text 630 420 number that satitsfacts the rule;
#X text 629 391 If max - min is not a multiple;
#X text 629 410 trimmed down to the closest;
#N canvas 518 193 450 300 more 0;
#X text -31 28 Rebang outputs bangs at random delays from each other
;
#X text -31 49 Usage:;
#X text -30 100 - step_size is the minimum time interval (again in
ms) to be added or subtracted. E.g. if step_size is 10 \, min is 100
\, and max is 120 the delay between bangs can be 100 \, 110 or 120
but nothing in between.;
#X text -30 70 - min and max sets the minimum and maximum duration
between bangs in ms.;
#X text -30 210 - The user can set a time limit for the stopwatch.
When it reaches that limit it stops;
#X text -30 240 - The time of the bang given by the stopwatch and the
difference between two bangs are recorded as long the user doesn't
click in the "Clear" button. The information can be saved in a text
file.;
#X text -30 150 OBS: in the exemple above \, if the user sets the maximun
time at 125 for instance \, the real maximum time will still be 120
because the step size is 10 In this particular case \, the only maximum
above 120 is 130 For this cases a real_max is given. Notice that the
minimun is always real.;
#X restore 433 36 pd more information;
#X obj 164 501 loadbang;
#X msg 164 525 1;
#X obj 164 549 s stepsizedefault;
#X obj 187 80 bng 10 250 50 0 empty rebang BANG 13 5 0 10 -262144 -1
-1;
#X obj 316 582 cnv 15 10 10 empty empty ReBang 20 12 0 40 -262144 -1
0;
#X connect 1 0 47 0;
#X connect 3 0 5 1;
#X connect 4 0 45 0;
#X connect 5 0 11 0;
#X connect 6 0 5 0;
#X connect 6 1 1 0;
#X connect 8 0 51 0;
#X connect 9 0 44 0;
#X connect 10 0 6 0;
#X connect 11 0 0 0;
#X connect 12 0 33 0;
#X connect 13 0 11 1;
#X connect 16 0 19 2;
#X connect 17 0 19 1;
#X connect 18 0 32 1;
#X connect 19 0 20 0;
#X connect 20 0 21 0;
#X connect 21 0 22 0;
#X connect 22 0 34 0;
#X connect 22 0 41 0;
#X connect 23 0 41 0;
#X connect 24 0 23 0;
#X connect 25 0 6 0;
#X connect 26 0 28 1;
#X connect 27 0 21 1;
#X connect 28 0 29 0;
#X connect 29 0 27 1;
#X connect 29 1 27 0;
#X connect 30 0 27 1;
#X connect 30 0 27 0;
#X connect 31 0 30 0;
#X connect 32 0 19 0;
#X connect 33 0 32 0;
#X connect 33 1 28 0;
#X connect 35 0 34 0;
#X connect 36 0 35 0;
#X connect 37 0 34 0;
#X connect 38 0 37 0;
#X connect 39 0 38 0;
#X connect 43 0 50 0;
#X connect 44 0 4 0;
#X connect 45 0 1 1;
#X connect 45 0 77 0;
#X connect 46 0 52 0;
#X connect 47 0 3 0;
#X connect 48 0 47 1;
#X connect 49 0 3 1;
#X connect 50 0 44 0;
#X connect 50 1 44 1;
#X connect 51 0 4 0;
#X connect 51 1 4 1;
#X connect 52 0 45 0;
#X connect 52 1 45 1;
#X connect 59 0 69 0;
#X connect 60 0 68 0;
#X connect 61 0 67 0;
#X connect 62 0 73 0;
#X connect 63 0 62 0;
#X connect 64 0 66 0;
#X connect 66 0 65 0;
#X connect 67 0 62 1;
#X connect 68 0 67 0;
#X connect 68 1 67 2;
#X connect 69 0 67 0;
#X connect 69 1 67 1;
#X connect 70 0 61 0;
#X connect 71 0 59 0;
#X connect 72 0 60 0;
#X connect 73 0 64 0;
#X connect 74 0 73 1;
#X connect 78 0 79 0;
#X connect 79 0 84 0;
#X connect 80 0 82 0;
#X connect 81 0 80 1;
#X connect 82 0 85 0;
#X connect 83 0 82 1;
#X connect 84 0 80 0;
#X connect 98 0 99 0;
#X connect 99 0 100 0;
#X coords 0 -1 1 1 395 95 1 30 0;
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to