mercredi 9 janvier 2019

max/msp: random choice from coll depenfing on its length

A varying number of lists are stored in a coll object. Then a series of bangs is provided to a random integer generator. With each bang the generated integer will decide which list will go out of the coll. Obviously, this number must be between 1 and the varying length of the coll. This means that the RND generator has to take into account any changed length of the coll before generating the integer. So, I guess we have a circuit like the following:

  1. A loadbang-ed messagelength’ must enter the coll object to make it output its length.
  2. This length number must get into the right inlet of a ‘between’ (RND gen.) object to set its maximum.
  3. A bang in the left input of the ‘between’ object will generate a random integer.
  4. The integer will go back into the coll and make it output the corresponding stored list.
  5. The output list will be sent to an iteration mechanism that will read and output its atoms one by one.
  6. When the last atom of the current list is output, a new bang will be sent to the ‘between’ object so that a new list will be picked and the process will be repeated (stages #3 – 6).

My problem is that the length of the coll must be output only once (in the beginning of the session) and that it should only feed the ‘between’ object (it should never reach the iteration mechanism, since it is irrelevant).

Any ideas please?




Aucun commentaire:

Enregistrer un commentaire