Forums > MaxMSP

[Sharing/Emulation] "Analog" Shift Register

September 2, 2010 | 6:17 pm

I was reading about shift register modules for analog synths and put together this msp version of the concept. It’s a canon/s&h/delay with 4 outputs. On each trigger the first output samples the input. The other outputs hold past samples, moving down one output on each trigger. For a better explanation this is the module i based my patch on. http://www.ear-group.net/model_23.html

*NOTE*
I’m not 100% sure this is the best way to implement this concept. The delay~s prevent all the sah~ from outputting the same values but there may be a more computationally effective method (without leaving signal domain). This is not a CPU eater by any means but for those who can’t spare the processing I figure it’s worth mentioning since this is meant to be incorporated into larger patches.

#P button 187 29 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden message 220 66 37 196617 3.141;
#P hidden message 187 66 31 196617 0.25;
#P hidden newex 187 46 48 196617 loadbang;
#P comment 348 144 81 196617 < "trigger" input;
#P comment 7 144 81 196617 "voltage" input >;
#P comment 38 354 50 196617 output 4 >;
#P comment 38 294 50 196617 output 3 >;
#P comment 38 234 50 196617 output 2 >;
#P newex 140 293 58 196617 delay~ 1 1;
#P newex 140 233 58 196617 delay~ 1 1;
#P user number~ 89 143 138 158 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user number~ 298 143 347 158 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 140 85 60 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 256 55 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 140 113 46 196617 phasor~;
#P user number~ 89 173 138 188 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user number~ 89 233 138 248 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user number~ 89 293 138 308 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user number~ 89 353 138 368 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 140 323 43 196617 sah~ 0.;
#P newex 140 263 43 196617 sah~ 0.;
#P newex 140 203 43 196617 sah~ 0.;
#P newex 256 113 39 196617 < ~ 0.1;
#P newex 256 83 46 196617 phasor~;
#P newex 140 143 43 196617 sah~ 0.;
#P newex 140 173 58 196617 delay~ 1 1;
#P user ezdac~ 140 50 184 83 0;
#P comment 38 174 50 196617 output 1 >;
#P window setfont "Sans Serif" 12.;
#P comment 37 31 131 196620 Digital Shift Register;
#P window setfont "Sans Serif" 9.;
#P window linecount 3;
#P comment 38 46 100 196617 based on Plan B Model 23 Analog Shift Register;
#P window linecount 1;
#P comment 203 29 100 196617 < initalize;
#P fasten 16 0 20 0 145 136 94 136;
#P fasten 6 0 15 0 145 166 94 166;
#P fasten 9 0 14 0 145 226 94 226;
#P fasten 10 0 13 0 145 286 94 286;
#P fasten 11 0 12 0 145 346 94 346;
#P hidden connect 30 0 18 0;
#P connect 18 0 16 0;
#P connect 16 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 9 0;
#P connect 9 0 21 0;
#P connect 21 0 10 0;
#P connect 10 0 22 0;
#P connect 22 0 11 0;
#P fasten 8 0 6 1 261 136 178 136;
#P fasten 8 0 9 1 261 195 178 195;
#P fasten 8 0 10 1 261 256 178 256;
#P fasten 8 0 11 1 261 316 178 316;
#P hidden connect 31 0 28 0;
#P hidden connect 28 0 29 0;
#P hidden connect 28 0 30 0;
#P hidden connect 29 0 17 0;
#P connect 17 0 7 0;
#P connect 7 0 8 0;
#P fasten 8 0 19 0 261 136 303 136;
#P window clipboard copycount 32;


September 2, 2010 | 6:45 pm

this is really great!
i might just swap out ‘< ~ 0.1' with 'change~' mainly because if you want it synced to the actual start of phasor~ it would be more exact:

