## Undulating Metro Using Sin?

Mar 30, 2008 at 1:40pm

# Undulating Metro Using Sin?

Hi I am attempting to create a metro that speeds up and slows down at a curved rate. I am trying to connect sin to metro to give me my values. So far this is what I have:

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 454 64 14 196617 0;
#P newex 232 202 55 196617 pipe 1000;
#P number 427 189 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 271 51 15 0;
#P newex 462 205 44 196617 * 1000;
#P newex 414 289 27 196617 +;
#N counter;
#X flags 0 0;
#P newobj 415 119 66 196617 counter;
#P newex 414 233 21 196617 sin;
#P button 276 155 15 0;
#P newex 282 94 37 196617 metro;
#P button 140 150 15 0;
#P newex 159 92 64 196617 metro 1000;
#P connect 11 0 5 3;
#P connect 10 0 5 0;
#P connect 1 0 10 0;
#P connect 9 0 4 0;
#P connect 5 0 4 0;
#P connect 5 0 9 0;
#P fasten 5 0 7 0 478 146 481 188;
#P connect 8 0 0 0;
#P connect 8 0 2 0;
#P connect 6 0 2 1;
#P connect 7 0 6 1;
#P connect 4 0 6 0;
#P connect 2 0 3 0;
#P connect 0 0 1 0;
#P window clipboard copycount 12;

The equation y=sin(x)+1000x gives me a slanted sin function which follows the same slope as y=1000x, where y is the number be of milliseconds that have passed, and x is the number of bangs set out by the metro. In this way, I could have one constant rhythm while the other slows down/speeds up, yet they would both sync up together at every beat.

Unfortunately, The metro whose value is supposed to be determined by the sin function isn’t sending out any bangs. Can anyone help me out?

Much thanks.

#36618
Mar 30, 2008 at 3:24pm

I tried out your patch and the metro controlled by sin is sending out bangs. Eventually they become far and few between because of the [* 1000]. Eventually you are sending metro numbers over 40,000, So it’s not going to bang that often. I made a patch that I think does what you want but keeps the numbers being to sent to metro between 20-2000. Although you could change them to whatever you want.

#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 120 328 100 196617 when number is less than 20 go back up;
#P window linecount 1;
#P newex 216 332 111 196617 if \$f1 < = 20 then 0.01;
#P flonum 216 249 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 216 160 50 196617 accum 0.;
#P flonum 216 188 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 179 133 33 196617 set 0;
#P newex 216 216 21 196617 sin;
#P newex 253 249 47 196617 * 1000.;
#P newex 216 275 47 196617 + 0.;
#P flonum 216 306 53 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 329 332 122 196617 if \$f1 >= 2000 then -0.01;
#P newex 236 136 27 196617 0.01;
#P newex 216 108 64 196617 metro 1000;
#P toggle 216 87 15 0;
#P number 270 87 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 4;
#P comment 465 321 100 196617 these keep the numbers being sent to metro contrained to 20-2000;
#P window linecount 2;
#P comment 344 307 100 196617 when number is over 2000 go back down;
#P window linecount 1;
#P newex 69 380 37 196617 metro;
#P button 69 422 15 0;
#P connect 6 0 15 0;
#P fasten 6 0 7 0 221 130 241 130;
#P fasten 5 0 1 0 221 106 74 106;
#P connect 5 0 6 0;
#P connect 4 0 6 1;
#P fasten 9 0 1 1 221 327 101 327;
#P connect 9 0 17 0;
#P fasten 9 0 8 0 221 327 334 327;
#P connect 1 0 0 0;
#P fasten 17 0 7 1 221 355 459 355 459 131 258 131;
#P connect 14 0 12 0;
#P fasten 14 0 11 0 221 214 258 214;
#P fasten 8 0 7 1 334 355 459 355 459 131 258 131;
#P connect 7 0 15 1;
#P connect 10 0 9 0;
#P connect 11 0 10 1;
#P connect 16 0 10 0;
#P connect 12 0 16 0;
#P connect 13 0 15 0;
#P connect 15 0 14 0;
#P window clipboard copycount 19;

#125776

You must be logged in to reply to this topic.