Darren has now sent me an updated version of the Unity project which has the OSC receiver to receive the tempo and animation instruction from the max patch. He has told me which strings to put to link with the Unity coding that he has done and now I have been working out how to control the dancer from certain musical gestures.
The first thing I wanted to work was how to select which animation the dancer does. There are 4 overall – 1 Idle animation and 3 dancing. I started off by using the beat track and counter to determine how long each animation would last. I have gone for 32 beats as this seems to be the best amount of time to complete the animation and have a smooth transition. I then used a random counter from the carry count and the select object attached to 3 bangs to randomly select which animation to do. However this proved unsuccessful as it would stay on the same animation for 3 or 4 rotations sometimes. Instead I have used the carry count of the first counter and place that into another counter object counting from 0 to 3, back to 0 and repeat. As one of the animations fits better than the others, and is what I consider to be the main animation, I have used two of the outputs to trigger it, making it more frequent than the others.
What you can see here is the counter on the left under the beat track running into another counter as described. You can also see the sprintf object being used to send the strings from the tempo which is /1/### (### being bpm). and then the other messages sending the name of the animation to choose. You can also see in the picture the idle message which I will explain now.
To organise the Idle animation I decided that I wanted it to be selected after no music was being played for 3 seconds, causing the dancer to stop dancing. I have used the amplitude output form the fiddle object as it had the best accuracy for numerical output, I have then used a less than and greater than function to determine when the music is on or off. However, at first this caused a problem as even when the music was off it was still sending a signal, which was glitching any bang that I placed in the sequence meaning the Idle message would constantly be being sent. The most accurate way around this that I found was to use two of the same more than less than circuits – one to control a ggate (to stop the constant signal) and another to control the metro counter (3 seconds and then send bang to Idle).