Skip to content

Commit

Permalink
added pd regressor
Browse files Browse the repository at this point in the history
  • Loading branch information
tremblap committed Jul 16, 2024
1 parent 128d9f3 commit 2d6b46f
Show file tree
Hide file tree
Showing 3 changed files with 628 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/routes/(content)/learn/regression-neural-network/+page.svx
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,23 @@ This tutorial guides you through building a bespoke synthesis controller. It lev

<Tabs>
<TabList>
<Tab>SuperCollider</Tab>
<Tab>Max</Tab>
<Tab>Pure Data</Tab>
<Tab>SuperCollider</Tab>
</TabList>
<TabPanel>
<YouTube
url='mxmMBvi3Cb0'
url='XfNZzQPdPG0'
/>
</TabPanel>
<TabPanel>
<YouTube
url='XfNZzQPdPG0'
url='cVKexgWSU0s'
/>
</TabPanel>
<TabPanel>
<YouTube
url='mxmMBvi3Cb0'
/>
</TabPanel>
</Tabs>
339 changes: 339 additions & 0 deletions static/examples/regressor-video-demo.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,339 @@
#N canvas 0 25 977 785 12;
#X msg 346 353 fit xydata paramsdata;
#X obj 192 35 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 237 254 tabwrite xybuf;
#X obj 192 205 pack f 0;
#X obj 256 35 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 256 205 pack f 1;
#X obj 237 275 array define xybuf 2;
#X obj 134 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 156 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 177 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 198 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 219 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 372 801 tabwrite paramsbuf;
#X obj 240 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 261 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 283 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 305 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 326 605 vsl 19 162 0 1 0 0 empty empty empty 0 -9 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 372 822 array define paramsbuf 10;
#N canvas 82 177 728 641 chaoticsynth 0;
#X obj 80 38 inlet;
#X msg 80 62 \$1 10;
#X obj 80 86 line~;
#X obj 48 110 *~, f 5;
#X obj 48 12 r~ feed2;
#X obj 130 37 inlet;
#X msg 130 61 \$1 10;
#X obj 130 85 line~;
#X obj 48 134 +~, f 12;
#X obj 48 158 *~ 69;
#X obj 48 182 mtof~;
#X obj 48 206 osc~;
#X obj 48 230 *~, f 18;
#X obj 48 254 clip~ -1 1;
#X obj 171 111 inlet;
#X msg 171 159 \$1 10;
#X obj 171 182 line~;
#X obj 171 136 * 50;
#X obj 171 205 expr~ pow(10 \, $v1/20);
#X obj 49 337 vcf~, f 30;
#X obj 255 231 inlet;
#X msg 255 283 \$1 10;
#X obj 255 314 line;
#X obj 255 255 * 0.96;
#X obj 49 386 *~ 0.1;
#X obj 100 386 send~ feed1;
#X obj 49 410 outlet~;
#X obj 202 387 fluid.loudness~ -hopsize 64 -truepeak 0;
#X obj 202 411 unpack f f;
#X obj 202 435 clip -120 0;
#X obj 202 459 + 120;
#X msg 202 483 \$1 2;
#X obj 202 507 line~;
#X obj 202 531 *~, f 18;
#X obj 319 457 inlet;
#X msg 319 481 \$1 10;
#X obj 319 505 line~;
#X obj 135 507 loadbang;
#X msg 135 531 130;
#X obj 135 555 -~, f 10;
#X obj 135 579 mtof~;
#X obj 135 603 s~ cutoff1;
#X obj 152 310 r~ cutoff1;
#X obj 541 38 inlet;
#X msg 541 62 \$1 10;
#X obj 541 86 line~;
#X obj 509 110 *~, f 5;
#X obj 591 37 inlet;
#X msg 591 61 \$1 10;
#X obj 591 85 line~;
#X obj 509 134 +~, f 12;
#X obj 509 158 *~ 69;
#X obj 509 182 mtof~;
#X obj 509 206 osc~;
#X obj 509 230 *~, f 18;
#X obj 509 254 clip~ -1 1;
#X obj 632 111 inlet;
#X msg 632 159 \$1 10;
#X obj 632 182 line~;
#X obj 632 136 * 50;
#X obj 632 205 expr~ pow(10 \, $v1/20);
#X obj 510 337 vcf~, f 30;
#X obj 716 231 inlet;
#X msg 716 283 \$1 10;
#X obj 716 314 line;
#X obj 716 255 * 0.96;
#X obj 510 386 *~ 0.1;
#X obj 510 410 outlet~;
#X obj 663 387 fluid.loudness~ -hopsize 64 -truepeak 0;
#X obj 663 411 unpack f f;
#X obj 663 435 clip -120 0;
#X obj 663 459 + 120;
#X msg 663 483 \$1 2;
#X obj 663 507 line~;
#X obj 663 531 *~, f 18;
#X obj 780 457 inlet;
#X msg 780 481 \$1 10;
#X obj 780 505 line~;
#X obj 596 507 loadbang;
#X msg 596 531 130;
#X obj 596 555 -~, f 10;
#X obj 596 579 mtof~;
#X obj 561 386 send~ feed2;
#X obj 509 12 r~ feed1;
#X obj 613 310 r~ cutoff2;
#X obj 596 603 s~ cutoff2;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 2 0 3 1;
#X connect 3 0 8 0;
#X connect 4 0 3 0;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 7 0 8 1;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 12 0 13 0;
#X connect 13 0 19 0;
#X connect 14 0 17 0;
#X connect 15 0 16 0;
#X connect 16 0 18 0;
#X connect 17 0 15 0;
#X connect 18 0 12 1;
#X connect 19 0 24 0;
#X connect 19 0 25 0;
#X connect 19 0 27 0;
#X connect 20 0 23 0;
#X connect 21 0 22 0;
#X connect 22 0 19 2;
#X connect 23 0 21 0;
#X connect 24 0 26 0;
#X connect 27 0 28 0;
#X connect 28 0 29 0;
#X connect 29 0 30 0;
#X connect 30 0 31 0;
#X connect 31 0 32 0;
#X connect 32 0 33 0;
#X connect 33 0 39 1;
#X connect 34 0 35 0;
#X connect 35 0 36 0;
#X connect 36 0 33 1;
#X connect 37 0 38 0;
#X connect 38 0 39 0;
#X connect 39 0 40 0;
#X connect 40 0 41 0;
#X connect 42 0 19 1;
#X connect 43 0 44 0;
#X connect 44 0 45 0;
#X connect 45 0 46 1;
#X connect 46 0 50 0;
#X connect 47 0 48 0;
#X connect 48 0 49 0;
#X connect 49 0 50 1;
#X connect 50 0 51 0;
#X connect 51 0 52 0;
#X connect 52 0 53 0;
#X connect 53 0 54 0;
#X connect 54 0 55 0;
#X connect 55 0 61 0;
#X connect 56 0 59 0;
#X connect 57 0 58 0;
#X connect 58 0 60 0;
#X connect 59 0 57 0;
#X connect 60 0 54 1;
#X connect 61 0 66 0;
#X connect 61 0 68 0;
#X connect 61 0 82 0;
#X connect 62 0 65 0;
#X connect 63 0 64 0;
#X connect 64 0 61 2;
#X connect 65 0 63 0;
#X connect 66 0 67 0;
#X connect 68 0 69 0;
#X connect 69 0 70 0;
#X connect 70 0 71 0;
#X connect 71 0 72 0;
#X connect 72 0 73 0;
#X connect 73 0 74 0;
#X connect 74 0 80 1;
#X connect 75 0 76 0;
#X connect 76 0 77 0;
#X connect 77 0 74 1;
#X connect 78 0 79 0;
#X connect 79 0 80 0;
#X connect 80 0 81 0;
#X connect 81 0 85 0;
#X connect 83 0 46 0;
#X connect 84 0 61 1;
#X restore 135 803 pd chaoticsynth;
#X f 28;
#X obj 135 834 dac~;
#N canvas 353 378 783 300 packslider 0;
#X obj 6 55 pack f 0;
#X obj 70 55 pack f 1;
#X obj 133 55 pack f 2;
#X obj 197 55 pack f 3;
#X obj 262 55 pack f 4;
#X obj 324 54 pack f 5;
#X obj 388 54 pack f 6;
#X obj 451 54 pack f 7;
#X obj 515 54 pack f 8;
#X obj 6 102 outlet;
#X obj 7 27 inlet;
#X obj 263 27 inlet;
#X obj 133 29 inlet;
#X obj 196 27 inlet;
#X obj 580 54 pack f 9;
#X obj 70 28 inlet;
#X obj 322 24 inlet;
#X obj 578 24 inlet;
#X obj 448 26 inlet;
#X obj 511 24 inlet;
#X obj 385 25 inlet;
#X connect 0 0 9 0;
#X connect 1 0 9 0;
#X connect 2 0 9 0;
#X connect 3 0 9 0;
#X connect 4 0 9 0;
#X connect 5 0 9 0;
#X connect 6 0 9 0;
#X connect 7 0 9 0;
#X connect 8 0 9 0;
#X connect 10 0 0 0;
#X connect 11 0 4 0;
#X connect 12 0 2 0;
#X connect 13 0 3 0;
#X connect 14 0 9 0;
#X connect 15 0 1 0;
#X connect 16 0 5 0;
#X connect 17 0 14 0;
#X connect 18 0 7 0;
#X connect 19 0 8 0;
#X connect 20 0 6 0;
#X restore 372 778 pd packslider;
#X f 18;
#X msg 467 246 addpoint \$1 xybuf;
#X msg 620 246 addpoint \$1 paramsbuf;
#X obj 467 270 fluid.dataset xydata;
#X obj 466 206 f, f 7;
#X obj 466 182 bng 19 250 50 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000;
#X msg 795 246 print;
#X msg 845 246 clear;
#X obj 134 185 vradio 19 1 0 2 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0;
#X obj 133 520 array get paramsbuf;
#X obj 133 544 unpack f f f f f f f f f f, f 28;
#X text 16 184 selecting points;
#X text 9 203 predicting points;
#X obj 620 270 fluid.dataset paramsdata;
#X msg 133 353 predictpoint xybuf paramsbuf;
#X obj 133 472 t b;
#X obj 133 444 route predictpoint fit;
#X msg 596 528 \; pd dsp \$1;
#X obj 596 501 tgl 19 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 619 504 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 619 502 1) turn audio on;
#X obj 283 36 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 283 34 2) set a point on both sliders;
#X obj 354 670 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 354 668 3) adjust the parameters for the chaotic synth, f 24;
#X obj 498 167 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X obj 505 355 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X obj 19 153 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 19 151 6) switch to predicting points, f 18;
#X obj 283 95 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 283 93 7) play around with the slider positions to morph between synth presets, f 22;
#X obj 598 41 cnv 19 150 30 empty empty Regressor 19 15 0 20 #00faff #ffffff 0;
#X obj 535 206 + 1;
#X text 498 165 4) click to add the settings to the datasets. repeat steps 2 to 4 to add more data to the datasets, f 52;
#X text 505 353 5) click to teach mlpregressor \, repeat to get as close to zero error as possible (the fit is shown in the console window), f 39;
#X obj 208 472 list;
#X listbox 208 496 20 0 0 0 - - - 0;
#X text 355 495 error;
#X obj 133 378 fluid.mlpregressor mlp -hiddenlayers 5 -activation 1 -outputactivation 1 -batchsize 1 -maxiter 10000 -learnrate 0.1 -validation 0, f 42;
#X obj 134 296 spigot;
#X obj 192 229 t b l;
#X connect 0 0 59 0;
#X connect 1 0 3 0;
#X connect 3 0 61 0;
#X connect 4 0 5 0;
#X connect 5 0 61 0;
#X connect 7 0 21 0;
#X connect 7 0 19 0;
#X connect 8 0 21 1;
#X connect 8 0 19 1;
#X connect 9 0 21 2;
#X connect 9 0 19 2;
#X connect 10 0 21 3;
#X connect 10 0 19 3;
#X connect 11 0 21 4;
#X connect 11 0 19 4;
#X connect 13 0 21 5;
#X connect 13 0 19 5;
#X connect 14 0 21 6;
#X connect 14 0 19 6;
#X connect 15 0 21 7;
#X connect 15 0 19 7;
#X connect 16 0 21 8;
#X connect 16 0 19 8;
#X connect 17 0 21 9;
#X connect 17 0 19 9;
#X connect 19 0 20 0;
#X connect 19 1 20 1;
#X connect 21 0 12 0;
#X connect 22 0 24 0;
#X connect 23 0 34 0;
#X connect 25 0 22 0;
#X connect 25 0 23 0;
#X connect 25 0 53 0;
#X connect 26 0 25 0;
#X connect 27 0 24 0;
#X connect 27 0 34 0;
#X connect 28 0 24 0;
#X connect 28 0 34 0;
#X connect 29 0 60 1;
#X connect 30 0 31 0;
#X connect 31 0 7 0;
#X connect 31 1 8 0;
#X connect 31 2 9 0;
#X connect 31 3 10 0;
#X connect 31 4 11 0;
#X connect 31 5 13 0;
#X connect 31 6 14 0;
#X connect 31 7 15 0;
#X connect 31 8 16 0;
#X connect 31 9 17 0;
#X connect 35 0 59 0;
#X connect 36 0 30 0;
#X connect 37 0 36 0;
#X connect 37 1 56 0;
#X connect 39 0 38 0;
#X connect 53 0 25 1;
#X connect 56 0 57 0;
#X connect 59 0 37 0;
#X connect 60 0 35 0;
#X connect 61 0 60 0;
#X connect 61 1 2 0;
Loading

0 comments on commit 2d6b46f

Please sign in to comment.