#N canvas 12 5 961 699 10; #X text 27 436 1.arg: ambisonic order; #X text 794 41 -180 <= phi <= +180; #X text 494 172 input: one mul-factor for each; #X text 490 505 output in case of 3d: ((n_ao+1)*(n_ao+1)*n_ls+2) ; #X text 490 443 output in case of 2d: ((2*n_ao+1)*n_ls+2) ; #X text 835 505 :; #X text 794 442 :; #X text 731 527 number of ambisonic-channels; #X text 702 538 elements of a matrix; #X text 504 538 + (n_ao + 1) * (n_ao + 1) * n_ls; #X text 504 473 + (2*n_ao + 1) * n_ls elements of a matrix ; #X text 42 454 (1 .. 5 in case of 3 dimensional); #X text 42 445 (1 .. 12 in case of 2 dimensional); #X text 27 464 2.arg: dimension (2 or 3); #X text 106 564 IEM KUG; #X text 90 552 musil; #X text 120 552 @; #X text 126 552 iem.at; #X text 89 574 Graz \, Austria; #X text 41 541 (c) Thomas Musil 2000 - 2006; #X obj 109 347 cnv 15 126 15 empty empty empty 20 12 0 14 -260818 -66577 0; #X obj 108 368 round_zero 1e-006; #X obj 38 33 bng 35 250 50 0 empty empty empty 0 -6 0 8 -24198 -42246 -1; #X msg 246 121 ambi_weight 1 1 1 0.3904; #X msg 108 121 ambi_weight 1 1 1 1; #X msg 124 99 mirror_weight 0.7; #X obj 80 220 pp pht_ls; #X obj 38 77 t b b b b b b b; #X msg 94 143 1 90 0 \, 2 45 45 \, 3 45 135 \, 4 45 225 \, 5 45 315 \, 6 0 0 \, 7 0 45 \, 8 0 90 \, 9 0 135 \, 10 0 180 \, 11 0 225 \, 12 0 270 \, 13 0 315; #X obj 94 177 pp real_ls; #X msg 66 243 begin_pseudo_inverse; #X obj 108 346 ambi_decode3 3 3 13 6; #X msg 38 313 end_pseudo_inverse; #X msg 80 199 1 -45 0 \, 2 -45 90 \, 3 -45 180 \, 4 -45 270 \, 6 -90 0; #X msg 52 289 ipht_ireal_muladd \$1 \$2 \$3; #N canvas 337 146 567 517 mirror_phantom_ls_____ 0; #X msg 142 186 1 6 \$1; #X obj 102 58 inlet; #X obj 101 441 outlet; #X obj 162 59 inlet; #X obj 71 135 f; #X obj 103 135 f; #X obj 157 106 * 0.25; #X obj 214 106 * 0.5; #X msg 163 211 2 8 \$1; #X msg 40 187 1 13 \$1 \, 1 7 \$1; #X msg 61 212 2 7 \$1 \, 2 9 \$1; #X msg 179 241 3 10 \$1; #X msg 77 242 3 9 \$1 \, 3 11 \$1; #X msg 199 271 4 12 \$1; #X msg 87 271 4 11 \$1 \, 4 13 \$1; #X obj 162 81 route mirror_weight; #X obj 380 60 inlet; #X connect 0 0 2 0; #X connect 1 0 4 0; #X connect 1 0 5 0; #X connect 3 0 15 0; #X connect 4 0 9 0; #X connect 4 0 10 0; #X connect 4 0 12 0; #X connect 4 0 14 0; #X connect 5 0 0 0; #X connect 5 0 8 0; #X connect 5 0 11 0; #X connect 5 0 13 0; #X connect 6 0 4 1; #X connect 7 0 5 1; #X connect 8 0 2 0; #X connect 9 0 2 0; #X connect 10 0 2 0; #X connect 11 0 2 0; #X connect 12 0 2 0; #X connect 13 0 2 0; #X connect 14 0 2 0; #X connect 15 0 7 0; #X connect 15 0 6 0; #X restore 52 268 pd mirror_phantom_ls_____; #X text 18 9 ambi_decode3; #X text 160 14 AMBISONIC DECODING; #X text 131 40 up to 12.Order 2-dimensional; #X text 128 28 up to 5.Order 3-dimensional or; #X text 508 5 n_ao = ambisonic-order; #X text 520 42 all angles in degree; #X text 539 183 ambisonic order group to suppress the side-lobe-phenomena ; #X text 493 274 input: starts the encoding; #X text 536 285 of all (real + phantom) loudspeaker positions \,; #X text 537 309 and calculates the pseudo inverse.; #X text 540 297 multiplicates the ambi order weight; #X msg 276 230 sing_range 1e-010; #X text 799 328 mirror_weight; #X text 545 354 phantom speaker with the factor "mirror_weight" and adds; #X text 544 367 this column to the column "rl_ls_index" of real speaker ; #X text 494 202 input: singularity range; #X text 537 213 when calculating the inverse of the matrix by gauss ; #X text 537 223 algorithm \, you have to divide a row by a certain number \,; #X text 537 243 outside of this range (> sing_range \, or < -sing_range). ; #X text 493 385 input: outputs only the first part of; #X text 539 398 the inverted matrix (row 1 to row n_pht_ls). The part ; #X text 541 410 with the phantom speakers \, we ignore.; #X obj 221 576 cnv 15 192 15 empty empty empty 20 12 0 14 -260818 -66577 0; #X obj 221 601 cnv 15 228 15 empty empty empty 20 12 0 14 -260818 -66577 0; #X text 537 255 Otherwise we say \, this matrix is singular.; #N canvas 149 60 405 450 real_speaker_example 0; #X obj 65 32 bng 35 250 50 0 empty empty empty 0 -6 0 8 -24198 -42246 -1; #X obj 84 216 cnv 15 120 15 empty empty empty 20 12 0 14 -260818 -66577 0; #X obj 83 260 print; #X obj 83 237 round_zero 1e-006; #X obj 102 120 pp real_ls; #X msg 83 143 begin_pseudo_inverse; #X msg 65 166 end_pseudo_inverse; #X obj 83 215 ambi_decode3 2 2 5 0; #X obj 65 74 t b b b; #X msg 102 97 1 5 \, 2 2.5 \, 3 0 \, 4 -2.5 \, 5 -5; #X text 51 299 ambisonic system 2.order; #X text 78 312 2 dimensional; #X text 76 326 5 real speakers; #X text 41 346 arranged in a very small arc between; #X text 58 359 +5 degrees and -5 degrees; #X connect 0 0 8 0; #X connect 3 0 2 0; #X connect 4 0 7 0; #X connect 5 0 7 0; #X connect 6 0 7 0; #X connect 7 0 3 0; #X connect 8 0 6 0; #X connect 8 1 5 0; #X connect 8 2 9 0; #X connect 9 0 4 0; #X restore 220 575 pd real_speaker_example singular; #N canvas 250 68 390 499 phantom_speaker_example 0; #X obj 38 31 bng 35 250 50 0 empty empty empty 0 -6 0 8 -24198 -42246 -1; #X obj 143 251 cnv 15 132 15 empty empty empty 20 12 0 14 -260818 -66577 0; #X obj 142 300 print; #X obj 142 275 round_zero 1e-006; #X obj 161 165 pp real_ls; #X msg 142 188 begin_pseudo_inverse; #X msg 124 211 end_pseudo_inverse; #X obj 124 119 t b b b; #X msg 161 142 1 5 \, 2 2.5 \, 3 0 \, 4 -2.5 \, 5 -5; #X text 110 344 ambisonic system 2.order; #X text 137 357 2 dimensional; #X text 135 371 5 real speakers; #X obj 38 191 pp pht_ls; #X obj 38 72 for++ 0 138; #X obj 38 95 t f f; #X obj 38 126 + 1; #X obj 63 117 * 2.5; #X obj 63 139 + 7.5; #X obj 38 169 pack 0 0; #X obj 142 250 ambi_decode3 2 2 5 139; #X text 116 396 -5 degrees and +5 degrees; #X text 125 411 139 phantom speakers; #X text 99 383 arranged on a very small arc between; #X text 109 423 arranged on an arc between; #X text 113 437 +7.5 degrees and -7.5 degrees; #X connect 0 0 13 0; #X connect 3 0 2 0; #X connect 4 0 19 0; #X connect 5 0 19 0; #X connect 6 0 19 0; #X connect 7 0 6 0; #X connect 7 1 5 0; #X connect 7 2 8 0; #X connect 8 0 4 0; #X connect 12 0 19 0; #X connect 13 0 14 0; #X connect 13 1 7 0; #X connect 14 0 15 0; #X connect 14 1 16 0; #X connect 15 0 18 0; #X connect 16 0 17 0; #X connect 17 0 18 1; #X connect 18 0 12 0; #X connect 19 0 3 0; #X restore 220 600 pd phantom_speaker_example nonsingular; #X text 537 233 to achieve the identity matrix. This number has to be; #X obj 108 391 mtx_print; #X text 516 453 n_row = (n_ls) = number of loudspeakers; #X text 504 463 + n_col = (2*n_ao+1) = number of ambisonic-channels ; #X text 493 328 input: im_ls_index re_ls_index ; #X text 546 341 multiplies the column "im_ls_index + re_ls_index" of ; #X text 27 476 3.arg: number of real existing loudspeakers ; #X text 27 488 4.arg: number of virtual phantom_loudspeakers ; #X text 493 16 n_re_ls = number of real loudspeakers; #X text 493 28 n_vi_ls = number of virtual phantom loudspeakers; #X text 494 78 input: re_ls_index + phi .. 2-dimensional ; #X text 494 88 input: re_ls_index + theta + phi .. 3-dimensional ; #X text 494 118 input: vi_ls_index + phi .. 2-dimensional ; #X text 494 129 input: vi_ls_index + theta + phi .. 3-dimensional ; #X text 794 29 -90 <= theta <= +90; #X text 786 5 1 <= re_ls_index <= n_re_ls; #X text 786 16 1 <= vi_ls_index <= n_vi_ls; #X text 59 423 initial arguments:; #X text 334 18 calculates a ambisonic; #X text 358 29 decoder matrix; #X text 529 100 encodes the re_ls_index row of a matrix; #X text 525 141 encodes the (re_ls_index + vi_ls_index) row of a matrix ; #X text 532 153 we need them to achieve a nonsingular matrix; #X text 516 516 n_row = (n_ls) = number of loudspeakers; #X text 504 527 + n_col = (n_ao+1)*(n_ao+1) =; #X connect 21 0 64 0; #X connect 22 0 27 0; #X connect 23 0 31 0; #X connect 24 0 31 0; #X connect 25 0 35 1; #X connect 26 0 31 0; #X connect 27 0 32 0; #X connect 27 1 35 0; #X connect 27 2 30 0; #X connect 27 3 33 0; #X connect 27 4 28 0; #X connect 27 5 24 0; #X connect 27 6 25 0; #X connect 28 0 29 0; #X connect 29 0 31 0; #X connect 30 0 31 0; #X connect 31 0 21 0; #X connect 32 0 31 0; #X connect 33 0 26 0; #X connect 34 0 31 0; #X connect 35 0 34 0; #X connect 47 0 31 0;