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

Slow Ruby Ramp Generator

For general discussion related FlowStone

Slow Ruby Ramp Generator

Postby aronb » Tue Jul 05, 2016 10:04 pm

Hi,

Is it possible to build a slow Ruby Ramp generator?

I have looked on the forum and tried to make one in Ruby but it crashes, pretty much on every try...
I need to make many random ramps that are slow, and was hoping I could do it in Ruby. I landed doing it in the DSP, but was wondering if slow waveforms can also be generated in Ruby as well ? ? ? And by slow I mean about 10 samples per second or so...

I forgot to save before I ran it - it crashed, but I took a screenshot :oops:

Ruby_Ramp.JPG
Failed Ruby Ramp...
Ruby_Ramp.JPG (52.22 KiB) Viewed 9310 times


Thanks for any help or suggestions,

Aron
User avatar
aronb
 
Posts: 154
Joined: Sun Apr 17, 2011 3:08 am
Location: Florida, USA

Re: Slow Ruby Ramp Generator

Postby KG_is_back » Tue Jul 05, 2016 10:55 pm

yes, this can be done. However, I'm not sure what you're trying to achieve exactly, so here are my few attempts:

1. From the image I see it seems you what to generate a wavetable for a ramp.
Code: Select all
#inputs should be named "length" (float) and "tick" (trigger)
def event(i,v,t)
if i=="tick"

output 0, (0...@length).map{|i|
i.to_f/@length
}

end
end


2. If you want to generate a slowly changing green float output.

Code: Select all
#input should be named "on" (boolean) and "period" (float)

def event(i,v,t)
if @on
@dt=t - (@dt||t)

@ramp=(@ramp||0.0+@dt/@period)%1.0
output 0,@ramp
input 99,nil,time+0.1 #change this 0.1 to whatever tick speed you need.
else
@ramp=0.0
@dt=nil
end
end


this will generate ramp that goes from 0 to 1 in predefined period time.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Slow Ruby Ramp Generator

Postby aronb » Wed Jul 06, 2016 4:19 am

OK...

I entered the Ruby code and while it produces an output it is not a ramp. I am still working thru this... a few of the code lines do not make sense to me at all, but I AM NOT a Ruby coder, but I am learning.

The input 99 is a callback to the input for ???

Here is my code...

Ruby_Ramp_01.fsm
Ruby Ramp
(65.82 KiB) Downloaded 891 times


does this look correct? It just seems complex for something like an up counter, but again I am not a Ruby coder :shock:

And to answer a previous question, I need a float output NOT an array... I can get the array version working, but not the "Streaming Green" version.

Thanks again,

Aron
User avatar
aronb
 
Posts: 154
Joined: Sun Apr 17, 2011 3:08 am
Location: Florida, USA


Return to General

Who is online

Users browsing this forum: No registered users and 53 guests