a modified pan4S abstraction, and questions

Zachary Seldess's icon

Hello everyone,

I've attached a modified version of the pan4S abstraction that allows you to change the minimum amplitude of the panned sound (that is, control how quiet the sound is on the opposite side from which it is located - a kind of ambient level of the sound), and the width of the sound as it pans. To do this I'm updating the waveform stored in the buffer~ and accessed via the cycle~s.

The strange thing is that even though the waveform visually updates (i.e. after making a change, if I double-click on a cycle~ inside I see a new waveform), the sound output isn't affected until I turn the dac off and back on again. Does someone know why this is happening? I can't figure out any other way to get the new waveform to be recognized, again, even though buffer~ does show that the change has registered.

Here's the abstraction, named pan4Sz:

Max Patch
Copy patch and select New From Clipboard in Max.

-------------------------

And here's the parent patch, named whatever:

Max Patch
Copy patch and select New From Clipboard in Max.

Samuel Freeman's icon

save this as pan4Szx and use in place of pan4Sz:

Max Patch
Copy patch and select New From Clipboard in Max.

it sends a set message to cycle~s when waveform is remade

On 03/09/07, Zachary Seldess wrote:
>
> Hello everyone,
>
> I've attached a modified version of the pan4S abstraction that allows you to change the minimum amplitude of the panned sound (that is, control how quiet the sound is on the opposite side from which it is located - a kind of ambient level of the sound), and the width of the sound as it pans. To do this I'm updating the waveform stored in the buffer~ and accessed via the cycle~s.
>
> The strange thing is that even though the waveform visually updates (i.e. after making a change, if I double-click on a cycle~ inside I see a new waveform), the sound output isn't affected until I turn the dac off and back on again. Does someone know why this is happening? I can't figure out any other way to get the new waveform to be recognized, again, even though buffer~ does show that the change has registered.
>
> Here's the abstraction, named pan4Sz:
>
> max v2;
> #N vpatcher 376 158 906 409;
> #P window setfont Geneva 9.;
> #P window linecount 2;
> #P comment 422 156 93 196617 minimum amplitude (0.- 1.);
> #N comlet minimum amplitude (0.- 1.);
> #P inlet 455 183 15 0;
> #P comment 360 129 95 196617 Width of waveform (0. - 1.);
> #N comlet width of sound (0. - 1.);
> #P inlet 380 183 15 0;
> #P window linecount 1;
> #N vpatcher 909 157 1169 516;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 127 220 27 131137545 t b f;
> #P newex 17 58 27 131137545 f;
> #P window linecount 2;
> #P comment 144 196 83 131137545 minimum amplitude (0. - 1.);
> #P window linecount 1;
> #P newex 34 28 69 131137545 loadmess 0.5;
> #N comlet minimum amplitude (0.- 1.);
> #P inlet 127 196 15 0;
> #P newex 17 80 29 131137545 t b f;
> #P inlet 17 28 15 0;
> #P newex 131 104 41 131137545 * 512.;
> #P newex 131 171 98 131137545 expr (512-$i1) + 1;
> #P window linecount 0;
> #P newex 131 127 98 131137545 expr (512-$i1) / 2;
> #P newex 17 316 113 131137545 buffer~ pan4.aif 11.61;
> #P newex 17 293 75 131137545 peek~ pan4.aif;
> #N counter 0 0 512;
> #X flags 0 0;
> #P newobj 17 171 108 131137545 counter 0 0 512;
> #P newex 17 128 107 131137545 t 513 b clear;
> #P newex 17 149 40 131137545 Uzi 10;
> #P newex 17 194 56 131137545 t i i;
> #P newex 17 270 56 131137545 pack 0 0.;
> #N vpatcher 337 144 748 548;
> #N comlet minimum amplitude (0. - 1.);
> #P inlet 227 33 15 0;
> #P window setfont "Sans Serif" 9.;
> #P newex 227 94 67 131137545 expr 512 - $i1;
> #P newex 227 68 87 131137545 scale 0. 1. 0 256;
> #P newex 299 94 86 131137545 expr sqrt($i1/256.);
> #P newex 22 333 47 131137545 * 0.001;
> #P newex 208 196 27 131137545 0.;
> #P newex 208 116 20 131137545 t b;
> #P newex 22 94 196 131137545 if $i1>=$i2 && $i1
> #P inlet 47 33 15 0;
> #P newex 22 165 136 131137545 scale 128 384 0 512;
> #P inlet 72 33 15 0;
> #P newex 72 211 36 131137545 - 256;
> #P newex 72 276 27 131137545 -;
> #P newex 72 253 27 131137545 256;
> #P newex 72 232 27 131137545 t b i;
> #P newex 22 189 60 131137545 split 0 256;
> #P newex 22 309 125 131137545 expr (sqrt($i1/256.)) * 1000.;
> #P outlet 22 362 15 0;
> #P inlet 22 33 15 0;
> #P comment 244 33 136 131137545 minimum amplitude (0. - 1.);
> #P connect 1 0 12 0;
> #P connect 12 0 10 0;
> #P connect 10 0 4 0;
> #P connect 4 0 3 0;
> #P fasten 7 0 3 0 77 301 27 301;
> #P connect 3 0 15 0;
> #P connect 15 0 2 0;
> #P fasten 14 0 2 0 213 356 27 356;
> #P connect 11 0 10 1;
> #P connect 9 0 10 2;
> #P connect 4 1 8 0;
> #P connect 8 0 5 0;
> #P connect 5 0 6 0;
> #P connect 6 0 7 0;
> #P connect 5 1 7 1;
> #P connect 17 0 10 3;
> #P connect 11 0 12 1;
> #P connect 18 0 10 4;
> #P connect 9 0 12 2;
> #P connect 12 1 13 0;
> #P connect 13 0 14 0;
> #P fasten 16 0 14 1 304 153 230 153;
> #P connect 19 0 17 0;
> #P connect 17 0 18 0;
> #P fasten 17 0 16 0 232 89 304 89;
> #P pop;
> #P newobj 63 247 93 131137545 p pan_curve;
> #B color 12;
> #P connect 14 0 16 0;
> #P connect 11 0 16 0;
> #P connect 17 0 16 0;
> #P connect 16 0 12 0;
> #P connect 12 0 4 0;
> #P connect 4 0 3 0;
> #P connect 3 0 5 0;
> #P connect 5 0 2 0;
> #P connect 2 0 1 0;
> #P connect 1 0 6 0;
> #P connect 4 2 7 0;
> #P lcolor 8;
> #P connect 2 1 0 0;
> #P connect 0 0 1 1;
> #P connect 4 1 5 2;
> #P connect 8 0 0 1;
> #P connect 9 0 0 2;
> #P connect 13 0 17 0;
> #P fasten 12 1 10 0 41 100 136 100;
> #P connect 10 0 8 0;
> #P connect 8 0 9 0;
> #P connect 17 1 0 3;
> #P pop;
> #P newobj 380 209 85 196617 patcher panCurve;
> #B color 12;
> #P window setfont "Sans Serif" 9.;
> #N vpatcher 10 59 389 309;
> #P window setfont "Sans Serif" 9.;
> #P comment 164 182 157 131137545
> #P comment 30 203 114 131137545 speaker 4 = right rear;
> #P comment 30 188 114 131137545 speaker 3 = left rear;
> #P comment 30 173 114 131137545 speaker 2 = right front;
> #P comment 30 158 114 131137545 speaker 1 = left front;
> #P comment 30 128 244 131137545 but when you explain that to the sound engineer , she'll give you one of those looks...so make it easy:;
> #P comment 30 109 114 131137545 speaker 4 = left rear;
> #P comment 30 94 114 131137545 speaker 3 = right rear;
> #P comment 30 79 114 131137545 speaker 2 = right front;
> #P comment 30 33 262 131137545 when you build a patch to move sounds in a circle or spiral around you , this numbering system makes sense:;
> #P comment 30 64 114 131137545 speaker 1 = left front;
> #P comment 176 89 73 131137545
> #P pop;
> #P newobj 14 209 54 131137545 p friends;
> #B color 12;
> #P newex 380 73 44 131137545 +~ 0.;
> #P newex 206 73 48 131137545 +~ 0.25;
> #P newex 294 73 44 131137545 +~ 0.75;
> #P newex 288 135 31 131137545 *~;
> #P newex 309 104 81 131137545 cycle~ pan4.aif;
> #N comlet LeftRear Signal Out;
> #P outlet 202 160 15 0;
> #P comment 175 178 92 131137545 LeftRear Signal Out;
> #P newex 223 104 81 131137545 cycle~ pan4.aif;
> #P comment 270 178 102 131137545 RightRear Signal Out;
> #N comlet RightRear Signal Out;
> #P outlet 288 160 15 0;
> #P newex 202 135 31 131137545 *~;
> #P newex 120 73 44 131137545 +~ 0.5;
> #P newex 114 135 31 131137545 *~;
> #P newex 135 104 81 131137545 cycle~ pan4.aif;
> #N comlet Right Signal Out;
> #P outlet 114 160 15 0;
> #P comment 88 178 76 131137545 Right Signal Out;
> #P newex 49 104 81 131137545 cycle~ pan4.aif;
> #P comment 8 178 76 131137545 Left Signal Out;
> #N comlet Left Signal Out;
> #P outlet 28 160 15 0;
> #P newex 28 135 31 131137545 *~;
> #N comlet Signal In;
> #P inlet 28 29 15 0;
> #P comment 53 29 42 131137545 Signal In;
> #N comlet (SIgnal) Quad Pan (0. - 1.);
> #P inlet 120 29 15 0;
> #P comment 136 29 129 131137545 (SIgnal) Quad Pan (0. - 1.);
> #P connect 3 0 4 0;
> #P connect 4 0 5 0;
> #P connect 7 0 4 1;
> #P fasten 3 0 11 0 33 128 119 128;
> #P connect 11 0 9 0;
> #P fasten 1 0 12 0 125 64 125 64;
> #P connect 12 0 7 1;
> #P connect 10 0 11 1;
> #P fasten 3 0 13 0 33 128 207 128;
> #P connect 13 0 18 0;
> #P fasten 1 0 22 0 125 63 211 63;
> #P connect 22 0 10 1;
> #P connect 16 0 13 1;
> #P fasten 3 0 20 0 33 128 293 128;
> #P connect 20 0 14 0;
> #P fasten 1 0 21 0 125 63 299 63;
> #P connect 21 0 16 1;
> #P connect 19 0 20 1;
> #P fasten 1 0 23 0 125 63 385 63;
> #P connect 23 0 19 1;
> #P connect 26 0 25 0;
> #P connect 28 0 25 1;
> #P pop;
>
> -------------------------
>
> And here's the parent patch, named whatever:
>
> max v2;
> #N vpatcher 474 96 760 400;
> #P window setfont Geneva 9.;
> #P window linecount 4;
> #P comment 26 24 245 196617 NOTE ON WIDTH ; 0.5 is the minimum recommended width ; (resulting in panning between two channels at time) ; For wider presence increase the value.;
> #P window linecount 1;
> #P comment 92 107 43 196617 panning;
> #P user meter~ 219 219 232 277 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
> #P user meter~ 164 219 177 277 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
> #P user meter~ 107 219 120 277 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
> #P user meter~ 50 219 63 277 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
> #P hidden newex 151 99 48 196617 loadbang;
> #P hidden message 151 116 42 196617 set 0.5;
> #P flonum 207 142 35 9 0. 1. 67 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 95 122 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 95 142 29 196617 sig~;
> #P toggle 20 167 15 0;
> #P flonum 151 142 35 9 0. 1. 67 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 39 198 180 196617 dac~ 1 2 3 4;
> #P newex 39 167 179 196617 pan4Sz;
> #P user gain~ 39 103 34 28 158 0 1.071519 7.94321 10.;
> #P newex 39 77 61 196617 cycle~ 300;
> #P window linecount 2;
> #P comment 147 116 48 196617 width of sound;
> #P comment 204 116 48 196617 minimum amp;
> #P connect 2 0 3 0;
> #P connect 3 0 4 0;
> #P connect 4 0 5 0;
> #P fasten 7 0 5 0 25 189 44 189;
> #P connect 4 0 13 0;
> #P connect 9 0 8 0;
> #P connect 8 0 4 1;
> #P connect 4 1 5 1;
> #P connect 4 1 14 0;
> #P hidden connect 12 0 11 0;
> #P hidden connect 11 0 6 0;
> #P connect 6 0 4 2;
> #P connect 4 2 5 2;
> #P connect 4 2 15 0;
> #P connect 10 0 4 3;
> #P connect 4 3 5 3;
> #P connect 4 3 16 0;
> #P pop;
>
> --
> http://www.zacharyseldess.com
>
>

Zachary Seldess's icon

Thanks Samuel, I figured something quite simple was alluding me, and there it is! Now that that is fixed, here is the pan4Sz abstraction again along with a sample patch that uses lcd to control the position and loudness of the sound, and another parent/abstraction pair that does the same thing but with 8 channels. The distance/fading behavior is very simple - I'll try to post more realistic fading at some other time. Any comments/suggestions would be great.

Zachary

save this abstraction as pan4Sz.pat:

Max Patch
Copy patch and select New From Clipboard in Max.

--------------------

save the parent patch as whatever:

Max Patch
Copy patch and select New From Clipboard in Max.

-------------------------
-------------------------

save this abstraction as pan8Sz.pat:

Max Patch
Copy patch and select New From Clipboard in Max.

-----------------

save the parent patch as whatever:

Max Patch
Copy patch and select New From Clipboard in Max.

Stefan Tiedje's icon

Samuel Freeman schrieb:
> save this as pan4Szx and use in place of pan4Sz:

doesn't really explain the behaviour though it works. I guess cycle~ is
creating a local copy of the buffer when the audio chain is created.
Might be a design flaw and would eat uneccescaryly resources, but who
knows, it might be the only way to do it...

Only the code maintainers at C74 can tell...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com