-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOSC-eeg.pd
85 lines (85 loc) · 2.5 KB
/
OSC-eeg.pd
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
#N canvas 1 49 958 1030 12;
#X floatatom 119 430 5 0 0 0 ch1 - -, f 5;
#X floatatom 447 430 5 0 0 1 ch2 - -, f 5;
#X obj 120 59 import mrpeach/net/udpreceive;
#X obj 119 161 udpreceive localhost 7777;
#X obj 119 198 unpackOSC;
#X obj 120 87 import osc/unpackOSC;
#X msg 119 127 status;
#X obj 315 274 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 262 340 print received;
#X obj 262 301 spigot;
#X obj 119 236 routeOSC /xxxxx;
#X text 342 161 <-- receive EEG packets from p2_parse.py OSC client
;
#X text 264 235 <-- all unpacked messages are addressed to /xxxxx;
#X text 339 271 <-- click me to see logs! edit mode off though;
#X obj 119 371 unpack f f f f f f;
#X obj 447 511 sig~;
#X obj 447 455 - 512;
#X obj 119 455 - 512;
#X obj 447 483 / 512;
#X obj 119 483 / 512;
#X text 514 454 <-- adjust 0-1023 range to +/-512;
#X text 513 481 <-- normalize to +/-1;
#X obj 119 511 sig~;
#X obj 446 539 hip~ 1;
#X text 517 539 <-- 1Hz high pass digital filter;
#X obj 119 538 hip~ 1;
#X text 277 373 <-- modeeg P2 format has 6 10-bit samples. We only
use 2;
#X text 197 20 2-channel EEG from OSC;
#X obj 119 615 bp~ 11.5 2.3;
#X obj 445 615 bp~ 11.5 2.3;
#X obj 118 688 snapshot~;
#X obj 176 656 metro 3.90625;
#X obj 239 631 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 445 686 snapshot~;
#X obj 503 654 metro 3.90625;
#X obj 566 629 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 559 611 <-- alpha bandpass (center=11.5 \, Q=2.3);
#X obj 118 723 abs;
#X obj 445 721 abs;
#X obj 118 763 * 1.1;
#X text 632 654 <-- fires every 1/256 sec;
#X text 487 721 <-- amplitude is absolute value;
#X obj 288 816 <=;
#X text 105 575 --------------------------------------------- <-- split
here;
#X text 396 770 <-- We want R/L > 1.1 \, but represent it at 1.1L <=
R to avoid ever dividing by zero.;
#X text 331 815 <-- the output of this block is a 1 to give feedback
\, 0 not;
#X connect 0 0 17 0;
#X connect 1 0 16 0;
#X connect 3 0 4 0;
#X connect 4 0 10 0;
#X connect 6 0 3 0;
#X connect 7 0 9 1;
#X connect 9 0 8 0;
#X connect 10 0 9 0;
#X connect 10 0 14 0;
#X connect 14 0 0 0;
#X connect 14 1 1 0;
#X connect 15 0 23 0;
#X connect 16 0 18 0;
#X connect 17 0 19 0;
#X connect 18 0 15 0;
#X connect 19 0 22 0;
#X connect 22 0 25 0;
#X connect 23 0 29 0;
#X connect 25 0 28 0;
#X connect 28 0 30 0;
#X connect 29 0 33 0;
#X connect 30 0 37 0;
#X connect 31 0 30 0;
#X connect 32 0 31 0;
#X connect 33 0 38 0;
#X connect 34 0 33 0;
#X connect 35 0 34 0;
#X connect 37 0 39 0;
#X connect 38 0 42 1;
#X connect 39 0 42 0;