heading-ears-mmp/iamyou-radio/main.pd
2024-10-15 12:46:39 +09:00

501 lines
15 KiB
Text

#N canvas 1 91 880 512 10;
#X msg 265 218 37.573 638 126.924 850;
#X obj 94 264 r \$0-compass;
#X obj 65 195 loadbang;
#X obj 37 241 r listening-location;
#X msg 65 218 37.563 638 126.927 850;
#N canvas 1 91 792 464 guts 0;
#X obj 14 14 receive fromSystem;
#X obj 14 60 route /location /compass;
#X obj 14 37 list trim;
#X obj 14 113 unpack f f f f f f f f f;
#X obj 63 192 pack f f f f, f 19;
#X obj 84 83 s \$0-compass;
#X obj 83 225 s latlon;
#X obj 45 258 print locations:;
#N canvas 1 91 604 394 notes 0;
#X text 18 15 when location data is enabled \, it is sent via a message
"/location" with 9 numbers. Location coordinate data in iOS is a 64-bit
floating point number (double);
#X text 18 65 PureData is only 32-bit float \, so sending that number
into a patch loses resolution. However \, a tweaky workaround (via
64-bit math in the iOS layer) is provided by the last 4 numbers in
the message.;
#X text 18 125 arg #1: latitude coordinate (as 32-bit float);
#X text 18 145 arg #2: longitude coordinate (as 32-bit float);
#X text 18 165 arg #3: altitude (meters);
#X text 18 185 arg #4: horizontal accuracy (meters radius);
#X text 18 205 arg #5: vertical (altitude) accuracy (meters radius)
;
#X text 18 235 arg #6: latitude "rough";
#X text 18 275 arg #8: latitude "fine";
#X text 18 255 arg #7: longitude "rough";
#X text 18 295 arg #9: longitude "fine";
#X text 208 235 latitude/longitude "rough" = 64-bit value multiplied
by 1000 and truncated to an integer before being sent into Pd;
#X text 208 285 latitude/longitude "fine" = 64-bit value modded by
0.001 \, multiplied by 1e+06 \, and truncated to an integer \, before
being sent into Pd So the "rough" contains the significant digits up
to the thousandths place \, and the "fine" contains the next three
significant digits. An original coordinate value of 123.457 would be
turned into rough=123456 fine=789.;
#X restore 223 113 pd notes;
#X text 202 188 arg #6: latitude "rough";
#X text 202 228 arg #8: latitude "fine";
#X text 202 208 arg #7: longitude "rough";
#X text 202 248 arg #9: longitude "fine";
#X text 170 113 <======;
#N canvas 1 91 1358 672 gui 0;
#X obj 16 239 send toGUI;
#X obj 526 72 list trim;
#X obj 526 49 receive fromGUI;
#X msg 526 118 list /enableLocation \$1;
#X obj 526 141 send toSystem;
#X obj 356 49 loadbang;
#X obj 356 95 send toGUI;
#N canvas 590 91 614 581 draw_arrow 0;
#X obj 89 257 rot2d;
#X msg 89 149 0.5 0.6;
#X obj 70 327 list store;
#X msg 106 172 0.4 0.7;
#X msg 140 218 0.6 0.7;
#X obj 89 280 list prepend append;
#X obj 89 303 list trim;
#X obj 70 103 t b b b;
#X obj 89 126 t b b b b;
#X obj 70 81 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000;
#X obj 70 19 inlet;
#X obj 70 42 t b a;
#X obj 209 219 t a;
#X obj 242 199 t a;
#X msg 123 195 0.5 0;
#X obj 70 350 list prepend /lcd.Pointer paintpoly;
#X obj 70 373 t b a b;
#X msg 70 419 list /lcd.Pointer paintoval 0.45 0.45 0.55 0.55 1 1 1
1;
#X obj 89 442 send toGUI;
#X msg 244 311 list /lcd.Pointer paintoval 0 0 1 1 0.6 1 0.6 1;
#X msg 244 288 list /lcd.Pointer paintoval 0 0 1 1 0 0.8 0.6 1;
#X msg 109 396 list /lcd.Pointer paintoval 0 0 1 1 0.6 1 0.6 1;
#X connect 0 0 5 0;
#X connect 1 0 0 0;
#X connect 2 0 15 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 6 0;
#X connect 6 0 2 0;
#X connect 7 0 2 0;
#X connect 7 1 8 0;
#X connect 7 2 12 0;
#X connect 8 0 1 0;
#X connect 8 1 3 0;
#X connect 8 2 14 0;
#X connect 8 3 4 0;
#X connect 9 0 7 0;
#X connect 10 0 11 0;
#X connect 11 0 9 0;
#X connect 11 1 13 0;
#X connect 12 0 2 1;
#X connect 13 0 0 2;
#X connect 14 0 0 0;
#X connect 15 0 16 0;
#X connect 16 0 17 0;
#X connect 16 1 18 0;
#X connect 16 2 21 0;
#X connect 17 0 18 0;
#X connect 21 0 18 0;
#X restore 406 597 pd draw_arrow;
#X floatatom 406 403 5 0 0 1 angle_(deg) - - 0;
#X obj 28 625 send toGUI;
#X floatatom 406 335 5 0 0 1 angle_(deg) - - 0;
#X obj 406 380 +;
#X obj 406 357 * -1;
#X obj 406 312 r \$0-compass;
#X obj 586 417 r \$0-brng;
#X obj 28 579 r \$0-dist;
#X obj 154 372 loadbang;
#X obj 154 395 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc
#000000 #000000;
#N canvas 592 91 458 517 draw_arrow 0;
#X obj 89 257 rot2d;
#X msg 89 149 0.5 0.6;
#X obj 70 327 list store;
#X msg 106 172 0.4 0.7;
#X msg 140 218 0.6 0.7;
#X obj 89 280 list prepend append;
#X obj 89 303 list trim;
#X obj 70 103 t b b b;
#X obj 89 126 t b b b b;
#X obj 70 81 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000;
#X obj 70 19 inlet;
#X obj 70 42 t b a;
#X obj 209 219 t a;
#X obj 242 199 t a;
#X obj 87 465 send toGUI;
#X obj 70 350 list prepend /lcd.Compass paintpoly;
#X msg 70 442 list /lcd.Compass paintoval 0.45 0.45 0.55 0.55 1 1 1
1;
#X obj 70 373 t b a b b;
#X msg 123 195 0.5 0.1;
#X msg 104 418 list /lcd.Compass frameoval 0.1 0.1 0.9 0.9 0 1 1 1
;
#X msg 121 395 list /lcd.Compass paintoval 0 0 1 1 1 1 0 1;
#X connect 0 0 5 0;
#X connect 1 0 0 0;
#X connect 2 0 15 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 6 0;
#X connect 6 0 2 0;
#X connect 7 0 2 0;
#X connect 7 1 8 0;
#X connect 7 2 12 0;
#X connect 8 0 1 0;
#X connect 8 1 3 0;
#X connect 8 2 18 0;
#X connect 8 3 4 0;
#X connect 9 0 7 0;
#X connect 10 0 11 0;
#X connect 11 0 9 0;
#X connect 11 1 13 0;
#X connect 12 0 2 1;
#X connect 13 0 0 2;
#X connect 15 0 17 0;
#X connect 16 0 14 0;
#X connect 17 0 16 0;
#X connect 17 1 14 0;
#X connect 17 3 20 0;
#X connect 18 0 0 0;
#X connect 19 0 14 0;
#X connect 20 0 14 0;
#X restore 16 425 pd draw_arrow;
#X floatatom 16 335 5 0 0 1 angle_(deg) - - 0;
#X obj 16 312 r \$0-compass;
#X text 11 16 disp. lat/long in text;
#X text 354 18 toggle gps reception + automatically enable at start-up
;
#X floatatom 16 403 5 0 0 1 angle_(deg) - - 0;
#X obj 16 357 * -1;
#X obj 16 380 + 360;
#X text 25 544 disp. distance (km) in text;
#X obj 850 281 s toGUI;
#X obj 807 284 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000 0 1;
#X obj 757 238 f;
#X obj 807 238 + 1;
#X obj 807 261 % 2;
#X obj 757 134 t a b;
#X msg 784 202 0;
#X obj 757 202 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc
#000000 #000000;
#X obj 850 200 del 1000;
#X msg 850 223 0;
#X obj 757 62 r latlon;
#X obj 757 85 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000;
#X text 756 24 location info arrival indicator;
#X obj 757 163 scan 400;
#X msg 757 111 10;
#X obj 526 95 route /tgl.Location.En;
#X msg 356 72 list /tgl.Location.En 1;
#X msg 850 252 list /tgl.Location.Act set \$1;
#X msg 16 98 list /disp.Loc.Current.Lat.Coarse \$1;
#X msg 70 167 list /disp.Loc.Current.Lon.Coarse \$1;
#X msg 43 144 list /disp.Loc.Current.Lat.Fine \$1;
#X msg 97 213 list /disp.Loc.Current.Lon.Fine \$1;
#X obj 16 69 unpack f f f f;
#X obj 28 602 list prepend /disp.Distance;
#X text 14 281 draw north pointing compass;
#X obj 304 367 loadbang;
#X obj 304 390 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc
#000000 #000000;
#X text 404 282 draw dest. pointing arrow = bearing arrow;
#X obj 586 332 expr fmod(($f1+360) \, 360);
#X obj 586 355 expr fmod(($f1+180) \, 360)-180;
#X obj 586 378 s \$0-brng-error;
#N canvas 24 163 465 242 tester 0;
#X obj 17 67 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000
0 1;
#X obj 17 87 metro 100;
#X obj 87 110 vline~;
#X obj 87 133 snapshot~;
#X floatatom 87 156 5 0 0 0 - - - 0;
#X msg 87 74 0 0 \, 50 2000 \, 0 2000 2000 \, 360 0 4000 \, 310 2000
4000 \, 360 2000 6000;
#X obj 87 19 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000
0 1;
#X obj 87 45 metro 8000;
#X obj 87 178 outlet;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 8 0;
#X connect 5 0 2 0;
#X connect 6 0 7 0;
#X connect 6 0 0 0;
#X connect 7 0 5 0;
#X restore 331 312 pd tester;
#X obj 489 487 tgl 15 0 empty \$0-veryclose r:0-veryclose 17 7 0 10
#fcfcfc #000000 #000000 0 1;
#N canvas 719 91 614 663 draw_veryclose 0;
#X obj 89 257 rot2d;
#X msg 89 149 0.5 0.6;
#X obj 70 327 list store;
#X msg 106 172 0.4 0.7;
#X msg 140 218 0.6 0.7;
#X obj 89 280 list prepend append;
#X obj 89 303 list trim;
#X obj 70 103 t b b b;
#X obj 89 126 t b b b b;
#X obj 70 81 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000;
#X obj 70 19 inlet;
#X obj 70 42 t b a;
#X obj 209 219 t a;
#X obj 242 199 t a;
#X obj 70 350 list prepend /lcd.Pointer paintpoly;
#X obj 161 577 send toGUI;
#X msg 123 195 0.5 0.3;
#X msg 113 465 list /lcd.Pointer frameoval 0.12 0.12 0.88 0.88 1 1
0 0.7;
#X msg 142 419 list /lcd.Pointer frameoval 0 0 1 1 1 1 0 1;
#X obj 70 373 t b a b b b b b;
#X msg 70 511 list /lcd.Pointer paintoval 0.45 0.45 0.55 0.55 0 1 0
1;
#X msg 99 488 list /lcd.Pointer frameoval 0.25 0.25 0.75 0.75 1 1 0
0.5;
#X msg 128 442 list /lcd.Pointer frameoval 0.05 0.05 0.95 0.95 1 1
0 0.9;
#X msg 222 325 list /lcd.Pointer paintoval 0 0 1 1 1 0.4 0.6 1;
#X msg 157 396 list /lcd.Pointer paintoval 0 0 1 1 0 0.4 0.4 1;
#X connect 0 0 5 0;
#X connect 1 0 0 0;
#X connect 2 0 14 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 6 0;
#X connect 6 0 2 0;
#X connect 7 0 2 0;
#X connect 7 1 8 0;
#X connect 7 2 12 0;
#X connect 8 0 1 0;
#X connect 8 1 3 0;
#X connect 8 2 16 0;
#X connect 8 3 4 0;
#X connect 9 0 7 0;
#X connect 10 0 11 0;
#X connect 11 0 9 0;
#X connect 11 1 13 0;
#X connect 12 0 2 1;
#X connect 13 0 0 2;
#X connect 14 0 19 0;
#X connect 16 0 0 0;
#X connect 17 0 15 0;
#X connect 18 0 15 0;
#X connect 19 0 20 0;
#X connect 19 1 15 0;
#X connect 19 2 21 0;
#X connect 19 3 17 0;
#X connect 19 5 18 0;
#X connect 19 6 24 0;
#X connect 20 0 15 0;
#X connect 21 0 15 0;
#X connect 24 0 15 0;
#X restore 491 597 pd draw_veryclose;
#X obj 491 574 spigot;
#X obj 445 531 == 0;
#X obj 406 574 spigot;
#X obj 445 508 f;
#X obj 406 485 t a a b;
#X obj 524 534 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000 0 1;
#X obj 445 554 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000 0 1;
#X obj 489 440 loadbang;
#X msg 489 463 0;
#X obj 43 121 makefilename %03d;
#X obj 97 190 makefilename %03d;
#X obj 876 589 send toGUI;
#X msg 876 566 list /tgl.Location.En \$1;
#X obj 913 514 del 500;
#X obj 876 471 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc
#000000 #000000;
#X obj 876 491 t b b;
#X msg 876 514 0;
#X msg 913 537 1;
#X obj 935 171 del;
#X text 681 423 if there is no GPS update for a long time \, let's
try to get one intentionally by performing a enable/disable cycle.
;
#X msg 935 148 20000;
#X text 947 123 20 seconds;
#X obj 16 46 r listening-location;
#X obj 1104 286 list trim;
#X obj 1104 263 receive fromGUI;
#X obj 1104 309 route /tgl.Go.Live;
#X obj 1104 332 tgl 15 0 \$0-go_live empty s:0-go_live 17 7 0 10 #fcfcfc
#000000 #000000 0 1;
#X connect 1 0 42 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 5 0 43 0;
#X connect 8 0 55 0;
#X connect 8 0 65 0;
#X connect 10 0 12 0;
#X connect 11 0 8 0;
#X connect 12 0 11 0;
#X connect 13 0 10 0;
#X connect 14 0 11 1;
#X connect 15 0 50 0;
#X connect 16 0 17 0;
#X connect 17 0 19 0;
#X connect 19 0 24 0;
#X connect 20 0 19 0;
#X connect 23 0 18 0;
#X connect 24 0 25 0;
#X connect 25 0 23 0;
#X connect 28 0 44 0;
#X connect 29 0 30 0;
#X connect 30 0 31 0;
#X connect 31 0 29 1;
#X connect 31 0 28 0;
#X connect 32 0 40 0;
#X connect 32 1 33 0;
#X connect 33 0 29 1;
#X connect 34 0 29 0;
#X connect 35 0 36 0;
#X connect 36 0 44 0;
#X connect 37 0 38 0;
#X connect 38 0 41 0;
#X connect 38 0 81 0;
#X connect 40 0 34 0;
#X connect 40 1 35 0;
#X connect 41 0 32 0;
#X connect 42 0 3 0;
#X connect 43 0 6 0;
#X connect 44 0 27 0;
#X connect 45 0 0 0;
#X connect 46 0 0 0;
#X connect 47 0 0 0;
#X connect 48 0 0 0;
#X connect 49 0 45 0;
#X connect 49 1 70 0;
#X connect 49 2 46 0;
#X connect 49 3 71 0;
#X connect 50 0 9 0;
#X connect 52 0 53 0;
#X connect 53 0 8 0;
#X connect 55 0 56 0;
#X connect 56 0 57 0;
#X connect 58 0 8 0;
#X connect 59 0 64 1;
#X connect 61 0 60 0;
#X connect 62 0 67 0;
#X connect 63 0 7 0;
#X connect 64 0 66 0;
#X connect 64 0 62 0;
#X connect 65 0 63 0;
#X connect 65 1 61 0;
#X connect 65 2 64 0;
#X connect 66 0 61 1;
#X connect 67 0 63 1;
#X connect 68 0 69 0;
#X connect 69 0 64 1;
#X connect 70 0 47 0;
#X connect 71 0 48 0;
#X connect 73 0 72 0;
#X connect 74 0 78 0;
#X connect 75 0 76 0;
#X connect 76 0 77 0;
#X connect 76 1 74 0;
#X connect 77 0 73 0;
#X connect 78 0 73 0;
#X connect 79 0 75 0;
#X connect 81 0 79 0;
#X connect 83 0 49 0;
#X connect 84 0 86 0;
#X connect 85 0 84 0;
#X connect 86 0 87 0;
#X restore 287 25 pd gui guts;
#X obj 63 142 / 1000;
#X obj 100 165 / 1000;
#X obj 435 80 r latlon;
#X text 56 356 listening location -> virtual location (=preset);
#X obj 435 103 unpack f f f f;
#X obj 435 132 pack f f f f;
#X text 433 40 listening location -> live location (=use live location
input);
#X obj 435 185 spigot;
#X msg 57 384 37.574 973 126.925 708;
#X obj 27 329 loadbang;
#X obj 57 407 s listening-location;
#X obj 435 208 s listening-location;
#X floatatom 167 27 5 0 0 0 - - - 0;
#X text 210 384 seoul node location (for example);
#X obj 549 96 tgl 15 0 empty \$0-go_live r:0-go_live 17 7 0 10 #fcfcfc
#000000 #000000 0 1;
#X obj 223 304 sel 0;
#X obj 549 116 t a a;
#X connect 0 0 2 0;
#X connect 1 0 3 0;
#X connect 1 1 5 0;
#X connect 2 0 1 0;
#X connect 3 5 15 0;
#X connect 3 6 16 0;
#X connect 3 7 4 2;
#X connect 3 8 4 3;
#X connect 4 0 6 0;
#X connect 4 0 7 0;
#X connect 15 0 4 0;
#X connect 16 0 4 1;
#X connect 17 0 19 0;
#X connect 19 0 20 0;
#X connect 19 1 20 2;
#X connect 19 2 20 1;
#X connect 19 3 20 3;
#X connect 20 0 22 0;
#X connect 22 0 26 0;
#X connect 23 0 25 0;
#X connect 24 0 23 0;
#X connect 27 0 5 0;
#X connect 29 0 31 0;
#X connect 30 0 23 0;
#X connect 31 0 30 0;
#X connect 31 1 22 1;
#X restore 25 18 pd guts;
#X msg 332 39 37.573 638 126.924 850;
#X text 330 14 location input-format: (Lat.rough \, Lat.fine \, Lon.rough
\, Lon.fine), f 66;
#X text 488 37 (please insert a space after 3rd fractional digit \,
i.e. split 1 number to 2 why? -->);
#N canvas 1 91 454 330 more 0;
#X msg 23 143 37.5736;
#X floatatom 23 166 9 0 0 0 - - - 0;
#X msg 23 233 37.573 638 126.924 850;
#X msg 23 79 37.5736 126.925;
#X text 21 18 let's say our listening location is \; Lat. 37.5736 \,
Long. 126.925;
#X text 21 58 natural write-up of this location;
#X text 21 108 but this will suffer resolution problem in Pd (Pd support
only up to 6 significands), f 46;
#X text 21 198 so \, we write this slightly differently! (inserting
a space after 3rd fractional digit);
#X text 21 268 location data format in Pd here is:;
#X text 21 288 location input-format: (Lat.rough \, Lat.fine \, Lon.rough
\, Lon.fine), f 66;
#X connect 0 0 1 0;
#X restore 676 56 pd more notes;
#X text 474 229 as many as you want. ===>;
#X text 49 396 as many as you want. ===>;
#X text 274 143 just copy/paste 1 set \, and change file number + change
location numbers. at the very last. don't forget to save!;
#X text 378 116 ==== INSTRUCTION ====;
#X obj 37 287 audiodot 1;
#X connect 1 0 14 2;
#X connect 2 0 4 0;
#X connect 3 0 14 0;
#X connect 4 0 14 1;