I am trying to generate an acoustic model of how cicadas or cheering audience sometimes synchonize themselves without following a leader.
I found a quite good visual model here:
http://ccl.northwestern.edu/netlogo/models/Fireflies
One can download the NetLogo java program and study the code... things look like they could be "ported" to Kyma language, but I stumbled into one problem: fireflies reset their fire-loop-phase whenever another firefly fires in a certain radius - so that they can see each other. NetLogo language provides a "primitive" named "in-radius" which provides each agent/firefly with knowledge about whether another agent is firing nearby.
So, the question is, if there is a way in Kyma to look over an orchestra and see for each instrument if there is another instrument nearby which just triggered. My main understanding problem is how I could "id-tag" an instrument created by a script in order to assign special parameter values to it, and to know about it´s status...
--
MichaelStrohmann - 19 Jul 2004
One approach would be to make Reset a function of the distances of this firefly to each of the others. Assume that you have 2 fireflies and you set the position of the first one using !R0 and !A0 (for radius and angle) and you set the position of the second one using !R1 and !A1. You could set the positions using faders or you could use a
SoundToGlobalController to generate the positions algorithmically. Let's say that you want firefly 0 to trigger his Reset whenever firefly 1 is within a distance of 0.5. To compute the distance, you could use:
((!R0 ** 2) + (!R1 ** 2) - (2 * !R0 * !R1 * (!A1 - !A0) cos)) sqrt
Then you could use a
lt:
(less-than) test to trigger when the distance was below a certain threshold.
In your algorithm, the firefly resets when another firefly is near it
and has just lit up, so you would also have to have another variable to indicate when a firefly is lit (for example !L0 and !L1). Perhaps you could generate !L0 in a
SoundToGlobalController with the distance test as its expression. Then use !L0 in the actual reset trigger field.
To generate lots of hot values using a Smalltalk loop, you can use the construct:
('R', i printString) asHotValue
where
i
is the index of the loop.
Another approach might be to implement this algorithm in a Tool. Tools can both read and write EventValues and you could conditionally trigger blocks of Smalltalk code based on those values.
BTW, we are approaching the height of firefly season here in Illinois and if you go out into the cornfields at night, they are sparkling. One strange thing I've observed is that they seem to like to light up when they are ascending (and turn off when they fly back down). Has anyone else noticed this? Or is it an optical illusion?
--
CarlaScaletti - 19 Jul 2004
WebForm |
Question: | How can I "id-tag" an instrument created in a Script? |
Keywords: | SoundToGlobalController, Script, distance measure, fireflies |