## evenly dividing up a stream of floats

Sep 18 2009 | 4:24 pm
OK, I'm having a brain freeze today. I know I will slap my forehead on this one when someone gives me a clue!
I have a stream of floats going from 0.0 to 1.0 (which represents a quarter note duration). I would like to send a bang at specific, evenly divided points within that stream. For example, just at 1.0 (quarter note), or just at 0.5 and 1.0 (eighth notes), or just at 0.25, 0.5, 0.75 and 1.0 (sixteenth notes).
How do I cleanly do this? It seems like it should be a one or two object operation, but for the life of me I can't figure it out today!
Thanks, Dan

• Sep 18 2009 | 5:02 pm
Have a look at [%] although be careful as dealing with floating point numbers can cause problems, you might want to scale it up by multiplying by a power of ten, depending on the resolution you want.
lh
• Sep 18 2009 | 5:13 pm
Yup, that's it! My forehead is nice and sore right now!!
Thanks a million.
Dan
• Sep 18 2009 | 7:14 pm
OK, so I spoke too soon. What I'm really trying to do is to take ReWire timing info via hostsync~, and to be able to fire off bangs at eigth, sixteenth, etc.. intervals.
The patch below, although I think technically correct, yields extremely poor timing:
Any ideas?
Thanks, Dan
• Sep 18 2009 | 7:48 pm
Have you tried hooking that outlet of [hostsync~] straight into a [print] object? It might be that the timing resolution here is causing the problem. If it is skipping a lot of numbers then you will never hit exactly on your divisions and the bangs won't get triggered. If this is what is causing the issue then you might be able to use [line] to send out all the numbers in between the values at a rate determined by the tempo of the track to keep it smooth. It's just a thought but good luck!
lh
• Sep 18 2009 | 8:01 pm
You're right! Here's a sample of the output:
print: 0.021657 print: 0.044900 print: 0.068142 print: 0.091319 print: 0.114561 print: 0.137803 print: 0.160980 print: 0.184223 print: 0.207465 print: 0.230642 print: 0.253884 print: 0.277126 print: 0.300303 print: 0.323545 print: 0.346788 print: 0.369965 print: 0.393207 print: 0.416449 print: 0.439626 print: 0.462868 print: 0.486045 print: 0.509288 print: 0.532530 print: 0.555707 print: 0.578949 print: 0.602191 print: 0.625368 print: 0.648611 print: 0.671853
I'll think about the line approach you suggest, or perhaps I'll have to use the raw ticks or sample count output instead...
Thanks again, Dan
• Sep 18 2009 | 9:06 pm
I've never used hostsync~ before, but as far as I can tell, hostphasor~ would be much better for your purposes. It basically outputs the same thing, but as a signal which you can treat exactly like a phasor~. You will almost certainly get better timing this way. For example:
• Sep 19 2009 | 12:32 am
That's a good suggestion, thanks!
Dan