If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Need a Ruby float array solution
3 posts
• Page 1 of 1
Need a Ruby float array solution
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?
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?
-
kortezzzz - Posts: 763
- Joined: Tue Mar 19, 2013 4:21 pm
Re: Need a Ruby float array solution
I can only answer the Ruby part. There's a method for arrays, called fill. It takes an object as parameter.
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:
This will activate whenever you change the float array at input or the float you wish the array to fill with.
- 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.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Need a Ruby float array solution
Thanks tulamide, works perfectly and now, each aspect of the multisample module can be controlled manually
-
kortezzzz - Posts: 763
- Joined: Tue Mar 19, 2013 4:21 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 54 guests