First time here? Check out the FAQ!

How can I use suffix: in a script so it's possible to encapsulate?

0 votes

Hi there,


I've developed a Sound I want to encapsulate:

One branch is generating Events using triggeredSTGCs, I've replicated them using the script approach - working fine.

The other branch is using those events and collects them in a script to distribute them into an array for the syntheticSpectrumFromArray. I'm also doing some calculations on the array in the script. Because I can't use the suffix message without using curly braces (if I would, I couldn't use variables in the script, because curly braces evaluate first) I'm using this approach to gather the hotValues: ('EventName'&i) asHotValue

All this works fine until the point I want to encapsulate the whole thing. Then Kyma will tell me that I can't use hotValues for encapsulation. I've replaced all of them with variables of course but there are still those that get collected in the script.

What can I do about that?




EDIT: Here's an example. I want to be able to encapsulate it while keeping the script. 

asked Mar 17, 2016 in Using Kyma by kymaguy (Virtuoso) (10,580 points)
edited Mar 18, 2016 by kymaguy
I just realize I maybe could collect them using curly braces in the script and do the calculations on the resulting array. Maybe worth a try but off Kyma now..
Gustav, could you please post an example?  Thanks!
ok, I'll prepare one tomorrow, thanks!
I've edited the question and added an example - thanks!
I have also run into this problem in the past....

1 Answer

0 votes

To create a SyntheticSpectrumFromArray with a variable number of partials, you can set Amplitudes to:

{!Amp copies: 1024}

and NbrPartials to the desired number of partials.

This is simple enough that creating a class would not make it any simpler for people to set and change the number of partials. Only one parameter field has to be changed in order to change the number of partials.

By using copies:, you will get numbered faders starting with !Amp000. If you prefer to start from 1, you could use:

{1 to: 1024 collect: [ :i | !Amp suffix4: i]}

Don't worry, you won't create any extra faders because SyntheticSpectrumFromArray will create only NbrPartials anplitudes and frequencies.

answered Mar 18, 2016 by ssc (Savant) (121,430 points)
Well, my example is just showing the essential problem.. The Sound I want to encapsulate is a bit more complex of course..
Maybe I'll just split the generator / reader into two classes, might be more interesting anyway. Still I'm curious to know how it would work :)