MusiKraken
MusiKraken
Experimental MIDI Controller Construction Kit

Distance

The Distance module has two pairs of x- and y-ports as input. The module then computes the difference between these two values (sending these through the distanceX or distanceY ports) and computes the distance of the two items.

This makes it possible to for example combine two items tracked by the camera.

You can also use this to compute the difference between the values of two ports. Simply connect to x1 and x2 only and use the differenceX output.

If you do not connect anything to one of the x- and y-port pairs, it will use the default x and default y values from the settings for that pair instead. This way you can compute the distance to fixed values. This can be used if you want for example to use the distance to the lower right edge of the screen.

Examples:

Connect the x- and y-ports of a color tracking item to the x1 and y1 ports, and connect the x- and y-ports of your right hand to the x2 and y2 ports. Now this module will output the distance between your right hand and the color-tracked object. You can for example use this distance to generate a note that increases in pitch the larger the distance to the color tracked item is. One example would be to create a theremin by using the values from the yDistance port to generate the note depending on how far above the item your hand is. And then use the xDistance (or the absoluteXDistance) value to control modulation.

Ports:

x1, y1, x2, y2:

Connect the output values from other modules to these.

Range: -1.0 to 1.0

distance:

The distance between the positions defined by the x1-y1 and x2-y2 coordinates. The maximum distance is 1.0.

Range: 0.0 to 1.0

distanceX:

The difference between the values send to the x1 and x2 ports.

Range: -1.0 to 1.0

distanceY:

The difference between the values send to the y1 and y2 ports.

Range: -1.0 to 1.0

absoluteX:

The absolute difference between the values send to the x1 and x2 ports. Absolute means that negative values are made positive.

Range: 0.0 to 1.0

absoluteY:

The absolute difference between the values send to the y1 and y2 ports. Absolute means that negative values are made positive.

Range: 0.0 to 1.0

Settings:

Default X value and default y value: These values are used if an input port is not connected to anything. This can be useful to compute the difference to a fixed value instead of anything dynamic.