Touch Designer example: mapping midi data to image data

By admin, 15 March, 2023

In this tutorial we will start from the example on Touch Designer example: receive midi data

From our "midiinmap1"  we will add a new operator in our network called Math Chop. With this math chop you can execute all kind of mathematical formulas on data. The default values of our knobs are between 0 and 1.  The math chop can for instance multiplying it with 100 in order to change a value between 0 and 100. A third screenshot shows how to change the range between -1 to 1. 

We are going to use the midi values to change the levels of a white rectangle. The ranges that we need for this parameter are very divers: the "invert"parameter needs a value from 0 to 1, the "gamma" parameter from 0 to 3 or the "contrast" parameter needs a value from 0 to 5. 

We will have to add new maths in our network correspoding to the number of ranges in values that we want to alter.

The screenshot above shows an addition to our network: a very basic white rectangle (scaled to 100% and the resolution set to 1280 on 720), an output that we can send the data from to a projector and a level top in between. Our midi data is split up in 5 different ranges, corresponding with the level parameters. 

The outputs of the different ranges are activated and the values are mapped with the corresponding parameter value by dragg and drop commands. Activate the output by clicking on the "+" in the right under part of the output to activate, click on the slider and drag it onto the "level" operator. Touch Designer will generate the python expression to map the value with the parameter and indicates the expression in the parameter window.

op('out0_to_1')['s1']

This expression links the value 's1' from the ouput of the operator named 'out0_to_1' with the value of the parameter. This expression controlls the invert of our rectangle.

 

Download the example:

The "Touch Designer example: mapping midi data to image data project" can be dowloaded here.

A short resume of the tutorial file: 

In this tutorial we will start from the example on Touch Designer example: receive midi data. The data from our midi controller has to be recalculated to the range of values we need for a specific parameter and the recalculated value needs to be linked to the corresponding parameter.