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

random selections

For general discussion related FlowStone

random selections

Postby tester » Mon Nov 04, 2013 11:04 pm

Speaking of the future. Array based slider concept brought by Nubeat7 introduced few questions for me. So here is one of them. Ruby based (I guess) random generator vs array.

Let say, that the first array, is the float array, and its size is fixed.

23.000
33.000
21.000
65.000
...

Let say, that there is second array, that refers to indexes of the first one, array containing int 0's and 1's.

0
1
0
1
...

Zero means, that at that index, in first array (float array) - value is untouched. 1 means - that at that index - value is being randomized. These 0's and 1's come from on/off buttons.

How to pick selective randomization that way, via ruby?

There could be third and fourth array :-) for min/max, but let say that min and max values are common for all.

Second part to that question would be, to pass these randomizations through "logarithmic spread" (the same amounts of hits per octave), to get more lower values, but my head is too small now to visualize that.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: random selections

Postby RJHollins » Mon Nov 04, 2013 11:12 pm

If I follow ...

Using RUBY to make choice distinctions ... would maybe involve the IF condition, or the CASE statement.

Here is one example I refer back to and help me recall this in Ruby.
Code: Select all
score = @in
# score = 70

result = case score
   when 0..40 then "Fail"
   when 41..60 then "Pass"
   when 61..70 then "Pass with Merit"
   when 71..100 then "Pass with Distinction"
   else "Invalid Score"
end

output result


the INTEGER INPUT I labeled 'score'. The string ouput I have sent to Output 0.

This is just a generic ... but can help illustrate ... and hope this is of help !
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: random selections

Postby tester » Tue Nov 05, 2013 12:01 am

Watching at the code contents, I'm not sure if it's the answer to the question.

Maybe I explain a little bit. Right now - I'm using set of single units (clones). They can be randomized all at once (whole array so to speak), or just selected clones only (equivalent would be: selected values on array, at indexes chosen via second array).

Some of these randomizations are refering to frequencies, and at these parts - a nonlinear function is used, to make the spread of hits "equal across the octaves". And - yes, it is (and should be) based on frequencies, not pitches.

Right now these are just free thoughts, I'm starting to see the greater picture..
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: random selections

Postby RJHollins » Tue Nov 05, 2013 12:53 am

Right now these are just free thoughts, I'm starting to see the greater picture..


that 's what the example pointed to ... even a 'random selection' will have to select. The simple code is only to illustrate a possiblity.
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: random selections

Postby TrojakEW » Tue Nov 05, 2013 1:18 pm

this is array you want to alter:
a = [23,33,21,65]

this is range you want to choose for randomization (example)
b = [11,22,33,44]

now lets say user or you want to randomize first index (0) out of four
a[0] = b.shuffle.first

result array with only first index randomized in selected range:
a

Don't know if is this what you want.
User avatar
TrojakEW
 
Posts: 111
Joined: Sat Dec 25, 2010 10:12 am
Location: Slovakia

Re: random selections

Postby tester » Tue Nov 05, 2013 3:26 pm

I think i meant something like this...

...with included editing option (forgot to add there).
Attachments
selective-rand-array.fsm
(640 Bytes) Downloaded 925 times
Last edited by tester on Tue Nov 05, 2013 3:29 pm, edited 1 time in total.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: random selections

Postby Nubeat7 » Tue Nov 05, 2013 3:27 pm

you mean something like this?
Code: Select all
0.upto @frequencies.length do |i|
   if @randomSelections[i]==1
     @frequencies[i] = rand(60..44100)
   end
end

output @frequencies


edit: ahh, saw your example.. so this should do the job
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: random selections

Postby tester » Tue Nov 05, 2013 3:35 pm

Where is the trigger? :-)
How to trigger selective randomization?
Attachments
selective-rand-array1.fsm
(544 Bytes) Downloaded 832 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: random selections

Postby Nubeat7 » Tue Nov 05, 2013 5:26 pm

use array ins and out, if you want a trigger, write it inside the event methode and add a trigger input..
Code: Select all
if'triggerIn'
..methode
end
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: random selections

Postby TrojakEW » Tue Nov 05, 2013 5:46 pm

Since I don't know what do you want for output and what for input I made two versions.
Attachments
selective-rand-array1-2.fsm
or like this?
(488 Bytes) Downloaded 887 times
selective-rand-array1-1.fsm
likethis?
(467 Bytes) Downloaded 812 times
User avatar
TrojakEW
 
Posts: 111
Joined: Sat Dec 25, 2010 10:12 am
Location: Slovakia

Next

Return to General

Who is online

Users browsing this forum: No registered users and 64 guests