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
Ruby resampling help
14 posts
• Page 1 of 2 • 1, 2
Ruby resampling help
Hey guys, I am trying to mimic the array resampling module with ruby, and I found something online but it doesnt really do the same thing. Can anyone with some expertise crack this?
Thank you!
Thank you!
- Attachments
-
- ruby resample.fsm
- (572 Bytes) Downloaded 930 times
- adamszabo
- Posts: 667
- Joined: Sun Jul 11, 2010 7:21 am
Re: Ruby resampling help
adamszabo wrote:Hey guys, I am trying to mimic the array resampling module with ruby, and I found something online but it doesnt really do the same thing. Can anyone with some expertise crack this?
Thank you!
Why do you need that?
- Youlean
- Posts: 176
- Joined: Mon Jun 09, 2014 2:49 pm
Re: Ruby resampling help
it looks close, the code is ugly, I do not know Ruby very well ;(
- Attachments
-
- ruby resample.fsm
- (4.22 KiB) Downloaded 884 times
- Logado
- Posts: 62
- Joined: Tue Jan 06, 2015 5:42 pm
Re: Ruby resampling help
Thank you, looks interesting! I would need it because I would like to replace a whole green stuff with only ruby to make it nicer and more effective
- adamszabo
- Posts: 667
- Joined: Sun Jul 11, 2010 7:21 am
Re: Ruby resampling help
Logado, thanks to your help I could understand whats going on and I made a more Ruby-ish version. It works great! Now only if I knew how to make the cubic interpolation and that smoothing they use in the resampler module
- Attachments
-
- ruby resampling.fsm
- (627 Bytes) Downloaded 910 times
- adamszabo
- Posts: 667
- Joined: Sun Jul 11, 2010 7:21 am
Re: Ruby resampling help
as far as I have gathered, linear is a good one, it's what I would set the resample to
- sorry I would struggle to help
edit- to smooth the end points, multiply by a faded array of points
- sorry I would struggle to help
edit- to smooth the end points, multiply by a faded array of points
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
Re: Ruby resampling help
I've never used a cubic interpolation, maybe you'll find the answer here.
I think we need to, hook more samples and use a frac instead of a t in formulas
https://www.ibiblio.org/e-notes/Splines/Intro.htm
I think we need to, hook more samples and use a frac instead of a t in formulas
https://www.ibiblio.org/e-notes/Splines/Intro.htm
- Logado
- Posts: 62
- Joined: Tue Jan 06, 2015 5:42 pm
Re: Ruby resampling help
I made several examples of cubic interpolation. A descripted version can be found in the module definition of my spline class.
http://flowstone.guru/downloads/ruby-for-flowstone-expansion-spline-class/
But basically: You can derive cubic from linear, when omitting higher math.
lin = a + x * (b - a)
quad = lin1 + x * (lin2 - lin1)
cubic = quad1 + x * (quad2 - quad1)
cubic needs 4 poles and a position/time value
a, b, c, d
lin1 uses a,b
lin2 uses b,c
lin3 uses c,d
quad1 uses lin1, lin2
quad2 uses lin2, lin3
Happy programming (or copying from the spline class's module)
http://flowstone.guru/downloads/ruby-for-flowstone-expansion-spline-class/
But basically: You can derive cubic from linear, when omitting higher math.
lin = a + x * (b - a)
quad = lin1 + x * (lin2 - lin1)
cubic = quad1 + x * (quad2 - quad1)
cubic needs 4 poles and a position/time value
a, b, c, d
lin1 uses a,b
lin2 uses b,c
lin3 uses c,d
quad1 uses lin1, lin2
quad2 uses lin2, lin3
Happy programming (or copying from the spline class's module)
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Ruby resampling help
adamszabo wrote:Thank you, looks interesting! I would need it because I would like to replace a whole green stuff with only ruby to make it nicer and more effective
Well Ruby won't be much faster than green. You should use dll if you want speed. I could make dll for that if you need.
- Youlean
- Posts: 176
- Joined: Mon Jun 09, 2014 2:49 pm
Re: Ruby resampling help
tulamide wrote:lin = a + x * (b - a)
quad = lin1 + x * (lin2 - lin1)
cubic = quad1 + x * (quad2 - quad1)
cubic needs 4 poles and a position/time value
a, b, c, d
lin1 uses a,b
lin2 uses b,c
lin3 uses c,d
quad1 uses lin1, lin2
quad2 uses lin2, lin3
I tried my very best but I couldnt make it happen. Any examples?
- adamszabo
- Posts: 667
- Joined: Sun Jul 11, 2010 7:21 am
14 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 66 guests