The Script gives you a file dialog and asks you to select one sample out of the folder. It computes nbrFiles using:
filesInSameFolder := fileName fileNamesOfSameTypeInSameFolder.
In the Sound itself, there's a SoundToGlobalController? that generates a random index named !RandIndex that can be shared by all modules in the Sound.
((1 triggerTimeToNext: !DurOfNext s) nextRandom abs * ?nbrFiles) truncated + 1
Where does !DurOfNext come from? It is generated by the other SoundToGlobalController? using the expression:
!RandIndex of: ?durations
Where does the variable ?durations come from? It is an Array computed and passed in from the Script using the Smalltalk expression:
(filesInSameFolder collect: [:sf | sf sampleFileDuration removeUnits]).
Multisample is the only part of this Sound actually generating an audio signal. It is triggered by:
1 triggerTimeToNext: !DurOfNext s
and selects which file to play using the generated !RandIndex
“In Smalltalk, everything happens somewhere else.” – Adele Goldberg
-- CarlaScaletti - 09 Jul 2009