#N canvas 549 113 921 503 10;
#X declare -lib iemmatrix;
#X text 620 234 for m>=0;
#X text 619 250 for m< 0;
#X text 288 118 [mtx_circular_harmonics] requires a numerical creation argument <nmax> specifyiing the maximum order 0<=n<=nmax.;
#X text 74 54 [mtx_circular_harmonics] circular harmonics evaluated at a set of points given in phi coordinates.;
#X text 284 160 for an L points 2xL input matrix \, [mtx_spherical_harmonics] evaluates the (2*nmax+2) circular harmonics at L points and delivers an Lx(2*nmax+2) output matrix.;
#X text 167 235 PHI_m(phi) = sqrt((2-delta_m) / (2*pi)) * cos(m*phi);
#X text 126 284 The order of the harmonics in the output columns is specified by the linear index k=nmax+m+1.;
#N canvas 0 0 450 300 (subpatch) 0;
#X array circularharmonic1 100 float 0;
#X coords 0 1 99 -1 200 50 1;
#X restore 720 14 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array circularharmonic2 100 float 0;
#X coords 0 1 99 -1 200 50 1;
#X restore 718 80 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array circularharmonic3 100 float 0;
#X coords 0 1 99 -1 200 50 1;
#X restore 719 146 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array circularharmonic4 100 float 0;
#X coords 0 1.05 99 -1 200 50 1 0 0;
#X restore 718 217 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array circularharmonic5 100 float 0;
#X coords 0 1 99 -1 200 50 1;
#X restore 718 286 graph;
#X obj 75 109 loadbang;
#N canvas 624 434 600 460 send_to_tables 0;
#X obj 21 14 inlet;
#X obj 72 211 mtx;
#X obj 21 36 t a a;
#X obj 21 59 mtx_size;
#X obj 74 105 until;
#X obj 74 82 t f b;
#X msg 117 82 0;
#X obj 101 124 + 1;
#X obj 74 124 f;
#X obj 73 147 t f f;
#X obj 72 249 s;
#X msg 105 168 symbol circularharmonic\$1;
#X obj 72 230 list prepend 0;
#X msg 73 192 column \$1;
#X connect 0 0 2 0;
#X connect 1 0 12 0;
#X connect 2 0 3 0;
#X connect 2 1 1 1;
#X connect 3 1 5 0;
#X connect 4 0 8 0;
#X connect 5 0 4 0;
#X connect 5 1 6 0;
#X connect 6 0 8 1;
#X connect 7 0 8 1;
#X connect 7 0 9 0;
#X connect 8 0 7 0;
#X connect 9 0 13 0;
#X connect 9 1 11 0;
#X connect 11 0 10 1;
#X connect 12 0 10 0;
#X connect 13 0 1 0;
#X restore 75 179 pd send_to_tables;
#X obj 75 133 mtx_linspace 0 6.29 100;
#X obj 159 114 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000;
#N canvas 0 0 450 300 (subpatch) 0;
#X array circularharmonic6 100 float 0;
#X coords 0 1 99 -1 200 50 1;
#X restore 715 356 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array circularharmonic7 100 float 0;
#X coords 0 1 99 -1 200 50 1;
#X restore 716 422 graph;
#N canvas 307 302 494 171 META 0;
#X text 12 85 OUTLET_0 matrix;
#X text 12 125 HELP_PATCH_AUTHORS IOhannes m zmölnig;
#X text 12 25 LICENSE GPL-2+;
#X text 12 5 KEYWORDS control matrix logic;
#X text 12 65 INLET_0 matrix;
#X text 11 105 AUTHOR Franz Zotter;
#X text 12 45 DESCRIPTION calculate circular harmonics for matrix;
#X obj 13 150 declare -lib iemmatrix;
#X restore 585 455 pd META;
#X text 167 251 PHI_m(phi) = 1/sqrt(pi) * sin(|m|*phi);
#X text 399 452 Franz Zotter \, 2009 \, 2023;
#X text 231 317 Default: N2D;
#X obj 75 157 mtx_circular_harmonics 3 SN2D;
#X text 129 219 for -n<=m<=n: (default N2D);
#X obj 76 318 mtx_circular_harmonics 1;
#X obj 52 334 mtx_circular_harmonics 1 N2D;
#X obj 34 350 mtx_circular_harmonics 1 N2D2PI;
#X text 231 332 uses sqrt(2-delta_m)/sqrt(2pi) altogether to normalize;
#X text 231 350 uses sqrt(2-delta_m) \, omitting 1/sqrt(2pi) to normalize;
#X obj 46 366 mtx_circular_harmonics 1 SN2D;
#X text 231 366 uses 1 \, so no nromalization;
#X text 74 388 Typical 2D Ambisonic encoding choice is SN2D;
#X text 75 400 Typical mathematical integral orthonormalization choice: N2D;
#X connect 12 0 14 0;
#X connect 14 0 22 0;
#X connect 15 0 14 0;
#X connect 22 0 13 0;
