Page 1 of 1

Need a Ruby float array solution

Posted: Sat Dec 12, 2015 9:29 pm
by kortezzzz
Hi,

I'm trying to find a simple ruby solution that would replace the whole array values to my own value. For instance, if the array is:

0.5
0.7
0.6
0.4

I would like to replace the whole bunch of values with 0.1 to end up with:

0.1
0.1
0.1
0.1

Why is it needed? because while FS's multisample module extracts the sfz file's values correctly, it yet doesn't allow determining them with knobs, so I can't prevent fundamentals values like "release=29" to be streamed... moreover, for instance, if I would like to customize the each of the AHDSR array values with my one desired values (with knobs), I have no way to control the arrays correctly. Any suggestions?

Re: Need a Ruby float array solution

Posted: Sat Dec 12, 2015 10:14 pm
by tulamide
I can only answer the Ruby part. There's a method for arrays, called fill. It takes an object as parameter.

Code: Select all

ary = 0.5, 0.7, 0.6, 0.4
ary.fill(0.1)
# Now the array is [0.1, 0.1, 0.1, 0.1]


If you create a float array input and a float input, and name them "array_in" and "float_in", plus a float array output, then this code should work:

Code: Select all

def event i, v
    a = @array_in
    a.fill(@float_in)
    output a
end


This will activate whenever you change the float array at input or the float you wish the array to fill with.

Re: Need a Ruby float array solution

Posted: Sun Dec 13, 2015 10:04 am
by kortezzzz
Thanks tulamide, works perfectly and now, each aspect of the multisample module can be controlled manually :D