max v2; #N vpatcher 243 98 904 653; #P origin 0 10; #P newex 119 355 30 196617 *~ 4; #N vpatcher 466 135 1035 639; #P user number~ 4 93 54 108 9 3 3 2 0. 0. 0 0. 250 0.; #P user number~ 89 223 139 238 9 3 3 2 0. 0. 0 0. 250 0.; #P newex 53 206 27 196617 +~; #P user ezdac~ 133 392 177 425 0; #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 169 64 313 196617 <-make a zero-to-one transition with the checkbox to "re-start" the slow phasor~ ramp.; #P comment 213 31 100 196620 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 pong~ 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 277 68 196617 snapshot~ 30; #P toggle 139 65 15 0; #P user number~ 132 168 182 183 9 3 3 2 0. 0. 0 0. 250 0.; #P newex 139 101 39 196617 sig~ 0.; #P newex 90 150 38 196617 *~ -1.; #P newex 90 126 29 196617 sah~; #P newex 53 300 39 196617 * 128.; #P newex 53 251 83 196617 pong~ 1 0. 1.; #P slider 53 333 15 128 0 1; #P newex 53 75 62 196617 phasor~ 0.3; #P comment 9 35 122 196617 this shows how it works \, in slow motion.; #P connect 1 0 21 0; #P connect 1 0 19 0; #P connect 19 0 3 0; #P connect 3 0 10 0; #P connect 10 0 4 0; #P connect 4 0 2 0; #P connect 6 0 19 1; #P connect 19 0 20 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 186 106 49 196617 p curious; #B color 5; #P comment 626 398 18 196617 jhno ; #P button 627 517 15 0; #P button 31 29 15 0; #P comment 316 21 260 196617 <- this won't do anything while a signal is connected - !; #P comment 190 91 42 196617 mo info; #P comment 71 34 91 196617 adjust pulse width; #P comment 173 331 58 196617 filtered; #P comment 84 331 24 196617 dry; #P comment 175 266 123 196617 2up_svf~ is at: http://www.2uptech.com - or swap in lores~ \, biquad~ \, lp1~ \, etc.; #P comment 175 225 123 196617 ^^ things sound better with 2up; #P comment 315 296 105 196617 tune the scope~s for viewing pleasure; #P comment 416 244 223 196617 this could be a place to insert other audio signals... low-pass filtered \, percussive sounds \, or textures with strong fundamental tones...; #P comment 507 325 100 196617 it is possible to obtain an interesting writhe in the scope~; #P comment 524 39 100 196617 modulates multiple destinations...; #P comment 277 181 14 196617 Q; #P comment 254 161 36 196617 cutoff; #P comment 355 346 100 196617 samples per buffer; #N vpreset 7; #X append 1 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 95 10. \; 9 19 264 flonum float 43. \; 12 121 62 gain~ list 91 10. \; 13 52 87 flonum float 0.439999 \; 15 344 318; #X append 1 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 98.520004 \; 21 133 461 flonum float 60. \; 22 154 463 flonum float 71. \; 27 130 551 flonum float 268. \; 28 151 553; #X append 1 2 flonum float 109. \; 31 225 119 gain~ list 101 10. \; 33 225 143 gain~ list 123 10. \; 34 180 225 flonum float 1.11 \; 36 159 201 flonum float 29. \;; #X append 2 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 95 10. \; 9 19 264 flonum float 43. \; 12 121 62 gain~ list 91 10. \; 13 52 87 flonum float 0.439999 \; 15 344 318; #X append 2 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 19. \; 21 133 461 flonum float 27. \; 22 154 463 flonum float 5. \; 27 130 551 flonum float 35. \; 28 151 553; #X append 2 2 flonum float -8.040001 \; 31 225 119 gain~ list 101 10. \; 33 225 143 gain~ list 123 10. \; 34 180 225 flonum float 1.11 \; 36 159 201 flonum float 29. \;; #X append 5 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 95 10. \; 9 19 264 flonum float 43. \; 12 121 62 gain~ list 91 10. \; 13 52 87 flonum float 0.439999 \; 15 344 318; #X append 5 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 19. \; 21 133 461 flonum float 69. \; 22 154 463 flonum float -3. \; 27 130 551 flonum float 35. \; 28 151 553; #X append 5 2 flonum float -8.040001 \; 31 225 119 gain~ list 101 10. \; 33 225 143 gain~ list 123 10. \; 34 180 225 flonum float 1.11 \; 36 159 201 flonum float 29. \;; #X append 6 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 95 10. \; 9 19 264 flonum float 43. \; 12 121 62 gain~ list 91 10. \; 13 52 87 flonum float 0.439999 \; 15 344 318; #X append 6 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 19. \; 21 133 461 flonum float 69. \; 22 154 463 flonum float 64. \; 27 130 551 flonum float 35. \; 28 151 553; #X append 6 2 flonum float -8.040001 \; 31 225 119 gain~ list 0 10. \; 33 225 143 gain~ list 123 10. \; 34 180 225 flonum float 0.88 \; 36 159 201 flonum float 303. \;; #X append 7 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 95 10. \; 9 19 264 flonum float 48. \; 12 121 62 gain~ list 91 10. \; 13 52 87 flonum float 0.059999 \; 15 344 318; #X append 7 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 31. \; 21 133 461 flonum float 5. \; 22 154 463 flonum float 5. \; 27 130 551 flonum float -34. \; 28 151 553; #X append 7 2 flonum float 58. \; 31 225 119 gain~ list 101 10. \; 33 225 143 gain~ list 123 10. \; 34 180 225 flonum float 0.4 \; 36 159 201 flonum float 154. \;; #P preset 401 38 47 27; #P flonum 201 159 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 184 178 27 196617 +~; #P flonum 225 180 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P user gain~ 143 225 24 100 158 0 1.071519 7.94321 10.; #P newex 143 201 93 196617 lores~ 300. 0.5; #P user gain~ 119 225 24 100 158 0 1.071519 7.94321 10.; #P user scope~ 23 399 288 540 16 3 84 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0; #P newex 471 67 62 196617 phasor~ 0.3; #P flonum 553 151 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 551 130 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 521 157 27 196617 +~; #P newex 521 135 27 196617 *~; #P newex 521 110 65 196617 triangle~ 0.5; #N vpreset 8; #X append 1 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 87 10. \; 9 19 264 flonum float 160.910019 \; 12 121 62 gain~ list 92 10. \; 13 52 87 flonum float 0.779999 \; 15 344 318; #X append 1 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 123. \; 21 133 461 flonum float -170.499908 \; 22 154 463 flonum float -380.500031 \; 27 130 551 flonum float 340. \; 28 151 553; #X append 1 2 flonum float -543. \; 31 225 119 gain~ list 59 10. \; 33 225 143 gain~ list 130 10. \; 34 180 225 flonum float 0.940001 \; 36 159 201 flonum float 383. \;; #X append 2 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 93 10. \; 9 19 264 flonum float 239. \; 12 121 62 gain~ list 83 10. \; 13 52 87 flonum float 0.139999 \; 15 344 318; #X append 2 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 133. \; 21 133 461 flonum float 45. \; 22 154 463 flonum float 107. \; 27 130 551 flonum float 45. \; 28 151 553; #X append 2 2 flonum float 112. \; 31 225 119 gain~ list 93 10. \; 33 225 143 gain~ list 130 10. \; 34 180 225 flonum float 0.54 \; 36 159 201 flonum float 113. \;; #X append 3 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 99 10. \; 9 19 264 flonum float 139. \; 12 121 62 gain~ list 67 10. \; 13 52 87 flonum float 0.499999 \; 15 344 318; #X append 3 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 30. \; 21 133 461 flonum float 217. \; 22 154 463 flonum float 179.720062 \; 27 130 551 flonum float 0. \; 28 151 553; #X append 3 2 flonum float 0. \; 31 225 119 gain~ list 102 10. \; 33 225 143 gain~ list 109 10. \; 34 180 225 flonum float 0.54 \; 36 159 201 flonum float 113. \;; #X append 4 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 85 10. \; 9 19 264 flonum float 43. \; 12 121 62 gain~ list 80 10. \; 13 52 87 flonum float 0.439999 \; 15 344 318; #X append 4 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 64. \; 21 133 461 flonum float 0. \; 22 154 463 flonum float 0. \; 27 130 551 flonum float 240. \; 28 151 553; #X append 4 2 flonum float 85. \;; #X append 5 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 87 10. \; 9 19 264 flonum float 160.910019 \; 12 121 62 gain~ list 0 10. \; 13 52 87 flonum float 0.3 \; 15 344 318; #X append 5 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 55.559998 \; 21 133 461 flonum float 0. \; 22 154 463 flonum float 0. \; 27 130 551 flonum float 125. \; 28 151 553; #X append 5 2 flonum float 114. \; 31 225 119 gain~ list 0 10. \; 33 225 143 gain~ list 130 10. \; 34 180 225 flonum float 0.480001 \; 36 159 201 flonum float 425. \;; #X append 6 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 53 10. \; 9 19 264 flonum float 160.910019 \; 12 121 62 gain~ list 88 10. \; 13 52 87 flonum float 0.3 \; 15 344 318; #X append 6 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float -33. \; 21 133 461 flonum float 0. \; 22 154 463 flonum float 0. \; 27 130 551 flonum float 45. \; 28 151 553; #X append 6 2 flonum float 112. \; 31 225 119 gain~ list 93 10. \; 33 225 143 gain~ list 130 10. \; 34 180 225 flonum float 0.54 \; 36 159 201 flonum float 113. \;; #X append 7 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 85 10. \; 9 19 264 flonum float 72. \; 12 121 62 gain~ list 80 10. \; 13 52 87 flonum float 0.309999 \; 15 344 318; #X append 7 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 65. \; 21 133 461 flonum float 253. \; 22 154 463 flonum float 0. \; 27 130 551 flonum float 16. \; 28 151 553; #X append 7 2 flonum float 324. \;; #X append 8 2 3 247 62 toggle int 1 \; 4 121 80 gain~ list 85 10. \; 9 19 264 flonum float 43. \; 12 121 62 gain~ list 80 10. \; 13 52 87 flonum float 0.439999 \; 15 344 318; #X append 8 2 number int 84 \; 16 329 318 number int 16 \; 18 43 471 flonum float 64. \; 21 133 461 flonum float 0. \; 22 154 463 flonum float 0. \; 27 130 551 flonum float 240. \; 28 151 553; #X append 8 2 flonum float 85. \;; #P preset 187 47 47 27; #P flonum 463 154 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 461 133 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 431 160 27 196617 +~; #P newex 431 138 27 196617 *~; #P flonum 471 43 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 431 113 50 196617 cycle~ 0.; #P number 318 329 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P number 318 344 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P user scope~ 298 398 563 539 16 3 84 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0; #P flonum 87 52 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P user gain~ 62 121 18 57 158 0 1.071519 7.94321 10.; #P newex 62 76 35 196617 >~ 0.5; #P newex 80 98 50 196617 cycle~ 0.; #P flonum 264 19 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 278 101 38 196617 *~ -1.; #P newex 278 76 29 196617 sah~; #P newex 264 134 65 196617 pong~ 1 0. 1.; #P newex 264 43 62 196617 phasor~ 0.3; #P user gain~ 80 121 18 57 158 0 1.071519 7.94321 10.; #P toggle 62 247 32 0; #P newex 119 378 45 196617 dac~; #P comment 355 330 100 196617 buffers per pixel; #P comment 533 180 100 196617 these want to be modulated with sub-audio sweeps...; #P connect 16 0 30 0; #P fasten 11 0 30 0 67 103 28 103; #P fasten 6 0 11 0 269 155 157 155 157 71 67 71; #P connect 11 0 12 0; #P connect 10 0 4 0; #P connect 13 0 11 1; #P fasten 4 0 31 0 85 212 124 212; #P fasten 12 0 31 0 67 212 124 212; #P connect 33 0 56 0; #P connect 31 0 56 0; #P connect 56 0 2 0; #P fasten 3 0 2 0 67 376 124 376; #P fasten 6 0 10 1 269 155 144 155 144 85 125 85; #P connect 12 0 32 0; #P connect 4 0 32 0; #P connect 32 0 33 0; #P connect 56 0 2 1; #P connect 20 0 35 0; #P connect 35 0 32 1; #P connect 36 0 35 1; #P connect 34 0 32 2; #P fasten 20 0 5 0 436 192 381 192 381 38 269 38; #P fasten 26 0 5 0 526 200 373 200 373 38 269 38; #P connect 9 0 5 0; #P connect 8 0 6 0; #P connect 5 0 6 0; #P connect 5 0 7 0; #P connect 7 0 8 0; #P connect 15 0 30 1; #P fasten 20 0 7 1 436 255 366 255 366 67 302 67; #P connect 16 0 14 0; #P fasten 6 0 14 0 269 155 303 155; #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 29 0; #P connect 29 0 17 1; #P connect 29 0 24 0; #P connect 24 0 25 0; #P connect 25 0 26 0; #P connect 27 0 25 1; #P connect 28 0 26 1; #P connect 15 0 14 1; #P pop;