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
3 posts
• Page 1 of 1
Slow Ruby Ramp Generator
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
Thanks for any help or suggestions,
Aron
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
Thanks for any help or suggestions,
Aron
-
aronb - Posts: 154
- Joined: Sun Apr 17, 2011 3:08 am
- Location: Florida, USA
Re: Slow Ruby Ramp Generator
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.
2. If you want to generate a slowly changing green float output.
this will generate ramp that goes from 0 to 1 in predefined period time.
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
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...
does this look correct? It just seems complex for something like an up counter, but again I am not a Ruby coder
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
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...
does this look correct? It just seems complex for something like an up counter, but again I am not a Ruby coder
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
-
aronb - Posts: 154
- Joined: Sun Apr 17, 2011 3:08 am
- Location: Florida, USA
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 53 guests