Skip to content

Commit

Permalink
added Pure Data Classification Tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
tremblap committed Jul 14, 2024
1 parent be315b0 commit d5f0b7c
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/routes/(content)/learn/batch-processing/+page.svx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This section will demonstrate with code examples a number of ways in which batch
<Tabs>
<TabList>
<Tab>Max</Tab>
<Tab>PureData</Tab>
<Tab>Pure Data</Tab>
<Tab>SuperCollider</Tab>
</TabList>
<TabPanel> <!-- Max -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This tutorial guides you through building a sound classifier. It leverages a typ
<Tabs>
<TabList>
<Tab>Max</Tab>
<Tab>Pure Data</Tab>
<Tab>SuperCollider</Tab>
</TabList>
<TabPanel>
Expand All @@ -37,6 +38,11 @@ This tutorial guides you through building a sound classifier. It leverages a typ
</TabPanel>
<TabPanel>
<YouTube
url='ay6WWvKkjEw'
/>
</TabPanel>
<TabPanel>
<YouTube
url='Y1cHmtbQPSk'
/>
</TabPanel>
Expand Down
115 changes: 115 additions & 0 deletions static/examples/classification-video-demo.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#N canvas 77 57 1111 662 12;
#X obj 18 423 bng 19 250 50 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000;
#X obj 18 447 f;
#X obj 54 446 + 1;
#X msg 18 515 addpoint \$1 timbrebuf;
#X msg 197 515 addlabel \$1 \$2;
#X obj 18 539 fluid.dataset timbredata;
#X obj 197 539 fluid.labelset instrlabels;
#X msg 325 515 clear;
#X msg 377 515 print;
#X obj 20 141 +~, f 17;
#X obj 20 247 dac~;
#X obj 98 166 fluid.mfcc~ -startcoeff 1;
#N canvas 0 22 450 278 (subpatch) 0;
#X array timbrebuf 13 float 2;
#X coords 0 50 13 -50 160 143 1 0 0;
#X restore 244 201 graph;
#X msg 98 190 \; timbrebuf 0 \$1 \$2 \$3 \$4 \$5 \$6 \$7 \$8 \$9 \$10 \$11 \$12 \$13, f 18;
#X obj 509 166 fluid.loudness~;
#X msg 509 190 \$1;
#X obj 509 214 > -30;
#X obj 652 220 vradio 19 1 0 2 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0;
#X obj 651 311 *, f 8;
#X text 670 219 -Adding examples to the dataset & labelset;
#X text 671 239 -Making predictions;
#X obj 651 383 metro 50;
#X msg 651 407 predictpoint timbrebuf;
#X msg 819 407 fit timbredata instrlabels;
#X msg 1014 407 clear;
#X obj 651 497 route predictpoint fit;
#X obj 523 577 tgl 19 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 651 431 fluid.mlpclassifier -activation 1 -learnrate 0.05 -maxiter 1000, f 21;
#X msg 250 434 symbol trombone;
#X msg 278 457 symbol oboe;
#X obj 197 485 pack f s;
#X obj 651 554 list;
#X listbox 651 578 20 0 0 0 - - - 0;
#X obj 726 523 list;
#X listbox 726 547 20 0 0 0 - - - 0;
#X obj 486 21 cnv 19 200 30 empty empty Classification 15 15 0 20 #00faff #ffffff 0;
#X obj 79 3 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X msg 663 98 \; pd dsp \$1;
#X obj 663 71 tgl 19 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0 1;
#X obj 686 74 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 686 72 1) turn audio on;
#X obj 231 403 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 231 401 3) select the sound currently being played, f 23;
#X obj 14 349 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 14 347 4)click multiple times to add examples ensuring you don't click during silence. Repeat steps 2 to 4 for the other sound., f 28;
#X text 44 422 <---;
#X obj 825 349 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 825 347 5) click to teach mlpclassifier \, repeat to get as close to zero error as possible, f 22;
#X text 872 546 error;
#X text 793 577 class;
#X text 544 577 silence;
#X obj 741 161 cnv 15 15 15 empty empty empty 20 12 0 14 #c6ffc7 #404040 0;
#X text 741 159 6) switch to making predictions and play the different sounds to see the results, f 26;
#X obj 652 165 loadbang;
#X msg 652 189 0;
#X text 79 1 2) play a sound (make sure you stop one before playing the other), f 34;
#X obj 20 111 readsf~;
#X obj 220 111 readsf~;
#X msg 220 58 open ./media/Olencki-TenTromboneLongTones-M.wav \, 1, f 24;
#X msg 82 111 stop;
#X msg 278 110 stop;
#X msg 20 58 open ./media/Harker-DS-TenOboeMultiphonics-M.wav \, 1, f 23;
#X obj 20 34 bng 19 250 50 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000;
#X obj 220 34 bng 19 250 50 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000;
#X obj 523 383 expr 1 - $f1;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 0 3 0;
#X connect 1 0 30 0;
#X connect 2 0 1 1;
#X connect 3 0 5 0;
#X connect 4 0 6 0;
#X connect 7 0 6 0;
#X connect 7 0 5 0;
#X connect 8 0 6 0;
#X connect 8 0 5 0;
#X connect 9 0 10 0;
#X connect 9 0 10 1;
#X connect 9 0 11 0;
#X connect 9 0 14 0;
#X connect 11 0 13 0;
#X connect 14 0 15 0;
#X connect 15 0 16 0;
#X connect 16 0 18 0;
#X connect 17 0 18 1;
#X connect 18 0 21 0;
#X connect 18 0 64 0;
#X connect 21 0 22 0;
#X connect 22 0 27 0;
#X connect 23 0 27 0;
#X connect 24 0 27 0;
#X connect 25 0 31 0;
#X connect 25 1 33 0;
#X connect 27 0 25 0;
#X connect 28 0 30 1;
#X connect 29 0 30 1;
#X connect 30 0 4 0;
#X connect 31 0 32 0;
#X connect 33 0 34 0;
#X connect 38 0 37 0;
#X connect 53 0 54 0;
#X connect 54 0 17 0;
#X connect 56 0 9 0;
#X connect 57 0 9 1;
#X connect 58 0 57 0;
#X connect 59 0 56 0;
#X connect 60 0 57 0;
#X connect 61 0 56 0;
#X connect 62 0 61 0;
#X connect 63 0 58 0;
#X connect 64 0 26 0;
25 changes: 25 additions & 0 deletions static/examples/classification-video-starter.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#N canvas 63 10 925 437 12;
#X msg 57 28 open ./media/Harker-DS-TenOboeMultiphonics-M.wav \, 1
, f 25;
#X obj 57 116 readsf~;
#X msg 301 83 stop;
#X obj 292 114 readsf~;
#X obj 57 147 +~, f 34;
#X obj 57 199 dac~;
#X msg 292 29 open ./media/Olencki-TenTromboneLongTones-M.wav \, 1
, f 27;
#X obj 16 207 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000 0 1;
#X msg 16 227 \; pd dsp \$1;
#X obj 603 160 fluid.mlpclassifier -activation 1 -learnrate 0.05 -maxiter
1000, f 20;
#X msg 71 85 stop;
#X connect 0 0 1 0;
#X connect 1 0 4 0;
#X connect 2 0 3 0;
#X connect 3 0 4 1;
#X connect 4 0 5 0;
#X connect 4 0 5 1;
#X connect 6 0 3 0;
#X connect 7 0 8 0;
#X connect 10 0 1 0;

0 comments on commit d5f0b7c

Please sign in to comment.