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

Help: Ruby 4 x Sample & Hold Value

For general discussion related FlowStone

Help: Ruby 4 x Sample & Hold Value

Postby Walter Sommerfeld » Thu Jan 29, 2015 10:12 pm

Well... this Value thing in ruby makes me crazy...

I need ur help guys:

What i need are 4 sampled values... sounds easy but:

i can't get it to work :o
maybe it should be done all in one ruby part?!

and maybe i'm missing here something :?

So just simply click the dice 4 times and try to recall the sampled values with the knob :(
Attachments
Walters dice 4 x Value Sample.fsm
(please ignore the simple dice part)
(264.29 KiB) Downloaded 783 times
User avatar
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Help: Ruby 4 x Sample & Hold Value

Postby Tronic » Thu Jan 29, 2015 11:32 pm

semplify all with this?
Code: Select all
watch 'number', number = [ [*1..6].sample, [*1..6].sample, [*1..6].sample, [*1..6].sample ]
number[@select] # the var @select is an ruby int input named select
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Help: Ruby 4 x Sample & Hold Value

Postby Walter Sommerfeld » Thu Jan 29, 2015 11:46 pm

Hi Tronic,

thanks but:
i only need a value selector that is working (see the not changing output label when u rotate the knob)
...ignore the dice part
User avatar
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Help: Ruby 4 x Sample & Hold Value

Postby Tronic » Fri Jan 30, 2015 12:03 am

Yes the ruby connector not have the same concept of the green < - >, so you have retrigger it with the ruby.

However the my example is the simply version of your schematics, it act in the same manner, just use an knob to get the value of results.

Code: Select all
def event i
   if i=="dice" # get trig from dice button?
      output 0, a=[*1..6].sample
      output 1, b=[*1..6].sample
      output 2, c=[*1..6].sample      
      output 3, d=[*1..6].sample         
      @number = [a,b,c,d]           
   end
   output 4, @number[@select] #@select is knob input value
end
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Help: Ruby 4 x Sample & Hold Value

Postby Walter Sommerfeld » Fri Jan 30, 2015 1:28 am

I need 4 sampled values selectable from the same value source!
Not four selectable random numbers.

The dice is only a simple 'generator' to get 4 values for the selector!...

Please have a closer look - Thanks again
Walter
User avatar
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Help: Ruby 4 x Sample & Hold Value

Postby tulamide » Fri Jan 30, 2015 1:36 am

Walter Sommerfeld wrote:I need 4 sampled values selectable from the same value source!
Not four selectable random numbers.

The dice is only a simple 'generator' to get 4 values for the selector!...

Please have a closer look - Thanks again
Walter


Something like this?

EDIT: No, can't be what you're looking for, I just saw that Tronic already offered bqasically the same, meaning a selection is done by the knob from a pool of several values.
Attachments
selection.fsm
(4.46 KiB) Downloaded 765 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Help: Ruby 4 x Sample & Hold Value

Postby Walter Sommerfeld » Fri Jan 30, 2015 10:24 am

YUP tulamide,

but thanks anyway...

U guys put me on the right track...
but i guessed it ends up with a selector made inside a ruby mod by using variables to mimic the S&H...

My intention
a selection is done by the knob from a pool of several values
here is needed because i have a very complex Midi Controller project where i need to S&H 4 banks of values so i don't have to calculate them every time again and again!

After ur hints and sleep over it i think i got it (on paper)... ;-)

Will report later...
User avatar
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Help: Ruby 4 x Sample & Hold Value

Postby Walter Sommerfeld » Fri Jan 30, 2015 11:41 am

Here my working if/elsif version!

If some of u like to make a simpler version with in 'case' etc. - you're welcome...

keep on doing!
Walter
4 Values s&h in ruby by sunsynth.fsm
finally it is working (i hope)
(15.54 KiB) Downloaded 745 times
User avatar
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Help: Ruby 4 x Sample & Hold Value

Postby Tronic » Fri Jan 30, 2015 3:36 pm

this is my simplification
Code: Select all
def init
@SH = []
end

def event i, v
   if @on and (i=='go') and (@selection<=@max)   
      @SH[@selection] = @input_value      
   end
      
   output @selection, @SH[@selection]
            
   output 'done_v', nil
   output 'done', nil
end
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Help: Ruby 4 x Sample & Hold Value

Postby Walter Sommerfeld » Fri Jan 30, 2015 5:33 pm

works fine... but:

where my version triggers one time after hit go - yours produces 3!

cheers,
Walter
User avatar
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Next

Return to General

Who is online

Users browsing this forum: No registered users and 92 guests