max v2; #N vpatcher 83 67 1147 770; #P user scope~ 650 363 915 504 16 3 84 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0; #P user scope~ 710 522 975 663 16 3 84 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0; #P user scope~ 650 202 915 343 16 3 84 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0; #P user scope~ 650 34 915 175 16 3 84 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0; #P newex 141 365 30 196617 *~ 4; #P comment 568 235 30 196617 -jhno; #P comment 571 325 30 196617 more; #P comment 433 311 167 196617 see [p curious] and oscsync.3.4 for; #P comment 433 250 167 196617 this is just a sketch. tinkering with the patch \, adding oscillators etc. should yield interesting results pretty quickly...; #P comment 206 118 42 196617 mo info; #N vpatcher 40 55 609 559; #P comment 213 456 314 196617 a >~ object works quite nicely as a square or pulse wave oscillator.; #P comment 213 182 314 196617 this patch uses a signal-and-hold object (sah~) to generate an offset signal that gets added with the output of the phasor~. when the modulation signal passes through zero in a positive direction \, sah~ samples the value of the ramp \, and holds it constant until the next trigger. the signal is inverted and summed with the ramp. as a result \, the ramp resets to zero at the instantaneous moment that it is sampled by sah~.; #P comment 213 64 313 196617 <-make a zero to one transition with the checkbox to "re-start" the slow phasor~ ramp.; #P comment 213 31 137 196617 oscillator sync; #P comment 213 352 314 196617 the resulting ramp signal can be used to drive anything \, in msp. the typical subject in analog synthesizers is a pulse wave oscillator \, which yields a pretty familiar sound... other types of oscillators \, wavetable lookup synthesis \, and buffer~ scanning are all interesting. as well \, the modulating sync signal does not need to be a stable oscillator - although \, harmonically simple signals often seem to work best. networks of basic oscillator types can be tuned to complex relationships \, that evolve slowly...; #P comment 213 273 314 196617 it is then necessary to wrap~ the value - not only so that it stays within the bounds of 0-1 \, but also so that it remains a continuous ramp \, for the purposes of driving an oscillator or other synchronized process. the integrity of the ramp can be verified by observing the patch at sub-audio rates \, as in the example to the left \, or by displaying high frequency behavior with scope~.; #P comment 213 115 314 196617 the basic idea is to use the output of one oscillator to re-start another - a standard technique on analog synthesizers. in msp \, it is possible to analyze any signal \, in any number of ways \, and use the result to modulate an oscillator - but first we need to figure out how to re-trigger a ramp signal with sample-accurate response.; #P newex 53 235 68 196617 snapshot~ 30; #P toggle 139 65 15 0; #P user number~ 117 181 156 196 9 3 3 2 0. 0. 0 0. 250 0.; #P newex 139 91 39 196617 sig~ 0.; #P newex 90 150 38 196617 *~ -1.; #P newex 90 126 29 196617 sah~; #P newex 53 258 39 196617 * 128.; #P newex 53 209 65 196617 pong~ 1 0. 1.; #P slider 53 291 15 128 0 1; #P newex 53 75 62 196617 phasor~ 0.3; #P comment 51 23 122 196617 this shows how it works \, in slow motion.; #P connect 6 0 3 0; #P connect 1 0 3 0; #P connect 3 0 10 0; #P connect 10 0 4 0; #P connect 4 0 2 0; #P connect 1 0 5 0; #P connect 5 0 6 0; #P connect 7 0 5 1; #P connect 6 0 8 0; #P connect 9 0 7 0; #P pop; #P newobj 202 132 49 196617 p curious; #N vpreset 8; #X append 1 2 2 270 77 toggle int 1 \; 3 133 102 gain~ list 78 10. \; 9 31 357 flonum float 35.630138 \; 12 133 84 gain~ list 76 10. \; 13 64 109 flonum float -0.09 \; 15 347 567; #X append 1 2 number int 84 \; 16 347 337 number int 16 \; 18 38 475 flonum float 0.49 \; 21 128 465 flonum float 8.699994 \; 22 149 467 flonum float 94. \; 25 237 141 gain~ list 114 10. \;; #X append 1 2 27 237 165 gain~ list 132 10. \; 28 175 227 flonum float 0. \; 29 190 227 flonum float 0. \;; #X append 2 2 2 270 77 toggle int 1 \; 3 133 102 gain~ list 85 10. \; 9 31 357 flonum float 64.329987 \; 12 133 84 gain~ list 80 10. \; 13 64 109 flonum float 0.439999 \; 15 347 567; #X append 2 2 number int 84 \; 16 347 337 number int 16 \; 18 38 475 flonum float 64. \; 21 128 465 flonum float 209. \; 22 149 467 flonum float 30. \; 25 237 141 gain~ list 112 10. \;; #X append 2 2 27 237 165 gain~ list 88 10. \; 28 175 227 flonum float 236. \; 29 190 227 flonum float 0.54 \;; #X append 3 2 2 270 77 toggle int 1 \; 3 133 102 gain~ list 83 10. \; 9 31 357 flonum float 46. \; 12 133 84 gain~ list 82 10. \; 13 64 109 flonum float 0.729999 \; 15 347 567; #X append 3 2 number int 84 \; 16 347 337 number int 16 \; 18 38 475 flonum float 0.14 \; 21 128 465 flonum float 50. \; 22 149 467 flonum float 96. \; 25 237 141 gain~ list 113 10. \;; #X append 3 2 27 237 165 gain~ list 127 10. \; 28 175 227 flonum float 554. \; 29 190 227 flonum float 0.22 \;; #X append 4 2 2 270 77 toggle int 1 \; 3 133 102 gain~ list 85 10. \; 9 31 357 flonum float 85. \; 12 133 84 gain~ list 95 10. \; 13 64 109 flonum float 0.549999 \; 15 347 567; #X append 4 2 number int 84 \; 16 347 337 number int 16 \; 18 38 475 flonum float 296.749847 \; 21 128 465 flonum float 507. \; 22 149 467 flonum float 101. \; 25 237 141 gain~ list 86 10. \;; #X append 4 2 27 237 165 gain~ list 116 10. \; 28 175 227 flonum float 236. \; 29 190 227 flonum float 0.54 \;; #X append 5 2 2 270 77 toggle int 1 \; 3 133 102 gain~ list 85 10. \; 9 31 357 flonum float 65.630089 \; 12 133 84 gain~ list 80 10. \; 13 64 109 flonum float 0.309999 \; 15 347 567; #X append 5 2 number int 84 \; 16 347 337 number int 16 \; 18 38 475 flonum float 65. \; 21 128 465 flonum float 253. \; 22 149 467 flonum float 0. \; 25 237 141 gain~ list 112 10. \;; #X append 5 2 27 237 165 gain~ list 113 10. \; 28 175 227 flonum float 236. \; 29 190 227 flonum float 0.54 \;; #X append 6 2 2 270 77 toggle int 1 \; 3 133 102 gain~ list 85 10. \; 9 31 357 flonum float 65.630089 \; 12 133 84 gain~ list 80 10. \; 13 64 109 flonum float 0.439999 \; 15 347 567; #X append 6 2 number int 84 \; 16 347 337 number int 16 \; 18 38 475 flonum float 64. \; 21 128 465 flonum float 22. \; 22 149 467 flonum float 0. \; 25 237 141 gain~ list 112 10. \;; #X append 6 2 27 237 165 gain~ list 113 10. \; 28 175 227 flonum float 236. \; 29 190 227 flonum float 0.54 \;; #X append 7 2 2 270 77 toggle int 1 \; 3 133 102 gain~ list 85 10. \; 9 31 357 flonum float 25. \; 12 133 84 gain~ list 95 10. \; 13 64 109 flonum float 0.570001 \; 15 347 567; #X append 7 2 number int 84 \; 16 347 337 number int 16 \; 18 38 475 flonum float 174. \; 21 128 465 flonum float 356. \; 22 149 467 flonum float 1.449989 \; 25 237 141 gain~ list 0 10. \;; #X append 7 2 27 237 165 gain~ list 128 10. \; 28 175 227 flonum float 340. \; 29 190 227 flonum float 0.040001 \;; #X append 8 2 2 270 77 toggle int 1 \; 3 133 102 gain~ list 85 10. \; 9 31 357 flonum float 25. \; 12 133 84 gain~ list 95 10. \; 13 64 109 flonum float 0.220001 \; 15 347 567; #X append 8 2 number int 84 \; 16 347 337 number int 16 \; 18 38 475 flonum float 100.089943 \; 21 128 465 flonum float 272. \; 22 149 467 flonum float 1. \; 25 237 141 gain~ list 0 10. \;; #X append 8 2 27 237 165 gain~ list 128 10. \; 28 175 227 flonum float 334. \; 29 190 227 flonum float 0.220001 \;; #P preset 203 76 47 27; #P flonum 227 190 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 227 175 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P user gain~ 165 237 24 100 158 0 1.071519 7.94321 10.; #P newex 165 213 93 196617 lores~ 300. 0.5; #P user gain~ 141 237 24 100 158 0 1.071519 7.94321 10.; #P user scope~ 48 408 313 549 16 3 84 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0; #P newex 475 62 62 196617 phasor~ 0.3; #P flonum 467 149 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 465 128 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 435 155 27 196617 +~; #P newex 435 133 27 196617 *~; #P flonum 475 38 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 435 108 50 196617 cycle~ 0.; #P number 337 347 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P number 567 347 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P user scope~ 337 408 602 549 16 3 84 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0; #P flonum 109 64 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P user gain~ 84 133 18 57 158 0 1.071519 7.94321 10.; #P newex 84 88 35 196617 >~ 0.5; #P newex 102 110 50 196617 cycle~ 0.; #P flonum 357 31 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 357 54 62 196617 cycle~ 300.; #P newex 297 116 38 196617 *~ -1.; #P newex 297 92 41 196617 sah~ 0.; #P newex 286 146 65 196617 pong~ 1 0. 1.; #P newex 286 55 62 196617 phasor~ 0.3; #P user gain~ 102 133 18 57 158 0 1.071519 7.94321 10.; #P toggle 77 270 40 0; #P newex 141 385 45 196617 dac~; #P comment 377 207 222 1048600 hard oscillator sync; #P connect 16 0 24 0; #P fasten 11 0 24 0 89 115 53 115; #P fasten 5 0 11 0 291 173 169 173 169 55 89 55; #P connect 11 0 12 0; #P connect 10 0 3 0; #P connect 13 0 11 1; #P fasten 3 0 25 0 107 224 146 224; #P fasten 12 0 25 0 89 224 146 224; #P connect 27 0 37 0; #P connect 25 0 37 0; #P connect 37 0 1 0; #P connect 2 0 1 0; #P fasten 5 0 10 1 291 172 169 172 169 102 147 102; #P connect 12 0 26 0; #P connect 3 0 26 0; #P connect 26 0 27 0; #P connect 37 0 1 1; #P connect 28 0 26 1; #P connect 29 0 26 2; #P connect 20 0 4 0; #P connect 4 0 5 0; #P connect 7 0 5 0; #P connect 4 0 6 0; #P connect 6 0 7 0; #P connect 15 0 24 1; #P connect 8 0 6 1; #P connect 16 0 14 0; #P fasten 5 0 14 0 291 370 342 370; #P connect 9 0 8 0; #P connect 17 0 19 0; #P connect 19 0 20 0; #P connect 21 0 19 1; #P connect 22 0 20 1; #P connect 18 0 23 0; #P connect 23 0 17 1; #P connect 15 0 14 1; #P connect 17 0 38 0; #P connect 6 0 39 0; #P connect 4 0 41 0; #P connect 4 0 40 0; #P connect 7 0 40 0; #P pop;