aboutsummaryrefslogtreecommitdiff
path: root/examples/ann_mlp_example2/example2.pd
blob: 9cd588eab6619658e3e3095d496f883c2353d1b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
#N canvas 519 124 536 237 10;
#N canvas 103 30 712 583 guts 0;
#X obj 18 181 t b b;
#X obj 17 41 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X msg 89 147 0 \, destroy;
#X obj 111 177 gemwin;
#X msg 94 124 reset \, create \, 1;
#X obj 18 390 s masse;
#X obj 266 150 s reset_masse;
#X msg 266 128 bang;
#X text 359 281 <- right border;
#X text 360 303 <- left border;
#X text 360 325 <- top border;
#X text 360 347 <- bottom border;
#N canvas 116 11 813 636 pool 0;
#N canvas 0 0 819 344 fattori 0;
#N canvas 0 0 450 300 graph3 0;
#X array armoniche_caso 100 float 1;
#A 0 1.06332 1.06332 1.06332 1.38999 1.55333 1.55333 1.55333 1.55333
1.55333 1.55333 1.55333 1.71666 1.87999 2.04333 2.04333 2.20666 2.20666
2.20666 2.37 2.53333 2.53333 2.53333 2.69667 2.69667 2.69667 2.69667
2.69667 2.69667 2.69667 3.18667 3.18667 3.18667 3.18667 3.35 3.35 3.51334
3.84001 3.84001 4.00334 4.16668 4.16668 4.16668 4.16668 4.49334 4.65668
4.82001 5.31002 5.47335 5.80002 6.12669 6.61669 6.94336 7.27003 7.43336
7.92337 8.25003 8.5767 8.90337 9.23004 9.72004 10.3734 10.7 11.0267
11.19 11.5167 12.0067 12.4967 13.3134 13.64 13.9667 14.2934 14.9467
16.2534 16.5801 16.7434 17.2334 17.8867 19.0301 19.8467 20.9901 21.6434
22.1334 22.7867 23.1134 23.7667 24.2568 24.5834 24.9101 27.3601 28.3401
29.3201 30.3001 31.4435 32.5868 33.5668 34.5468 36.0168 37.8135 39.7735
50.7169;
#X coords 0 50 99 1 300 300 1;
#X restore 43 13 graph;
#X msg 434 69 \; armoniche_caso const 1;
#X restore 37 37 pd fattori caso;
#X text 34 19 weightened random values;
#X text 32 8 which harmonic am I?;
#X text 236 34 20 cellule;
#X obj 49 82 cellulaSuono 1;
#X obj 48 102 cellulaSuono 2;
#X obj 44 125 cellulaSuono 3;
#X obj 143 86 cellulaSuono 4;
#X obj 140 104 cellulaSuono 5;
#X obj 146 126 cellulaSuono 6;
#X restore 398 132 pd pool;
#N canvas 860 482 327 421 creation 0;
#X obj 43 319 s pd-new;
#X msg 86 95 \; pd filename new ./ \; #N canvas \; #X pop 1 \;;
#X msg 43 289 menuclose;
#X obj 76 238 pack f f f;
#X obj 43 47 sel 0 1;
#X obj 43 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X obj 61 72 t b b;
#X obj 76 187 t f f f;
#X obj 103 211 * 10;
#X obj 76 211 * 10;
#X obj 61 163 ch_uzi 30;
#X msg 76 265 obj \$1 \$2 cellulaSuono \$3;
#X connect 2 0 0 0;
#X connect 3 0 11 0;
#X connect 4 0 2 0;
#X connect 4 1 6 0;
#X connect 5 0 4 0;
#X connect 6 0 10 0;
#X connect 6 1 1 0;
#X connect 7 0 9 0;
#X connect 7 1 8 0;
#X connect 7 2 3 2;
#X connect 8 0 3 1;
#X connect 9 0 3 0;
#X connect 10 1 7 0;
#X connect 11 0 0 0;
#X restore 398 158 pd creation pool;
#X obj 61 214 s link;
#X text 39 39 <- begin (change the metro speed for slow computer);
#X floatatom 38 132 5 0 0 0 - - -;
#X text 359 257 <- give random speed and ambient viscosity;
#X obj 449 446 gemhead;
#X obj 449 467 translateXYZ;
#X msg 166 417 setX \$1;
#X msg 251 418 setY \$1;
#X obj 520 399 * -1;
#X obj 449 487 color 0.5 0 0;
#X obj 501 347 gemmouse 8 8;
#X obj 481 390 - 4;
#X obj 523 380 - 4;
#X obj 90 473 iCircle2D masse 0 0 0.1 8 0 0 -0.0003;
#X obj 53 280 iLine2D masse 3.5 -3.5 3.5 3.5 1000 0 0 2 1;
#X obj 63 305 iLine2D masse -3.5 3.5 -3.5 -3.5 1000 0 0 2 1;
#X obj 78 328 iLine2D masse 3.5 3.5 -3.5 3.5 1000 0 0 2 1;
#X obj 89 351 iLine2D masse -3.5 -3.5 3.5 -3.5 1000 0 0 2 1;
#X obj 449 507 sphere 0.6;
#X obj 18 154 metro 15;
#N canvas 0 0 555 394 osc 0;
#X obj 139 70 dumpOSC 10001;
#X obj 182 106 unpack s f;
#X msg 179 155 \; \$1 \$2;
#X obj 180 131 pack s f;
#X obj 263 113 r x;
#X obj 337 118 r y;
#X obj 258 210 s c_x;
#X obj 354 214 s c_y;
#X obj 348 151 / 25;
#X obj 264 151 / 40;
#X obj 260 176 clip 0 8;
#X obj 348 182 clip 0 8;
#X text 128 29 here is where I connect to EyesWeb to move the main
cell with a webcam following my hand;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 1 1 3 1;
#X connect 3 0 2 0;
#X connect 4 0 9 0;
#X connect 5 0 8 0;
#X connect 8 0 11 0;
#X connect 9 0 10 0;
#X connect 10 0 6 0;
#X connect 11 0 7 0;
#X restore 499 316 pd osc;
#X obj 453 365 r c_x;
#X obj 589 359 r c_y;
#X msg 156 102 cursor 0;
#X msg 126 66 bang;
#X msg 166 150 lighting 1;
#N canvas 450 44 494 396 sounds 0;
#X obj 158 307 dac~;
#X obj 76 66 catch~ mainL;
#X obj 160 153 line;
#X msg 159 131 \$1 10;
#X obj 273 41 vsl 15 128 0 1 0 0 empty empty Volume 0 -8 0 8 -262144
-1 -1 12700 1;
#X obj 144 179 *~;
#X obj 178 179 *~;
#X obj 164 67 catch~ mainR;
#X obj 304 42 loadbang;
#X msg 304 62 1;
#X obj 145 265 +~;
#X obj 177 268 +~;
#X obj 193 233 rev3~ 70 90 3000 20;
#X connect 1 0 5 0;
#X connect 2 0 5 1;
#X connect 2 0 6 1;
#X connect 3 0 2 0;
#X connect 4 0 3 0;
#X connect 5 0 10 0;
#X connect 5 0 12 0;
#X connect 6 0 11 0;
#X connect 6 0 12 1;
#X connect 7 0 6 0;
#X connect 8 0 9 0;
#X connect 9 0 4 0;
#X connect 10 0 0 0;
#X connect 11 0 0 1;
#X connect 12 0 10 1;
#X connect 12 1 11 1;
#X restore 398 189 pd sounds;
#X text 463 188 <-- here is the main volue control;
#N canvas 463 128 573 394 lights 0;
#X obj 242 277 world_light;
#X obj 242 163 gemhead 1;
#X obj 242 225 rotateXYZ;
#X msg 109 193 debug 0;
#X msg 110 224 debug 1;
#X text 20 169 figure out where the light is;
#X obj 311 47 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
;
#X obj 354 133 pack f f;
#X obj 334 159 line;
#X msg 364 42 1;
#X obj 364 23 loadbang;
#X obj 344 298 world_light;
#X obj 346 271 gemhead 1;
#X obj 429 203 loadbang;
#X obj 311 63 metro 20000;
#X msg 400 104 10000;
#X obj 119 57 delay 10000;
#X msg 339 96 300;
#X msg 292 96 50;
#X msg 364 235 1 1 1;
#X msg 422 266 0.6 0.3 0;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 6 0 14 0;
#X connect 7 0 8 0;
#X connect 8 0 2 2;
#X connect 9 0 6 0;
#X connect 10 0 9 0;
#X connect 10 0 15 0;
#X connect 12 0 11 0;
#X connect 13 0 19 0;
#X connect 13 0 20 0;
#X connect 14 0 17 0;
#X connect 14 0 16 0;
#X connect 15 0 7 1;
#X connect 16 0 18 0;
#X connect 17 0 7 0;
#X connect 18 0 7 0;
#X connect 19 0 0 1;
#X connect 20 0 11 1;
#X restore 266 189 pd lights;
#X text 337 49 example "stolen" from pmpd examples. move the main cell
with your mouse (or via osc) every cell is a random harmonic of A (from
1st to 50th) \, the velo of a cell is its volume also.;
#X obj 405 432 s posx;
#X obj 535 427 s posy;
#X obj 43 260 iAmbient2D masse 0 0 0.01 0.01 0.4;
#X obj 86 499 iCircle2D masse 0 0 0.1 0.7 0 0 4;
#X obj 17 19 inlet;
#X obj 85 19 inlet;
#X connect 0 0 5 0;
#X connect 0 1 14 0;
#X connect 0 1 27 0;
#X connect 0 1 28 0;
#X connect 0 1 29 0;
#X connect 0 1 30 0;
#X connect 0 1 31 0;
#X connect 0 1 46 0;
#X connect 0 1 47 0;
#X connect 1 0 33 0;
#X connect 1 0 38 0;
#X connect 2 0 3 0;
#X connect 4 0 3 0;
#X connect 7 0 6 0;
#X connect 16 0 33 1;
#X connect 18 0 19 0;
#X connect 19 0 23 0;
#X connect 20 0 27 0;
#X connect 20 0 47 0;
#X connect 21 0 27 0;
#X connect 21 0 47 0;
#X connect 22 0 21 0;
#X connect 22 0 19 2;
#X connect 22 0 45 0;
#X connect 23 0 32 0;
#X connect 24 0 25 0;
#X connect 24 1 26 0;
#X connect 25 0 20 0;
#X connect 25 0 19 1;
#X connect 25 0 44 0;
#X connect 26 0 22 0;
#X connect 33 0 0 0;
#X connect 35 0 25 0;
#X connect 36 0 26 0;
#X connect 37 0 3 0;
#X connect 38 0 4 0;
#X connect 38 0 39 0;
#X connect 38 0 37 0;
#X connect 39 0 3 0;
#X connect 48 0 1 0;
#X connect 49 0 2 0;
#X restore 18 68 pd guts;
#X obj 17 18 tgl 15 0 empty empty rendering 0 -6 0 8 -262144 -1 -1
0 1;
#X obj 54 46 bng 15 250 50 0 empty empty destroy_gemwin 0 -6 0 8 -262144
-1 -1;
#N canvas 206 22 774 557 train 0;
#X msg 66 15 create 20 4;
#X obj 66 345 unpack f f f f;
#X floatatom 45 391 5 0 0 0 - - -;
#X floatatom 83 390 5 0 0 0 - - -;
#X floatatom 120 392 5 0 0 0 - - -;
#X floatatom 160 394 5 0 0 0 - - -;
#X text 118 405 chaos;
#N canvas 0 0 642 332 inputs 0;
#X obj 122 244 outlet;
#X obj 24 42 inlet;
#X text 23 22 bang;
#X obj 76 19 r 1-X;
#X obj 111 19 r 1-Y;
#X obj 145 19 r 1-Velo;
#X obj 86 47 r 2-X;
#X obj 121 47 r 2-Y;
#X obj 155 47 r 2-Velo;
#X obj 222 20 r 3-X;
#X obj 257 21 r 3-Y;
#X obj 291 21 r 3-Velo;
#X obj 220 46 r 4-X;
#X obj 255 46 r 4-Y;
#X obj 289 46 r 4-Velo;
#X obj 359 23 r 5-X;
#X obj 394 23 r 5-Y;
#X obj 428 23 r 5-Velo;
#X obj 358 51 r 6-X;
#X obj 393 51 r 6-Y;
#X obj 427 51 r 6-Velo;
#X obj 420 99 r posx;
#X obj 464 99 r posy;
#X obj 61 153 pack s f f f f f f f f f f f f f f f f f f f f;
#X obj 127 175 unpack s f f f f f f f f f f f f f f f f f f f f;
#X obj 127 213 pack f f f f f f f f f f f f f f f f f f f f;
#X connect 1 0 23 0;
#X connect 3 0 23 1;
#X connect 4 0 23 2;
#X connect 5 0 23 3;
#X connect 6 0 23 4;
#X connect 7 0 23 5;
#X connect 8 0 23 6;
#X connect 9 0 23 7;
#X connect 10 0 23 8;
#X connect 11 0 23 9;
#X connect 12 0 23 10;
#X connect 13 0 23 11;
#X connect 14 0 23 12;
#X connect 15 0 23 13;
#X connect 16 0 23 14;
#X connect 17 0 23 15;
#X connect 18 0 23 16;
#X connect 19 0 23 17;
#X connect 20 0 23 18;
#X connect 21 0 23 19;
#X connect 22 0 23 20;
#X connect 23 0 24 0;
#X connect 24 1 25 0;
#X connect 24 2 25 1;
#X connect 24 3 25 2;
#X connect 24 4 25 3;
#X connect 24 5 25 4;
#X connect 24 6 25 5;
#X connect 24 7 25 6;
#X connect 24 8 25 7;
#X connect 24 9 25 8;
#X connect 24 10 25 9;
#X connect 24 11 25 10;
#X connect 24 12 25 11;
#X connect 24 13 25 12;
#X connect 24 14 25 13;
#X connect 24 15 25 14;
#X connect 24 16 25 15;
#X connect 24 17 25 16;
#X connect 24 18 25 17;
#X connect 24 19 25 18;
#X connect 24 20 25 19;
#X connect 25 0 0 0;
#X restore 190 226 pd inputs;
#X obj 190 206 metro 100;
#X obj 190 187 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X text 161 408 calm & close;
#X obj 42 421 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144
-1 -1 0 1;
#X obj 80 421 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144
-1 -1 0 1;
#X obj 115 421 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144
-1 -1 0 1;
#X obj 154 425 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144
-1 -1 0 1;
#X msg 247 306 save complex.net;
#X msg 247 324 load conplex.net;
#X text 148 15 1- create the ann;
#N canvas 350 135 693 354 train 0;
#X obj 107 286 outlet;
#X msg 73 161 iterations_between_reports 1000;
#X msg 198 224 train-on-file complex.txt;
#X text 200 242 training on files with many patterns may take minutes
\, please be patient.;
#X msg 73 109 desired_error 0.06;
#X msg 77 135 max_iterations 200000;
#X text 69 76 due to the complexity of the input and output data you
should change the default training parameters:;
#X text 219 134 smaller cycle;
#N canvas 190 67 849 551 write 0;
#X obj 65 417 textfile;
#X msg 190 337 clear;
#N canvas 0 0 458 308 alternate 0;
#X obj 103 117 + 1;
#X obj 70 119 f 0;
#X obj 70 171 sel 0 1;
#X obj 70 146 mod 2;
#X msg 95 90 0;
#X obj 68 31 inlet;
#X obj 140 40 inlet;
#X obj 140 63 bang;
#X obj 68 55 bang;
#X obj 65 205 outlet;
#X obj 125 206 outlet;
#X text 59 6 bang;
#X text 139 18 reset to 0 without bang;
#X connect 0 0 1 1;
#X connect 1 0 0 0;
#X connect 1 0 3 0;
#X connect 2 0 9 0;
#X connect 2 1 10 0;
#X connect 3 0 2 0;
#X connect 4 0 1 1;
#X connect 5 0 8 0;
#X connect 6 0 7 0;
#X connect 7 0 4 0;
#X connect 8 0 1 0;
#X restore 58 227 pd alternate;
#X obj 24 81 bng 15 250 50 0 empty empty write-once 0 -6 0 8 -262144
-1 -1;
#X obj 457 108 bng 15 250 50 0 empty empty reset 0 -6 0 8 -262144 -1
-1;
#N canvas 0 0 638 328 inputs 0;
#X obj 64 271 outlet;
#X text 118 272 to textfile;
#X obj 24 42 inlet;
#X text 23 22 bang;
#X obj 76 19 r 1-X;
#X obj 111 19 r 1-Y;
#X obj 145 19 r 1-Velo;
#X obj 86 47 r 2-X;
#X obj 121 47 r 2-Y;
#X obj 155 47 r 2-Velo;
#X obj 222 20 r 3-X;
#X obj 257 21 r 3-Y;
#X obj 291 21 r 3-Velo;
#X obj 220 46 r 4-X;
#X obj 255 46 r 4-Y;
#X obj 289 46 r 4-Velo;
#X obj 359 23 r 5-X;
#X obj 394 23 r 5-Y;
#X obj 428 23 r 5-Velo;
#X obj 358 51 r 6-X;
#X obj 393 51 r 6-Y;
#X obj 427 51 r 6-Velo;
#X obj 420 99 r posx;
#X obj 464 99 r posy;
#X obj 61 153 pack s f f f f f f f f f f f f f f f f f f f f;
#X obj 127 175 unpack s f f f f f f f f f f f f f f f f f f f f;
#X obj 127 213 pack f f f f f f f f f f f f f f f f f f f f f;
#X msg 64 236 add \$2 \$3 \$4 \$5 \$6 \$7 \$8 \$9 \$10 \$11 \$12 \$13
\$14 \$15 \$16 \$17 \$18 \$19 \$20 \$21;
#X connect 2 0 24 0;
#X connect 4 0 24 1;
#X connect 5 0 24 2;
#X connect 6 0 24 3;
#X connect 7 0 24 4;
#X connect 8 0 24 5;
#X connect 9 0 24 6;
#X connect 10 0 24 7;
#X connect 11 0 24 8;
#X connect 12 0 24 9;
#X connect 13 0 24 10;
#X connect 14 0 24 11;
#X connect 15 0 24 12;
#X connect 16 0 24 13;
#X connect 17 0 24 14;
#X connect 18 0 24 15;
#X connect 19 0 24 16;
#X connect 20 0 24 17;
#X connect 21 0 24 18;
#X connect 22 0 24 19;
#X connect 23 0 24 20;
#X connect 24 0 27 0;
#X connect 25 1 26 0;
#X connect 25 2 26 1;
#X connect 25 3 26 2;
#X connect 25 4 26 3;
#X connect 25 5 26 4;
#X connect 25 6 26 5;
#X connect 25 7 26 6;
#X connect 27 0 0 0;
#X restore 58 306 pd inputs;
#N canvas 0 0 474 324 outputs 0;
#X obj 131 202 pack f f;
#X obj 129 178 unpack s f f;
#X obj 66 257 outlet;
#X text 120 258 to textfile;
#X obj 24 42 inlet;
#X text 23 22 bang;
#X text 66 77 here go the outputs;
#X obj 91 51 r output1;
#X obj 166 51 r output2;
#X obj 243 51 r output3;
#X obj 318 51 r output4;
#X obj 61 153 pack s f f f f;
#X msg 67 227 add \$2 \$3 \$4 \$5;
#X connect 1 1 0 0;
#X connect 1 2 0 1;
#X connect 4 0 11 0;
#X connect 7 0 11 1;
#X connect 8 0 11 2;
#X connect 9 0 11 3;
#X connect 10 0 11 4;
#X connect 11 0 12 0;
#X connect 12 0 2 0;
#X restore 149 284 pd outputs;
#X obj 230 223 f 0;
#X obj 260 223 + 1;
#X obj 239 257 nbx 5 14 -1e+037 1e+037 0 0 empty empty how_many_datasets
0 -6 0 10 -262144 -1 -1 0 256;
#X text 156 406 todo: write header (a line at the beginning of file
with 3 int: how many tests \, num_input \, num_output);
#X obj 122 190 delay 50;
#X obj 115 159 metro 100;
#X floatatom 346 70 5 100 5000 2 msec_between_snapshots - -;
#X obj 127 80 tgl 15 0 empty empty toggle_on-off 0 -6 0 8 -262144 -1
-1 0 1;
#X obj 219 189 / 2;
#X obj 347 14 loadbang;
#X text 293 224 comment;
#N canvas 262 68 635 591 README 0;
#X text 11 63 how to use: 1) modify [pd inputs] and [ps outputs] inserting
[r] objects to receive input data \, and modify [pack]s to handle the
right number of inputs 2) do the same with [pd outputs] 3) click on
reset 4) toggle ON and start collectng data 5) when you are ready toggle
OFF 6) edit [write filename cr( with the actual filename you want for
your training data (always keep the cr after the filename) 7) open
the file with training data 8) add a line at the beginning and write
3 integers: the 1st is the number of training dataset written (see
"how many datasets" number box) \, the 2nd is how many inputs your
ann has \, the 3th is how many outputs e.g. i collected 100 training
snapshots \, for a ann with 10 ins and 2 outs I write: 100 10 2 at
the very beginning of the file now the training file is ready and can
be read from nn via train-on-file command;
#X text 143 489 please help me getting this patch more usable: - how
to add a line at the very beginning of a text file after i have filled
it? - how to manage inputs and outputs of different sized without forcing
the user to edit the patch?;
#X text 9 7 this tricky patch is usefull to write a file to train ann
and is intended to be used with the nn external;
#X restore 33 13 pd README;
#X text 516 7 by davide morelli info@davidemorelli.it;
#X text 106 14 <--readme!;
#X msg 347 34 500;
#X obj 129 41 inlet;
#X msg 368 328 write complex.txt cr;
#X msg 303 180 0;
#N canvas 0 0 482 332 outputs 0;
#X obj 89 60 key;
#X obj 41 122 sel 97;
#X text 84 101 "a" key;
#X obj 218 120 sel 115;
#N canvas 0 0 458 308 a 0;
#X obj 130 150 s output1;
#X obj 86 76 inlet;
#X text 88 56 bang;
#X obj 241 80 inlet;
#X text 243 60 reset;
#X msg 86 101 1;
#X msg 241 110 0;
#X connect 1 0 5 0;
#X connect 3 0 6 0;
#X connect 5 0 0 0;
#X connect 6 0 0 0;
#X restore 41 145 pd a pressed;
#N canvas 0 0 458 308 s 0;
#X obj 86 76 inlet;
#X text 88 56 bang;
#X obj 241 80 inlet;
#X text 243 60 reset;
#X msg 86 101 1;
#X msg 241 110 0;
#X obj 130 150 s output2;
#X connect 0 0 4 0;
#X connect 2 0 5 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X restore 217 142 pd s pressed;
#X text 295 92 "s" key;
#X obj 228 57 keyup;
#X obj 132 123 sel 97;
#X obj 308 120 sel 115;
#X floatatom 19 80 5 0 0 0 - - -;
#X obj 39 183 sel 100;
#X obj 130 184 sel 100;
#X obj 216 181 sel 102;
#X obj 306 181 sel 102;
#N canvas 0 0 462 312 d 0;
#X obj 86 76 inlet;
#X text 88 56 bang;
#X obj 241 80 inlet;
#X text 243 60 reset;
#X msg 86 101 1;
#X msg 241 110 0;
#X obj 130 150 s output3;
#X connect 0 0 4 0;
#X connect 2 0 5 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X restore 39 206 pd d pressed;
#N canvas 0 0 470 320 f 0;
#X obj 86 76 inlet;
#X text 88 56 bang;
#X obj 241 80 inlet;
#X text 243 60 reset;
#X msg 86 101 1;
#X msg 241 110 0;
#X obj 130 150 s output4;
#X connect 0 0 4 0;
#X connect 2 0 5 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X restore 215 203 pd f pressed;
#X connect 0 0 1 0;
#X connect 0 0 3 0;
#X connect 0 0 10 0;
#X connect 0 0 11 0;
#X connect 0 0 13 0;
#X connect 1 0 4 0;
#X connect 3 0 5 0;
#X connect 7 0 8 0;
#X connect 7 0 9 0;
#X connect 7 0 12 0;
#X connect 7 0 14 0;
#X connect 8 0 4 1;
#X connect 9 0 5 1;
#X connect 11 0 15 0;
#X connect 12 0 15 1;
#X connect 13 0 16 0;
#X connect 14 0 16 1;
#X restore 439 206 pd outputs;
#X obj 431 237 r output1;
#X obj 499 236 r output2;
#X floatatom 431 258 5 0 0 0 - - -;
#X floatatom 498 258 5 0 0 0 - - -;
#X floatatom 568 256 5 0 0 0 - - -;
#X floatatom 635 257 5 0 0 0 - - -;
#X obj 568 235 r output3;
#X obj 636 235 r output4;
#X text 431 270 sx;
#X text 496 272 dx;
#X text 566 269 chaos;
#X text 635 269 calm;
#X text 434 171 4 outputs: using keyboard: asdf: a=sx-ness \, s=dx-ness
\, d=chaos-ness \, f=calm-ness;
#X text 363 348 remember to add a line at the beginning of the file
with 3 integers... how_many_patterns 20 4 ...see README;
#X text 142 308 <--we have 20 inputs;
#X text 242 283 <--we have 4 outputs;
#X connect 1 0 0 0;
#X connect 2 0 5 0;
#X connect 2 1 6 0;
#X connect 2 1 7 0;
#X connect 3 0 11 0;
#X connect 3 0 2 0;
#X connect 4 0 2 1;
#X connect 4 0 1 0;
#X connect 4 0 24 0;
#X connect 5 0 0 0;
#X connect 6 0 0 0;
#X connect 7 0 8 0;
#X connect 7 0 9 0;
#X connect 8 0 7 1;
#X connect 11 0 2 0;
#X connect 12 0 11 0;
#X connect 12 0 2 0;
#X connect 13 0 12 1;
#X connect 13 0 15 0;
#X connect 14 0 12 0;
#X connect 15 0 11 1;
#X connect 16 0 21 0;
#X connect 21 0 13 0;
#X connect 22 0 14 0;
#X connect 23 0 0 0;
#X connect 24 0 7 1;
#X connect 26 0 28 0;
#X connect 27 0 29 0;
#X connect 32 0 30 0;
#X connect 33 0 31 0;
#X restore 40 27 pd write trainfile;
#X text 163 28 1- write a trainfile;
#X text 69 63 2- adjust parameters before training;
#X text 225 205 3- train on the file;
#X text 195 110 higher error allowed;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 0 0;
#X restore 114 71 pd train on file;
#X text 217 70 2a- train using a file or;
#N canvas 0 0 900 594 train 0;
#X obj 66 319 outlet;
#N canvas 0 0 793 344 inputs 0;
#X obj 122 244 outlet;
#X obj 24 42 inlet;
#X text 23 22 bang;
#X obj 76 19 r 1-X;
#X obj 111 19 r 1-Y;
#X obj 145 19 r 1-Velo;
#X obj 86 47 r 2-X;
#X obj 121 47 r 2-Y;
#X obj 155 47 r 2-Velo;
#X obj 222 20 r 3-X;
#X obj 257 21 r 3-Y;
#X obj 291 21 r 3-Velo;
#X obj 220 46 r 4-X;
#X obj 255 46 r 4-Y;
#X obj 289 46 r 4-Velo;
#X obj 359 23 r 5-X;
#X obj 394 23 r 5-Y;
#X obj 428 23 r 5-Velo;
#X obj 358 51 r 6-X;
#X obj 393 51 r 6-Y;
#X obj 427 51 r 6-Velo;
#X obj 395 88 r posx;
#X obj 439 88 r posy;
#X obj 550 29 r output1;
#X obj 574 48 r output2;
#X obj 598 68 r output3;
#X obj 615 87 r output4;
#X obj 61 153 pack s f f f f f f f f f f f f f f f f f f f f f f f
f;
#X obj 127 175 unpack s f f f f f f f f f f f f f f f f f f f f f f
f f;
#X obj 127 213 pack f f f f f f f f f f f f f f f f f f f f f f f f
;
#X connect 1 0 27 0;
#X connect 3 0 27 1;
#X connect 4 0 27 2;
#X connect 5 0 27 3;
#X connect 6 0 27 4;
#X connect 7 0 27 5;
#X connect 8 0 27 6;
#X connect 9 0 27 7;
#X connect 10 0 27 8;
#X connect 11 0 27 9;
#X connect 12 0 27 10;
#X connect 13 0 27 11;
#X connect 14 0 27 12;
#X connect 15 0 27 13;
#X connect 16 0 27 14;
#X connect 17 0 27 15;
#X connect 18 0 27 16;
#X connect 19 0 27 17;
#X connect 20 0 27 18;
#X connect 21 0 27 19;
#X connect 22 0 27 20;
#X connect 23 0 27 21;
#X connect 24 0 27 22;
#X connect 25 0 27 23;
#X connect 26 0 27 24;
#X connect 27 0 28 0;
#X connect 28 1 29 0;
#X connect 28 2 29 1;
#X connect 28 3 29 2;
#X connect 28 4 29 3;
#X connect 28 5 29 4;
#X connect 28 6 29 5;
#X connect 28 7 29 6;
#X connect 28 8 29 7;
#X connect 28 9 29 8;
#X connect 28 10 29 9;
#X connect 28 11 29 10;
#X connect 28 12 29 11;
#X connect 28 13 29 12;
#X connect 28 14 29 13;
#X connect 28 15 29 14;
#X connect 28 16 29 15;
#X connect 28 17 29 16;
#X connect 28 18 29 17;
#X connect 28 19 29 18;
#X connect 28 20 29 19;
#X connect 28 21 29 20;
#X connect 28 22 29 21;
#X connect 28 23 29 22;
#X connect 28 24 29 23;
#X connect 29 0 0 0;
#X restore 213 222 pd inputs;
#X obj 213 202 metro 100;
#X obj 213 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X msg 84 16 train;
#N canvas 0 0 482 332 outputs 0;
#X obj 89 60 key;
#X obj 41 122 sel 97;
#X text 84 101 "a" key;
#X obj 218 120 sel 115;
#N canvas 0 0 458 308 a 0;
#X obj 130 150 s output1;
#X obj 86 76 inlet;
#X text 88 56 bang;
#X obj 241 80 inlet;
#X text 243 60 reset;
#X msg 86 101 1;
#X msg 241 110 0;
#X connect 1 0 5 0;
#X connect 3 0 6 0;
#X connect 5 0 0 0;
#X connect 6 0 0 0;
#X restore 41 145 pd a pressed;
#N canvas 0 0 458 308 s 0;
#X obj 86 76 inlet;
#X text 88 56 bang;
#X obj 241 80 inlet;
#X text 243 60 reset;
#X msg 86 101 1;
#X msg 241 110 0;
#X obj 130 150 s output2;
#X connect 0 0 4 0;
#X connect 2 0 5 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X restore 217 142 pd s pressed;
#X text 295 92 "s" key;
#X obj 228 57 keyup;
#X obj 132 123 sel 97;
#X obj 308 120 sel 115;
#X floatatom 19 80 5 0 0 0 - - -;
#X obj 39 183 sel 100;
#X obj 130 184 sel 100;
#X obj 216 181 sel 102;
#X obj 306 181 sel 102;
#N canvas 0 0 462 312 d 0;
#X obj 86 76 inlet;
#X text 88 56 bang;
#X obj 241 80 inlet;
#X text 243 60 reset;
#X msg 86 101 1;
#X msg 241 110 0;
#X obj 130 150 s output3;
#X connect 0 0 4 0;
#X connect 2 0 5 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X restore 39 206 pd d pressed;
#N canvas 0 0 470 320 f 0;
#X obj 86 76 inlet;
#X text 88 56 bang;
#X obj 241 80 inlet;
#X text 243 60 reset;
#X msg 86 101 1;
#X msg 241 110 0;
#X obj 130 150 s output4;
#X connect 0 0 4 0;
#X connect 2 0 5 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X restore 215 203 pd f pressed;
#X connect 0 0 1 0;
#X connect 0 0 3 0;
#X connect 0 0 10 0;
#X connect 0 0 11 0;
#X connect 0 0 13 0;
#X connect 1 0 4 0;
#X connect 3 0 5 0;
#X connect 7 0 8 0;
#X connect 7 0 9 0;
#X connect 7 0 12 0;
#X connect 7 0 14 0;
#X connect 8 0 4 1;
#X connect 9 0 5 1;
#X connect 11 0 15 0;
#X connect 12 0 15 1;
#X connect 13 0 16 0;
#X connect 14 0 16 1;
#X restore 131 57 pd outputs;
#X obj 130 87 r output1;
#X obj 198 86 r output2;
#X floatatom 130 108 5 0 0 0 - - -;
#X floatatom 197 108 5 0 0 0 - - -;
#X floatatom 267 106 5 0 0 0 - - -;
#X floatatom 334 107 5 0 0 0 - - -;
#X obj 267 85 r output3;
#X obj 335 85 r output4;
#X text 128 14 1- change to training mode;
#X text 204 49 2- change keys if you want;
#X text 220 61 defaults are "a" "s" "d" "f";
#X text 239 182 3- toggle on to start training and off to stop;
#X msg 170 282 run;
#X text 200 283 4- switch to run mode when ready;
#X obj 305 226 inlet;
#X obj 305 249 nbx 8 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
10 -262144 -1 -1 0 256;
#X text 344 218 note: while in training mode the right outlet gives
you the mean square error.;
#X connect 1 0 0 0;
#X connect 2 0 1 0;
#X connect 3 0 2 0;
#X connect 4 0 0 0;
#X connect 6 0 8 0;
#X connect 7 0 9 0;
#X connect 12 0 10 0;
#X connect 13 0 11 0;
#X connect 18 0 0 0;
#X connect 20 0 21 0;
#X restore 133 114 pd train on the fly;
#X text 255 113 2b- train on the fly in realtime;
#X text 224 182 3- run the nn switching this metro ON;
#X text 277 213 (note \, you must be in run mode);
#X msg 281 231 run;
#X text 34 403 left;
#X text 75 404 right;
#X text 356 305 4- when you are happy with you nn save it;
#X text 354 323 remember that you can load it also passing filename
as argument;
#X obj 301 404 nbx 8 14 -1e+037 1e+037 0 0 empty empty mse 0 -6 0 10
-262144 -1 -1 0 256;
#X text 300 422 mse is usefull while training on-the-fly: tells you
the global error in the net \, how much net's output differs from desired
output.;
#X obj 66 325 ann_mlp complex.net;
#X connect 0 0 31 0;
#X connect 1 0 2 0;
#X connect 1 1 3 0;
#X connect 1 2 4 0;
#X connect 1 3 5 0;
#X connect 2 0 11 0;
#X connect 3 0 12 0;
#X connect 4 0 13 0;
#X connect 5 0 14 0;
#X connect 7 0 31 0;
#X connect 8 0 7 0;
#X connect 9 0 8 0;
#X connect 15 0 31 0;
#X connect 16 0 31 0;
#X connect 18 0 31 0;
#X connect 20 0 31 0;
#X connect 24 0 31 0;
#X connect 31 0 1 0;
#X connect 31 1 29 0;
#X connect 31 1 20 0;
#X restore 16 142 pd train and run nn;
#X text 101 12 1- start rendering;
#X text 141 142 2- open the subpatch and follow instructions;
#X connect 1 0 0 0;
#X connect 2 0 0 1;