kyma•tweaky . Share . StructureBuildingScriptsDiscussion

Structure Building Scripts Discussion

This is an idea for building Sound structures according to rules and random number generators. One of them builds chains of processing elements; the other one can also "branch" by creating internal Mixers. It is based on the assumption that the first three inputs to the Script can function as 'sources' and that the next four can function as 'modifiers'. Each of the modifiers has a variable parameter called ?freq. Here's the annotated Script:

Declare variables
| son rando srcIndex modIndex freqRange |

Ask user to supply a seed for random number generator (or you could just use Random new and leave off the seed to get a new result each time you play it).
rando := Random newForKymaWithSeed: (self getValueFromUser: 'Enter an integer between 0 and 65536').

A block that computes an index for selecting a random 'source' from among inputs 1 to 3.
srcIndex := [:r | (r * 2 + 1) rounded].

Block to compute an index for a 'modifier' Sounds (4th through 7th inputs to the Script).
modIndex := [:r | (r * 3 + 4) rounded].

Block to compute a random frequency parameter value for the modifier Sounds.
freqRange := [:r | r * 500 + 30].

Use random index to select source Sound from the array of inputs.
son := inputs at: (srcIndex value: rando next).

For a random number of times, feed the source into a randomly chosen modifier Sound (and then feed that Sound into another modifier, etc.).
[rando next < 0.9] whileTrue: [ son := (inputs at: (modIndex value: rando next)) freq: (freqRange value: rando next) input: son].

Finally, add the constructed Sound to the Script and play it.
self addSound: son atTime: 0 s.

-- CarlaScaletti - 18 Oct 2003

----- Revision r1.2 - 21 Oct 2003 - 18:56 GMT - KurtHebel
Copyright © 1999-2014 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding kyma•tweaky? Send feedback.