There are many objects available for delaying events (i.e., for scheduling events to happen at a specific future moment). For timing and scheduling events, the most common object is the metro object (send bang periodically at a specified time interval), which can be used to trigger events, start/stop entire processes, or trigger a counter to step through a table or a coll or any sort of sequence of things.
This example demonstrates creating a RAM buffer to hold a 10-second stereo recording, recording live audio into it (with input volume adjustment), and then playing randomly chosen backward clips of that sound, with a trapezoidal window to taper the beginning and ending of each clip to avoid clicks.
The timepoint object sends out a bang when the transport reaches a specified time position. This can be useful for causing something to happen—or for starting an entire process—at a particular instant during the transport's progress. A timepoint might, for example, even trigger a new time position value to be sent to the transport object itself, thus causing the transport to leap to a different time.
This patch shows a way to capture and play back excerpts of live video. It uses jit.matrixset as a circular buffer to hold selected frames of live video from jit.grab, and it uses the decide and random objects to make arbitrary decisions regarding when to record and which excerpt to play back.
This patch uses a random number generator to choose a mix of 12 sine tones, play them, and display them as white pixels in a black and white matrix. The 12 sine tones are played with a single object called ioscbank~, which is a bank of interpolating sinusoidal oscillators.
When you open a movie file in jit.movie with a read message, the exact amount of time that that operation will take is unknowable, but jit.movie will send a read message out of its right outlet when the file-opening operation has been completed. When you read in a file, you should generally wait for that message to come out before proceeding. In that message, the word read is followed by the name of the file, followed by a success indicator, 1 or 0.
When you read a sound file into a buffer~ with a read or replace message, the exact amount of time that that operation will take is unknowable, but the buffer~ will send a bang out of its right outlet when the file has been completely loaded into RAM. When you load a file, you should wait for that bang before proceeding.
To make a random decision between two things, you can use the decide object. To make a probabilistic decision between two things, with one thing being more likely than the other, you can use the random object to choose randomly from a larger set of numbers, then assign a majority of those choices to mean one thing (and the remaining minority to mean the other thing). An easy way to do this is with the < object.
This is a program for random editing of a video by periodically leaping to randomly-chosen times in the video and playing from there. The jit.qt.movie object here has its attributes initialized such that: a) it will adapt the dimensions of its matrix based on the dimensions of the movie that is read in, b) it will not automatically start, c) it will not loop, and d) it will only send out new frames of video without repeating a frame.
This patch demonstrates the two simplest objects for generating random numbers. Every time it receives a bang in its left inlet, the random object generates a random integer in the range from 0 to one less than its argument. (For example, if you tell it to generate one of 12 random numbers, it will choose a number from 0 through 11 inclusive.) Note that this includes the possibility that successive random choices may appear to generate what seem to be patterns, especially if it's choosing from among a small range of possibilities.