In this third tutorial about i-score, we will start exploring the interactive possibilities available to the score author.
There are two main ways to have temporal interactivity :
- Interactive triggering
A condition means that a part of the score will only happen if some condition is true.
For instance, such a condition could be :
an:/osc/address == 100
Triggers are a more complex version of conditions.
They are a way of saying : « WHEN something happens, THEN do something ».
The format of the expressions is the same.
Creation of a condition
First, create two Time Constraints following each other, like we saw before :
Now, select the middle blue dot (a State).
The inspector (the right panel) should show this view :
We can see different hierarchical parts :
– MyEvent (name will be different, they are randomly generated)
An Event is the container for Conditions and States.
Now, unroll the Condition view :
By default, the condition is true.
This means that there is no condition, execution will just go on.
One can choose what kind of condition (<=, !=, >, etc.) he wants by clicking on the selector.
The fields are as follows :
- (Optional) First one is to select a boolean operator when there are multiple expressions : « a:/b == 1 and c:/d == 2 ».
- Second one is to put an OSC address
- Third one is to put a comparator or action
- Fourth one is to put a value or another address to compare with
For instance, given this tree :
One can input this condition :
Upon pressing validation (by clicking outside or pressing Enter / Return), the score becomes as follows :
If the value of OSCdevice:/my_node is unchanged, at 0, upon pressing play, the second constraint is not executed :
The state also won’t run as shown by its red color : it only happens if the condition is true.
Else, if the value is changed to something >= 12, everything will play.
The condition is checked exactly when execution reaches its point.
An interesting capacity of i-score is conditional branching.
It is a pattern in which you can write : « IF A happens THEN do X, ELSE IF B happens THEN do Y, ELSE IF C happen THEN do nothing… »
The Events allow for branching.
Click on the middle State, go into creation mode, and drag your mouse a bit : a new constraint will be created :
As you can guess, the condition will apply on both following time constraints, which will either both happen in parallel, or both not happen at all.
It is possible to do branching even without condition : it will just run the parts of the score in parallel, like tracks in an audio sequencer.
To allow conditional branching, we have to split the event.
First click on the Event (the white bar).
The Inspector now shows two State lines.
The # symbol on the right of these lines opens a small menu.
Choose « Put in new event ».
As you can see, there is a thin dark line : this line is called a TimeNode, and is what allows synchronization.
Now, what happens is that the condition (materialized by the yellow C) only matters for the topmost constraint. The bottom one will execute regardless during execution.
Then, the same procedure than before can be applied in order to have multiple different synchronized conditions.