Support

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

For general discussion related FlowStone

Another "Ruby if then" question

Postby kortezzzz » Sat Aug 23, 2014 1:42 pm

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?
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Another "Ruby if then" question

Postby TheOm » Sat Aug 23, 2014 2:38 pm

Maybe use a case statement with ranges like this:
Attachments
midi velocity.fsm
(380 Bytes) Downloaded 703 times
TheOm
 
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: Another "Ruby if then" question

Postby kortezzzz » Sat Aug 23, 2014 8:00 pm

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 :)
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Another "Ruby if then" question

Postby TheOm » Sat Aug 23, 2014 9:03 pm

It works for floats and ints.
And of course you can also have a default value with an else branch.
Attachments
case.fsm
(341 Bytes) Downloaded 716 times
TheOm
 
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: Another "Ruby if then" question

Postby kortezzzz » Sun Aug 24, 2014 5:42 am

Works perfectly :D

Thanks a lot, man. That's very useful tool. recommend everybody to put in their toolbox. One day you will need it, no doubt.

8-)
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Another "Ruby if then" question

Postby Perfect Human Interface » Sun Aug 24, 2014 9:56 am

Wow, so simple and yet so useful! Thanks TheOm! Ruby really breathed new life into this thing didn't she? :D
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm


Return to General

Who is online

Users browsing this forum: No registered users and 93 guests