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
Another "Ruby if then" question
6 posts
• Page 1 of 1
Another "Ruby if then" question
Hi
In my last post, Iv requested a kinda "IF THEN" module, based on ruby hashes.
This time, wondering if there is any chance to code a ruby "if then" module that
based on "<", ">" as well.
Well, the idea is a ruby modole with one input (midi), one output (float). the ruby module
should extract velocity info from the midi input, compare it with given values and send specific values to the output
when the velocity value is greater then x or smaller then x.
Any chance to make it with ruby?
In my last post, Iv requested a kinda "IF THEN" module, based on ruby hashes.
This time, wondering if there is any chance to code a ruby "if then" module that
based on "<", ">" as well.
Well, the idea is a ruby modole with one input (midi), one output (float). the ruby module
should extract velocity info from the midi input, compare it with given values and send specific values to the output
when the velocity value is greater then x or smaller then x.
Any chance to make it with ruby?
-
kortezzzz - Posts: 763
- Joined: Tue Mar 19, 2013 4:21 pm
Re: Another "Ruby if then" question
Maybe use a case statement with ranges like this:
- Attachments
-
- midi velocity.fsm
- (380 Bytes) Downloaded 702 times
- TheOm
- Posts: 103
- Joined: Tue Jan 28, 2014 7:35 pm
- Location: Germany
Re: Another "Ruby if then" question
Thanks TheOm,
Works great! In principle, can the input type get replaced by any kind of input? for instance, can we use integer input (or any other) instead of midi input by switching the first line of the code? i believe this kind of module can be very useful to any of us.
Thanks
Works great! In principle, can the input type get replaced by any kind of input? for instance, can we use integer input (or any other) instead of midi input by switching the first line of the code? i believe this kind of module can be very useful to any of us.
Thanks
-
kortezzzz - Posts: 763
- Joined: Tue Mar 19, 2013 4:21 pm
Re: Another "Ruby if then" question
It works for floats and ints.
And of course you can also have a default value with an else branch.
And of course you can also have a default value with an else branch.
- Attachments
-
- case.fsm
- (341 Bytes) Downloaded 715 times
- TheOm
- Posts: 103
- Joined: Tue Jan 28, 2014 7:35 pm
- Location: Germany
Re: Another "Ruby if then" question
Works perfectly
Thanks a lot, man. That's very useful tool. recommend everybody to put in their toolbox. One day you will need it, no doubt.
Thanks a lot, man. That's very useful tool. recommend everybody to put in their toolbox. One day you will need it, no doubt.
-
kortezzzz - Posts: 763
- Joined: Tue Mar 19, 2013 4:21 pm
Re: Another "Ruby if then" question
Wow, so simple and yet so useful! Thanks TheOm! Ruby really breathed new life into this thing didn't she?
- Perfect Human Interface
- Posts: 643
- Joined: Sun Mar 10, 2013 7:32 pm
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 38 guests