Here is an example of how to set up the SampleCloud to pick grains from the recorded part of the looper's MemoryWriter recording: http://kyma.symbolicsound.com/qa/?qa=blob&qa_blobid=17118928681014959565
Since the SampleCloud's grain duration can be random and the grain playback frequency can also be random, it is important to make sure that the grains start early enough in the recording so that the grain playback does not fall in the unrecorded part of the recording.
The SampleCloud picks the starts of grains centered at the value of the TimeIndex parameter with a spread given by the TimeIndexJitter parameter. This means that the time index should be set to be the center of the range of start times and the spread should be half the range of the start times.
The steps involved in making these calculations can be found in the TimeIndex and TimeIndexJitter parameters of the SampleCloud in the example looper. (We have copied the TimeIndex parameter value below.)
| longestGrainDurationInSeconds latestEndIn01Units timeIndex01 |
"Duration of longest grain, taking into account the length of the maximum grain playing at the highest frequency:"
longestGrainDurationInSeconds := ((1 + !GrainDurJitter) * !GrainDur s) * ((1 + !FreqJitter) * !FreqScale).
"!LoopEnd (from the recording Sound) measures how much of the 3 minute recording is actually used, so the end of the latest start time of the grain must be earlier by the duration of the longest grain (converted to a fraction of the recording duration):"
latestEndIn01Units := !LoopEnd - (longestGrainDurationInSeconds / 180 s).
"The SampleCloud picks the start time of each grain using TimeIndex and TimeIndexJitter. The SampleCloud starts the grains between:
TimeIndex - TimeIndexJitter
and:
TimeIndex + TimeIndexJitter
that is, it picks start times in a range centered at TimeIndex and spread by the value of TimeIndexJitter.
To pick grains from between 0 and !LoopEnd, we use:"
timeIndex01 := (0 + latestEndIn01Units) / 2.
timeIndexJitter01 := (latestEndIn01Units - 0) / 2.
"Now convert from Sample's 0 to 1 range to SampleCloud's -1 to 1 range:"
timeIndex01 * 2 - 1