#P button 247 89 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden message 280 126 37 196617 3.141;
#P hidden message 247 126 31 196617 0.25;
#P hidden newex 247 106 48 196617 loadbang;
#P comment 408 204 81 196617 < "trigger" input;
#P comment 67 204 81 196617 "voltage" input >;
#P comment 98 414 50 196617 output 4 >;
#P comment 98 354 50 196617 output 3 >;
#P comment 98 294 50 196617 output 2 >;
#P newex 200 353 58 196617 delay~ 1 1;
#P newex 200 293 58 196617 delay~ 1 1;
#P user number~ 149 203 198 218 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user number~ 358 203 407 218 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 200 145 60 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 316 115 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 200 173 46 196617 phasor~;
#P user number~ 149 233 198 248 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user number~ 149 293 198 308 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user number~ 149 353 198 368 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user number~ 149 413 198 428 9 3 3 2 0. 0. 0 0. 20 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 200 383 43 196617 sah~ 0.;
#P newex 200 323 43 196617 sah~ 0.;
#P newex 200 263 43 196617 sah~ 0.;
#P newex 316 173 46 196617 change~;
#P newex 316 143 46 196617 phasor~;
#P newex 200 203 43 196617 sah~ 0.;
#P newex 200 233 58 196617 delay~ 1 1;
#P user ezdac~ 200 110 244 143 0;
#P comment 98 234 50 196617 output 1 >;
#P window setfont "Sans Serif" 12.;
#P comment 97 91 131 196620 Digital Shift Register;
#P window setfont "Sans Serif" 9.;
#P window linecount 3;
#P comment 98 106 100 196617 based on Plan B Model 23 Analog Shift Register;
#P window linecount 1;
#P comment 263 89 100 196617 < initalize;
#P fasten 8 0 6 1 321 196 238 196;
#P fasten 8 0 9 1 321 255 238 255;
#P fasten 8 0 10 1 321 316 238 316;
#P fasten 8 0 11 1 321 376 238 376;
#P fasten 8 0 19 0 321 196 363 196;
#P connect 7 0 8 0;
#P connect 17 0 7 0;
#P hidden connect 29 0 17 0;
#P hidden connect 28 0 30 0;
#P hidden connect 28 0 29 0;
#P hidden connect 31 0 28 0;
#P connect 22 0 11 0;
#P fasten 10 0 13 0 205 346 154 346;
#P connect 10 0 22 0;
#P connect 21 0 10 0;
#P fasten 9 0 14 0 205 286 154 286;
#P connect 9 0 21 0;
#P connect 5 0 9 0;
#P fasten 6 0 15 0 205 226 154 226;
#P connect 6 0 5 0;
#P fasten 16 0 20 0 205 196 154 196;
#P connect 16 0 6 0;
#P connect 18 0 16 0;
#P hidden connect 30 0 18 0;
#P fasten 11 0 12 0 205 406 154 406;
#P window clipboard copycount 32;


September 2, 2010 | 7:22 pm

thanks for the tip!


September 3, 2010 | 2:20 am

why [delay~] ? why not [-~ 0.25] ?


September 3, 2010 | 2:38 am

I didn’t look at your patch, but the object [bucket] pretty much just does this.


September 3, 2010 | 3:15 am

[delay~] gives the previous output a little extra time so that they don’t all output the same values. i’m not sure where the [-~ 0.25] would go. the trigger has to happen at the same time and math on the outputs would defeat the purpose.

the idea is
____ = out1 out2 out3 out4
trig1 = 0.37 0.00 0.00 0.00
trig2 = 0.91 0.37 0.00 0.00
trig3 = 0.54 0.91 0.37 0.00
trig4 = 0.18 0.54 0.91 0.37
trig5 = 0.66 0.18 0.54 0.91
etc.

it looks like [bucket] is the scheduler version of this. my patch is a signal rate version. i’m using it as an abstraction in a "digital modular" i’m building.


September 3, 2010 | 3:17 pm

might be fun to try a version that simply converts from sig to float and then back again?


September 3, 2010 | 3:32 pm

ah, i did not have max yesterday and could not figure what it does using the runtime.

since today i have my maxmsp computer back on the net.^^

well if you would measure the difference between the first and the second value of
out1, you could create the very next output of output2 by adding this difference value,
i.e. recalculate the values instead of storing them.

i might post a patch later.


September 3, 2010 | 3:47 pm

BTW I think the Plan B ASR is a straight up copy of the Serge ASR… Peter G had a *cough* tendency *cough* to copy ;)

here’s my take on it, using [bucket] as you mention above. I guess you do lose a tiny bit of temporal resolution in the process, but for the normal use (arabesques and such) then scheduler rate is just dandy.

I just did this to add it to my snippets collection really.

seems like you’re not on v5, so here’s the patch in png form:

http://i.imgur.com/O2kL9.png

– Pasted Max Patch, click to expand. –

Viewing 9 posts - 1 through 9 (of 9 total)