From a3570a460160241c2690b0cff824d270e69ec33d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 26 Dec 2005 02:07:50 +0000 Subject: added panning algorithms from http://www.csounds.com/ezine/autumn1999/beginners/ svn path=/trunk/externals/hcs/pan/; revision=4295 --- TODO | 6 +-- equal_power_pan~-help.pd | 26 +++++++++++++ equal_power_pan~.pd | 29 +++++++++++++++ gogins_pan~-help.pd | 27 ++++++++++++++ gogins_pan~.pd | 60 ++++++++++++++++++++++++++++++ goginspan~-help.pd | 95 ------------------------------------------------ linear_pan~-help.pd | 24 ++++++++++++ linear_pan~.pd | 27 ++++++++++++++ linearpan~-help.pd | 24 ------------ linearpan~.pd | 57 ----------------------------- pan_core~.pd | 51 ++++++++++++++++++++++++++ square_root_pan~-help.pd | 26 +++++++++++++ square_root_pan~.pd | 29 +++++++++++++++ 13 files changed, 302 insertions(+), 179 deletions(-) create mode 100644 equal_power_pan~-help.pd create mode 100644 equal_power_pan~.pd create mode 100644 gogins_pan~-help.pd create mode 100644 gogins_pan~.pd delete mode 100644 goginspan~-help.pd create mode 100644 linear_pan~-help.pd create mode 100644 linear_pan~.pd delete mode 100644 linearpan~-help.pd delete mode 100644 linearpan~.pd create mode 100644 pan_core~.pd create mode 100644 square_root_pan~-help.pd create mode 100644 square_root_pan~.pd diff --git a/TODO b/TODO index b86cc27..b1d3e05 100644 --- a/TODO +++ b/TODO @@ -1,13 +1,13 @@ +- check F.Moore's Elements of Computer Music for panning algorithms + - remove motex [pan~] from distros and replace with these Pd patches. - write equal power panning object in Pd to replace motex [pan~] - write pan_gogins~.c in Pd -- implmenet other panning algorithms in Pd from - http://www.csounds.com/ezine/autumn1999/beginners/ - - write all_about_panning, including graphs and discussion from http://www.csounds.com/ezine/autumn1999/beginners/ +- include vbap~ and other advanced panning methods diff --git a/equal_power_pan~-help.pd b/equal_power_pan~-help.pd new file mode 100644 index 0000000..de2d17b --- /dev/null +++ b/equal_power_pan~-help.pd @@ -0,0 +1,26 @@ +#N canvas 219 32 485 328 10; +#X obj 5 2 cnv 15 450 20 empty empty [equal_power_pan~] 2 11 1 18 -233017 +-66577 0; +#X obj 422 3 pddp; +#X text 27 270 (C) Copyright 2004 Hans-Christoph Steiner +; +#X text 244 284 released under the GNU GPL; +#X obj 224 149 hsl 128 20 0 1 0 1 empty empty pan_position 6 10 1 11 +-262131 -1 -1 0 0; +#X obj 113 131 osc~ 250; +#X obj 113 152 *~ 0.5; +#X obj 362 186 tgl 25 0 empty empty DSP 3 12 1 9 -24198 -1 -1 0 1; +#X msg 362 218 \; pd dsp \$1; +#X text 16 71 The left inlet takes the audio signal and the right inlet +takes the control signal with 0 = left \, 1 = right \, and 0.5 = center. +; +#X text 16 37 Pan a mono signal using square root panning to smooth +out the dead spot in the middle somewhat.; +#X obj 141 234 dac~ 1 2; +#X obj 113 187 equal_power_pan~; +#X connect 4 0 12 1; +#X connect 5 0 6 0; +#X connect 6 0 12 0; +#X connect 7 0 8 0; +#X connect 12 0 11 0; +#X connect 12 1 11 1; diff --git a/equal_power_pan~.pd b/equal_power_pan~.pd new file mode 100644 index 0000000..dec6ffa --- /dev/null +++ b/equal_power_pan~.pd @@ -0,0 +1,29 @@ +#N canvas 509 36 445 434 10; +#X obj 23 38 inlet~; +#X obj 234 48 inlet; +#X obj 23 322 outlet~; +#X obj 81 322 outlet~; +#X text 30 342 left; +#X text 84 342 right; +#X obj 234 124 expr if($f1 > 0 \, $f1 \, 0); +#X obj 234 105 expr if($f1 < 1 \, $f1 \, 1); +#X text 247 91 filter so 0 < f < 1; +#X text 130 368 (C) Copyright 2004 Hans-Christoph Steiner; +#X text 234 384 released under the GNU GPL; +#X obj 23 263 pan_core~; +#X obj 309 44 loadbang; +#X msg 309 64 0.5; +#X obj 39 184 expr cos($f1 * 3.14159 / 2); +#X obj 234 184 expr sin($f1 * 3.14159 / 2); +#X text 10 17 [equal_power_pan~]; +#X connect 0 0 11 0; +#X connect 1 0 7 0; +#X connect 6 0 14 0; +#X connect 6 0 15 0; +#X connect 7 0 6 0; +#X connect 11 0 2 0; +#X connect 11 1 3 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 14 0 11 1; +#X connect 15 0 11 2; diff --git a/gogins_pan~-help.pd b/gogins_pan~-help.pd new file mode 100644 index 0000000..3e513a3 --- /dev/null +++ b/gogins_pan~-help.pd @@ -0,0 +1,27 @@ +#N canvas 7 59 485 328 10; +#X obj 5 2 cnv 15 450 20 empty empty [gogins_pan~] 2 11 1 18 -233017 +-66577 0; +#X obj 422 3 pddp; +#X text 27 270 (C) Copyright 2004 Hans-Christoph Steiner +; +#X text 244 284 released under the GNU GPL; +#X obj 224 149 hsl 128 20 0 1 0 1 empty empty pan_position 6 10 1 11 +-262131 -1 -1 0 0; +#X obj 113 131 osc~ 250; +#X obj 113 152 *~ 0.5; +#X obj 362 186 tgl 25 0 empty empty DSP 3 12 1 9 -24198 -1 -1 0 1; +#X msg 362 218 \; pd dsp \$1; +#X text 17 82 The left inlet takes the audio signal and the right inlet +takes the control signal with 0 = left \, 1 = right \, and 0.5 = center. +; +#X obj 122 231 dac~ 1 2; +#X obj 114 187 gogins_pan~; +#X text 15 36 Pan a mono signal using an algorithm posted by Michael +Gogins to the Csound list. The aim is to have the pan feel like its +wrapping around more.; +#X connect 4 0 11 1; +#X connect 5 0 6 0; +#X connect 6 0 11 0; +#X connect 7 0 8 0; +#X connect 11 0 10 0; +#X connect 11 1 10 1; diff --git a/gogins_pan~.pd b/gogins_pan~.pd new file mode 100644 index 0000000..dd7f3be --- /dev/null +++ b/gogins_pan~.pd @@ -0,0 +1,60 @@ +#N canvas 612 28 518 582 10; +#X obj 23 38 inlet~; +#X obj 139 47 inlet; +#X obj 23 482 outlet~; +#X obj 81 482 outlet~; +#X text 30 502 left; +#X text 84 502 right; +#X obj 139 93 expr if($f1 > 0 \, $f1 \, 0); +#X obj 139 74 expr if($f1 < 1 \, $f1 \, 1); +#X text 174 59 filter so 0 < f < 1; +#X text 130 528 (C) Copyright 2004 Hans-Christoph Steiner; +#X text 234 544 released under the GNU GPL; +#X obj 23 443 pan_core~; +#X obj 107 27 loadbang; +#X msg 107 47 0.5; +#X obj 209 132 pi; +#X obj 337 171 / 2; +#X text 10 17 [gogins_pan~]; +#X obj 368 93 loadbang; +#X obj 369 313 expr sqrt(2)/2; +#X obj 209 152 trigger float float; +#X obj 106 387 *; +#X obj 208 388 *; +#X obj 140 190 *; +#X obj 140 211 -; +#X obj 140 238 trigger float float; +#X obj 140 263 cos; +#X obj 268 262 sin; +#X text 101 456 the algorithm comes from Michael Gogins on the Csound +list; +#X obj 207 326 +; +#X obj 107 324 -; +#X connect 0 0 11 0; +#X connect 1 0 7 0; +#X connect 6 0 22 0; +#X connect 7 0 6 0; +#X connect 11 0 2 0; +#X connect 11 1 3 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 14 0 19 0; +#X connect 15 0 23 1; +#X connect 17 0 14 0; +#X connect 17 0 18 0; +#X connect 18 0 21 1; +#X connect 18 0 20 1; +#X connect 19 0 22 1; +#X connect 19 1 15 0; +#X connect 20 0 11 1; +#X connect 21 0 11 2; +#X connect 22 0 23 0; +#X connect 23 0 24 0; +#X connect 24 0 25 0; +#X connect 24 1 26 0; +#X connect 25 0 28 0; +#X connect 25 0 29 0; +#X connect 26 0 28 1; +#X connect 26 0 29 1; +#X connect 28 0 21 0; +#X connect 29 0 20 0; diff --git a/goginspan~-help.pd b/goginspan~-help.pd deleted file mode 100644 index 281573d..0000000 --- a/goginspan~-help.pd +++ /dev/null @@ -1,95 +0,0 @@ -#N canvas 229 280 522 407 10; -#X floatatom 94 35 4 -45 45 0 - - -; -#X floatatom 112 85 0 0 0 0 - - -; -#N canvas 184 223 495 266 output 0; -#X obj 338 160 t b; -#X obj 338 110 f; -#X obj 338 60 inlet; -#X text 344 29 mute; -#X obj 338 185 f; -#X msg 425 178 0; -#X msg 338 85 bang; -#X obj 338 135 moses 1; -#X obj 425 153 t b f; -#X obj 397 117 moses 1; -#X obj 83 148 dbtorms; -#X obj 397 92 r master-lvl; -#X obj 83 42 r master-lvl; -#X obj 338 210 s master-lvl; -#X obj -15 176 inlet~; -#X obj 199 41 inlet; -#X text 199 18 level; -#X obj 199 100 s master-lvl; -#X msg 96 65 set \$1; -#X obj 96 89 outlet; -#X msg 214 64 \; pd dsp 1; -#X obj 83 194 line~; -#X obj -15 207 *~; -#X obj -15 236 dac~; -#X obj 83 171 pack 0 50; -#X text -17 153 audio; -#X text 93 110 show level; -#X obj 31 182 inlet~; -#X obj 31 218 *~; -#X connect 0 0 4 0; -#X connect 1 0 7 0; -#X connect 2 0 6 0; -#X connect 4 0 13 0; -#X connect 5 0 13 0; -#X connect 6 0 1 0; -#X connect 7 0 0 0; -#X connect 7 1 8 0; -#X connect 8 0 5 0; -#X connect 9 1 4 1; -#X connect 10 0 24 0; -#X connect 11 0 1 1; -#X connect 11 0 9 0; -#X connect 12 0 10 0; -#X connect 12 0 18 0; -#X connect 14 0 22 0; -#X connect 15 0 17 0; -#X connect 15 0 20 0; -#X connect 18 0 19 0; -#X connect 21 0 22 1; -#X connect 21 0 28 1; -#X connect 22 0 23 0; -#X connect 24 0 21 0; -#X connect 27 0 28 0; -#X connect 28 0 23 1; -#X restore 74 112 pd output; -#X msg 132 84 MUTE; -#X text 166 83 <-- output amplitude; -#N canvas 5 21 600 400 pulse 0; -#X obj 175 203 cos~; -#X obj 175 131 -~ 0.5; -#X obj 175 179 clip~ -0.5 0.5; -#X obj 175 227 hip~ 5; -#X obj 175 155 *~ 82; -#X obj 175 107 phasor~ 16; -#X obj 175 251 outlet~; -#X connect 0 0 3 0; -#X connect 1 0 4 0; -#X connect 2 0 0 0; -#X connect 3 0 6 0; -#X connect 4 0 2 0; -#X connect 5 0 1 0; -#X restore 22 33 pd pulse; -#X msg 21 177 \; pd dsp 1; -#X msg 91 177 \; pd dsp 0; -#X text 43 208 ON; -#X text 108 208 OFF; -#X obj 22 152 loadbang; -#X text 133 36 angle in degrees range -45 to 45; -#X obj 22 58 pan_gogins~; -#X text 17 324 pan_gogins~ a modification of pan~ by Ian Mott; -#X text 16 341 implements an algorithm conceived by Michael Gogins -and described at: http://www.csounds.com/ezine/autumn1999/beginners/ -; -#X connect 0 0 12 1; -#X connect 1 0 2 2; -#X connect 2 0 1 0; -#X connect 3 0 2 3; -#X connect 5 0 12 0; -#X connect 10 0 6 0; -#X connect 12 0 2 0; -#X connect 12 1 2 1; diff --git a/linear_pan~-help.pd b/linear_pan~-help.pd new file mode 100644 index 0000000..56a7b36 --- /dev/null +++ b/linear_pan~-help.pd @@ -0,0 +1,24 @@ +#N canvas 503 335 477 320 10; +#X obj 5 2 cnv 15 450 20 empty empty [linearpan~] 2 11 1 18 -233017 +-66577 0; +#X obj 422 3 pddp; +#X text 27 270 (C) Copyright 2004 Hans-Christoph Steiner +; +#X text 244 284 released under the GNU GPL; +#X obj 134 225 dac~; +#X obj 181 145 hsl 128 20 0 1 0 1 empty empty pan_position 6 10 1 11 +-262131 -1 -1 6350 0; +#X text 16 37 Pan a mono signal using linear panning. The left inlet +takes the audio signal and the right inlet takes the control signal +with 0 = left \, 1 = right \, and 0.5 = center.; +#X obj 84 131 osc~ 250; +#X obj 84 152 *~ 0.5; +#X obj 362 186 tgl 25 0 empty empty DSP 3 12 1 9 -24198 -1 -1 1 1; +#X msg 362 218 \; pd dsp \$1; +#X obj 113 187 linearpan~; +#X connect 5 0 11 1; +#X connect 7 0 8 0; +#X connect 8 0 11 0; +#X connect 9 0 10 0; +#X connect 11 0 4 0; +#X connect 11 1 4 1; diff --git a/linear_pan~.pd b/linear_pan~.pd new file mode 100644 index 0000000..32d29a1 --- /dev/null +++ b/linear_pan~.pd @@ -0,0 +1,27 @@ +#N canvas 438 88 458 368 10; +#X obj 23 38 inlet~; +#X obj 193 36 inlet; +#X obj 23 262 outlet~; +#X obj 81 262 outlet~; +#X text 30 282 left; +#X text 84 282 right; +#X obj 193 112 expr if($f1 > 0 \, $f1 \, 0); +#X obj 193 93 expr if($f1 < 1 \, $f1 \, 1); +#X text 206 79 filter so 0 < f < 1; +#X obj 40 150 expr 1 - $f1; +#X text 130 318 (C) Copyright 2004 Hans-Christoph Steiner; +#X text 234 334 released under the GNU GPL; +#X text 10 17 [linearpan~]; +#X obj 23 203 pan_core~; +#X obj 268 32 loadbang; +#X msg 268 52 0.5; +#X connect 0 0 13 0; +#X connect 1 0 7 0; +#X connect 6 0 9 0; +#X connect 6 0 13 2; +#X connect 7 0 6 0; +#X connect 9 0 13 1; +#X connect 13 0 2 0; +#X connect 13 1 3 0; +#X connect 14 0 15 0; +#X connect 15 0 7 0; diff --git a/linearpan~-help.pd b/linearpan~-help.pd deleted file mode 100644 index 56a7b36..0000000 --- a/linearpan~-help.pd +++ /dev/null @@ -1,24 +0,0 @@ -#N canvas 503 335 477 320 10; -#X obj 5 2 cnv 15 450 20 empty empty [linearpan~] 2 11 1 18 -233017 --66577 0; -#X obj 422 3 pddp; -#X text 27 270 (C) Copyright 2004 Hans-Christoph Steiner -; -#X text 244 284 released under the GNU GPL; -#X obj 134 225 dac~; -#X obj 181 145 hsl 128 20 0 1 0 1 empty empty pan_position 6 10 1 11 --262131 -1 -1 6350 0; -#X text 16 37 Pan a mono signal using linear panning. The left inlet -takes the audio signal and the right inlet takes the control signal -with 0 = left \, 1 = right \, and 0.5 = center.; -#X obj 84 131 osc~ 250; -#X obj 84 152 *~ 0.5; -#X obj 362 186 tgl 25 0 empty empty DSP 3 12 1 9 -24198 -1 -1 1 1; -#X msg 362 218 \; pd dsp \$1; -#X obj 113 187 linearpan~; -#X connect 5 0 11 1; -#X connect 7 0 8 0; -#X connect 8 0 11 0; -#X connect 9 0 10 0; -#X connect 11 0 4 0; -#X connect 11 1 4 1; diff --git a/linearpan~.pd b/linearpan~.pd deleted file mode 100644 index 167919a..0000000 --- a/linearpan~.pd +++ /dev/null @@ -1,57 +0,0 @@ -#N canvas 180 287 446 568 10; -#X obj 121 27 inlet~; -#X obj 233 26 inlet; -#X obj 30 443 *~; -#X obj 30 472 outlet~; -#X obj 180 442 *~; -#X obj 180 471 outlet~; -#X text 37 492 left; -#X text 183 491 right; -#X obj 233 82 expr if($f1 > 0 \, $f1 \, 0); -#X obj 233 63 expr if($f1 < 1 \, $f1 \, 1); -#X text 246 49 filter so 0 < f < 1; -#X obj 46 157 expr 1 - $f1; -#X text 130 518 (C) Copyright 2004 Hans-Christoph Steiner; -#X text 234 534 released under the GNU GPL; -#X obj 196 418 line~; -#X obj 46 418 line~; -#X text 10 17 [linearpan~]; -#X obj 287 183 loadbang; -#X floatatom 295 244 7 0 0 3 blocksize_in_ms - -; -#X obj 270 184 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 --1; -#X obj 196 337 t f b; -#X obj 226 356 f; -#X obj 196 379 pack f f; -#X msg 196 399 \$1 \$2; -#X obj 46 337 t f b; -#X obj 76 356 f; -#X obj 46 379 pack f f; -#X msg 46 399 \$1 \$2; -#X obj 287 215 blocksize_in_ms; -#X connect 0 0 2 0; -#X connect 0 0 4 0; -#X connect 1 0 9 0; -#X connect 2 0 3 0; -#X connect 4 0 5 0; -#X connect 8 0 11 0; -#X connect 8 0 20 0; -#X connect 9 0 8 0; -#X connect 11 0 24 0; -#X connect 14 0 4 1; -#X connect 15 0 2 1; -#X connect 17 0 28 0; -#X connect 19 0 28 0; -#X connect 20 0 22 0; -#X connect 20 1 21 0; -#X connect 21 0 22 1; -#X connect 22 0 23 0; -#X connect 23 0 14 0; -#X connect 24 0 26 0; -#X connect 24 1 25 0; -#X connect 25 0 26 1; -#X connect 26 0 27 0; -#X connect 27 0 15 0; -#X connect 28 0 18 0; -#X connect 28 0 21 1; -#X connect 28 0 25 1; diff --git a/pan_core~.pd b/pan_core~.pd new file mode 100644 index 0000000..51b2007 --- /dev/null +++ b/pan_core~.pd @@ -0,0 +1,51 @@ +#N canvas 405 25 454 576 10; +#X obj 11 96 inlet~; +#X obj 216 116 inlet; +#X obj 70 443 *~; +#X obj 70 472 outlet~; +#X obj 200 442 *~; +#X obj 200 471 outlet~; +#X text 77 492 left; +#X text 203 491 right; +#X text 130 518 (C) Copyright 2004 Hans-Christoph Steiner; +#X text 234 534 released under the GNU GPL; +#X obj 216 418 line~; +#X obj 86 418 line~; +#X obj 307 183 loadbang; +#X floatatom 315 244 7 0 0 3 blocksize_in_ms - -; +#X obj 290 184 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 216 337 t f b; +#X obj 246 356 f; +#X obj 216 379 pack f f; +#X msg 216 399 \$1 \$2; +#X obj 86 337 t f b; +#X obj 116 356 f; +#X obj 86 379 pack f f; +#X msg 86 399 \$1 \$2; +#X obj 307 215 blocksize_in_ms; +#X obj 86 117 inlet; +#X text 10 17 [pan_core~]; +#X connect 0 0 2 0; +#X connect 0 0 4 0; +#X connect 1 0 15 0; +#X connect 2 0 3 0; +#X connect 4 0 5 0; +#X connect 10 0 4 1; +#X connect 11 0 2 1; +#X connect 12 0 23 0; +#X connect 14 0 23 0; +#X connect 15 0 17 0; +#X connect 15 1 16 0; +#X connect 16 0 17 1; +#X connect 17 0 18 0; +#X connect 18 0 10 0; +#X connect 19 0 21 0; +#X connect 19 1 20 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 22 0 11 0; +#X connect 23 0 13 0; +#X connect 23 0 16 1; +#X connect 23 0 20 1; +#X connect 24 0 19 0; diff --git a/square_root_pan~-help.pd b/square_root_pan~-help.pd new file mode 100644 index 0000000..52264e3 --- /dev/null +++ b/square_root_pan~-help.pd @@ -0,0 +1,26 @@ +#N canvas 360 90 481 324 10; +#X obj 5 2 cnv 15 450 20 empty empty [square_root_pan~] 2 11 1 18 -233017 +-66577 0; +#X obj 422 3 pddp; +#X text 27 270 (C) Copyright 2004 Hans-Christoph Steiner +; +#X text 244 284 released under the GNU GPL; +#X obj 224 149 hsl 128 20 0 1 0 1 empty empty pan_position 6 10 1 11 +-262131 -1 -1 6350 0; +#X obj 113 131 osc~ 250; +#X obj 113 152 *~ 0.5; +#X obj 362 186 tgl 25 0 empty empty DSP 3 12 1 9 -24198 -1 -1 0 1; +#X msg 362 218 \; pd dsp \$1; +#X text 16 71 The left inlet takes the audio signal and the right inlet +takes the control signal with 0 = left \, 1 = right \, and 0.5 = center. +; +#X text 16 37 Pan a mono signal using square root panning to smooth +out the dead spot in the middle somewhat.; +#X obj 113 187 square_root_pan~; +#X obj 141 234 dac~ 1 2; +#X connect 4 0 11 1; +#X connect 5 0 6 0; +#X connect 6 0 11 0; +#X connect 7 0 8 0; +#X connect 11 0 12 0; +#X connect 11 1 12 1; diff --git a/square_root_pan~.pd b/square_root_pan~.pd new file mode 100644 index 0000000..760ed5d --- /dev/null +++ b/square_root_pan~.pd @@ -0,0 +1,29 @@ +#N canvas 509 36 441 430 10; +#X obj 23 38 inlet~; +#X obj 234 48 inlet; +#X obj 23 322 outlet~; +#X obj 81 322 outlet~; +#X text 30 342 left; +#X text 84 342 right; +#X obj 234 124 expr if($f1 > 0 \, $f1 \, 0); +#X obj 234 105 expr if($f1 < 1 \, $f1 \, 1); +#X text 247 91 filter so 0 < f < 1; +#X text 130 368 (C) Copyright 2004 Hans-Christoph Steiner; +#X text 234 384 released under the GNU GPL; +#X obj 23 263 pan_core~; +#X obj 309 44 loadbang; +#X msg 309 64 0.5; +#X obj 80 239 sqrt; +#X obj 50 158 expr sqrt(1 - $f1); +#X text 10 17 [square_root_pan~]; +#X connect 0 0 11 0; +#X connect 1 0 7 0; +#X connect 6 0 14 0; +#X connect 6 0 15 0; +#X connect 7 0 6 0; +#X connect 11 0 2 0; +#X connect 11 1 3 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 14 0 11 2; +#X connect 15 0 11 1; -- cgit v1.2.1