First time here? Check out the FAQ!
x

How do I trigger multiple multisampleclouds independently with modulo arithmetic?

+1 vote
657 views

I'm trying to index 3 different folders of samples with 3 multisampleclouds and gate them individually with !PenDown. On the first !PenDown I only want to work with the first multisamplecloud, on the second !PenDown I only want to work with the second multisamplecloud and so on.

I understand the index parameter field of the multisampleclouds is what I need to work on but I haven't been able to get the expression quite right. How do I trigger only one mulitsamplecloud at a time using modulo arithmetic and !PenDown?

Thanks for any thoughts or suggestions!

http://kyma.symbolicsound.com/qa/?qa=blob&qa_blobid=3263287093531238935

asked May 29, 2017 in Capytalk & Smalltalk by will-klingenmeier (Adept) (1,270 points)
edited Jun 9, 2017 by will-klingenmeier

1 Answer

+2 votes
 
Best answer

How about

SampleCloud1: (!PenDown nextIndexMod: 3) eq: 0

SampleCloud2: (!PenDown nextIndexMod: 3) eq: 1

SampleCloud3: (!PenDown nextIndexMod: 3) eq: 2

The good thing about nextIndexMod: is that it starts at -1 (unlike countTriggersMod:), so the first SampleCloud is only triggered at the first !PenDown.

BTW You can also use a Replicator and:

(!PenDown nextIndexMod: ?NumberVoices) eq: (?VoiceNumber - 1)

 

Best,

Gustav

answered May 29, 2017 by kymaguy (Virtuoso) (10,580 points)
selected May 30, 2017 by will-klingenmeier
Thanks Gustav! I wasn't familiar with that expression. One puzzled solved with your help, now it's on to the next one!
Relatedly, using a replicator, how would you change each multi-sample cloud to use a different folder?
you would need to gather your samples in an array, then choose which one using ?VoiceNumber:
{((?VoiceNumber - 1) of: #('someSample.wav' 'someOtherSample.wav')) sampleFileNamesInSameFolder}
So I tried another way of going about this and I've run into an issue. I put 47 sample files all in the same multisamplecloud and created an array in the index parameter field that looks like this: (!PenDown nextIndexMod: 3) of: #({3 s random abs * 15 of: #(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)} {3 s random abs * 22 of: #(15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36)} {3 s random abs * 10 of: #(37 38 39 40 41 42 43 44 45 46)}). The first two !PenDown I get what I expect but on the third !PenDown I only get one sample that's not even part of the third arithmetic expression. Any thoughts as to why this would be happening?
hmm looks right..
try this simplified version:
(!PenDown nextIndexMod: 3) of:
#(0 15 37) +
(3 s random abs * (
(!PenDown nextIndexMod: 3) of: #(14 21 9)
))
Since the Index of the MultiSampleCloud is sampled-and-held when it is gated, you can use the !KeyDown to trigger the next random number (rather than generating them once every 3 seconds).  For example:

| count base range |
count := !PenDown nextIndexMod: 3.
base := count of: #(0 15 37).
range := count of: #(15 22 10).
(!PenDown nextRandom abs * range + base) truncated
@kymaguy, I get an error with this code. I understand the first half of the expression but what does the second half mean? Specifically the array of: #(14 21 9)

@ssc, the same result still persists on the third !PenDown. How would I keep my randomness into the array while the pen is down, like in my original expression, while having the 3rd !PenDown behave just like the first two?
Hello Will,
From your description,
"The first two !PenDown I get what I expect but on the third !PenDown I only get one sample that's not even part of the third arithmetic expression."
it sounds like you may have fewer than 47 files listed.  (If you generate an Index outside the range, it will stick on the last file listed, which may be what is happening here).
Have you listed each file individually or are you using a Smalltalk expression to retrieve all the filenames from a folder?  If you're using a Smalltalk expression, select it and use Ctrl+Y to evaluate it so you can check the list of files and count how many are there. It's possible that you are pointing to a file of the same name in a different folder than you expected.
Thanks. I was thinking that it might be something like that and just put it to the test. I'm using this Smalltalk expression to retrieve the filenames:

{'nameofsample1.wav' sampleFileNamesInSameFolder}
{'nameofsample2.wav' sampleFileNamesInSameFolder}
{'nameofsample3.wav' sampleFileNamesInSameFolder}

The evaluation revealed that all 47 files are there.

As a test, I individually listed each filename and that gave me the desired result.

Is there something wrong with my Smalltalk expression or a different one I can try?
Will, could you please upload your Sound?  We need to see more of the structure in order to understand what you are trying to do. Thanks!
Sure. I did a file archive but it's much larger than the 16mb limit, so I just uploaded the sound itself.
For now, you can work around this by concatenating the collections as:
{{'nameofsample1.wav' sampleFileNamesInSameFolder},
{'nameofsample2.wav' sampleFileNamesInSameFolder},
{'nameofsample3.wav' sampleFileNamesInSameFolder}}
This is fixed now, so in the next K7 update you won't have to add the commas for concatenation.
...