How to send a random value to an input at a specified rate.

fhill2's picture

Hello. I'm wondering if it's possible in Quartz Composer to send out a random value at a specified rate/a certain moment in time?

For example, an input gets sent a random value 1 time every 5 seconds.

I've been looking around the internet to see how to be able to do this but i haven't ben successful. Any help would be very appreciated.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

jean_pierre's picture
Re: How to send a random value to an input at a specified rate.

hmm, you could try using an LFO to handle the periodic needs and a sample & hold patch to only pull a random value triggered.

Random -> Sample & Hold (Value)

LFO > Pulse > Sample & Hold (Sampling)

fhill2's picture
Re: How to send a random value to an input at a specified rate.

Thanks a lot. That's great! When the pulse patch gives a signal to the 'Sampling' input according to the Patch Time of the interpolation it is unreliable for some reason. Do you know any ideas as to why this is? Or another way to achieve this the same as what's going on there.

Also, don't suppose you could lend some advice on how to make the Stop Watch patch count backwards please? E.g From 0 and then into minus figures.

monobrau's picture
Re: How to send a random value to an input at a specified rate.

add a math path and subtract from 0.

PreviewAttachmentSize
stopwatch backwards.qtz2.93 KB

fhill2's picture
Re: How to send a random value to an input at a specified rate.

Ok i see how that works. Thanks for helping. I was trying all kinds of things. Silly how that's so simple!

I'm still getting confused on how to toggle a boolean value on and off over a specified rate though. Could you clear things up for me please?

I have a patch and want to change one of the boolean inputs on it to toggle on/off and then wait a certain amount of time before repeating the same procedure.

I have tried jean's method and it isn't working for me for some reason. It sometimes doesn't update the boolean that i'm trying to toggle.

jean_pierre's picture
Re: How to send a random value to an input at a specified rate.

sorry, i may have misunderstood what you were trying to do, i thought you were trying to periodically generate a random number (see image attachment below).

to toggle a boolean periodically, couldn't you just use a square wave LFO directly which toggle's its own value between 0 and 1 (false and true)?

PreviewAttachmentSize
periodic_random_number.png
periodic_random_number.png104.91 KB

fhill2's picture
Re: How to send a random value to an input at a specified rate.

Oh yes, indeed.

That's the exact setup i had except i was using a sine wave, which is why it wasn't working correctly.

Thankyou for the advice.

jersmi's picture
Re: How to send a random value to an input at a specified rate.

Is the Signal patch still working on Lion? So far it's been a private patch, which has to be activated in the "special" Preferences menu (hold option when opening prefs). That would be a good choice to sample the random value every x secs.