Hit a Drum Pad to Cycle Through 4 Texture Maps

Using this technique, you hit the drum pad once, you get texture map 1, you hit it again and you get texture map 2. When the texture map is 4 and you hit the pad, you get texture 1 again. And so on.

The first CHOP, keyboard3, simply converts any keys of your ASCII keyboard into CHOP channels. A channel is 1 when the key is pressed, and 0 when it is not. At the IDC, this was replaced by a Midi In CHOP, which gave channels that were 1 while the drum pad was being hit, and 0 othewise. The lower channel on the graph represents the keyboard being pressed.

The count3 CHOP counts the number of times its input goes from 0 to 1, so it acts as a hit counter. The middle channel on the graph is the output of the count1 CHOP and steps up evey hit.

The limit1 CHOP simply takes numbers and makes them cycle between 1 and 4 because the background images are numbered 1 to 4. The is the upper channel of the above graph.

The to_material CHOP changes the name of the channel so it connects to the image number of a material containing a texture image.

Below left is a network from the COP (Composite Operators) Editor, where we prepare images. Here we take four images and seqeuence them as a 4-frame sequence, frames 1 to 4.

The material's texture1 (below right) selects the COP sequence and uses the frame number from the CHOP. This technique gives an enormous amount of flexibility in connecting realtime input devices to texture maps.

Cycling Through 4 Text Strings When you Hit a Drum Pad

In a similar way, you can use each drum pad hit to cycle between four lines of text that are displayed over the background.

Again, count1 counts the number of keyboard hits and limit2 cycles between 0 and 3.

to_text changes the channel names so they connect to the parameter in a Switch SOP (Surface Operation) that chooses which line of text to use.

A variation on this theme chooses the lines of text randomly so they are not in a predictable sequence. random_noise is a channel containing 300 random numbers between 0 and 1.

scale_0to3 scales the numbers so they are between 0 and 3, and limit_integer makes them integers.

We then use the count2 CHOP in the lookup1 CHOP to step through these 300 random numbers.