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

Ruby resampling help

For general discussion related FlowStone

Ruby resampling help

Postby adamszabo » Sun Sep 03, 2017 9:14 pm

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!
Attachments
ruby resample.fsm
(572 Bytes) Downloaded 906 times
adamszabo
 
Posts: 657
Joined: Sun Jul 11, 2010 7:21 am

Re: Ruby resampling help

Postby Youlean » Wed Sep 06, 2017 1:38 am

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

Postby Logado » Wed Sep 06, 2017 4:38 am

it looks close, the code is ugly, I do not know Ruby very well ;(
Attachments
ruby resample.fsm
(4.22 KiB) Downloaded 864 times
Logado
 
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

Re: Ruby resampling help

Postby adamszabo » Wed Sep 06, 2017 8:26 am

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: 657
Joined: Sun Jul 11, 2010 7:21 am

Re: Ruby resampling help

Postby adamszabo » Wed Sep 06, 2017 11:42 am

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 884 times
adamszabo
 
Posts: 657
Joined: Sun Jul 11, 2010 7:21 am

Re: Ruby resampling help

Postby nix » Wed Sep 06, 2017 11:49 am

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
User avatar
nix
 
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Ruby resampling help

Postby Logado » Wed Sep 06, 2017 2:56 pm

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
Logado
 
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

Re: Ruby resampling help

Postby tulamide » Wed Sep 06, 2017 4:35 pm

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) :D
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2688
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby resampling help

Postby Youlean » Thu Sep 07, 2017 1:50 pm

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

Postby adamszabo » Tue Sep 12, 2017 11:52 pm

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? :D
adamszabo
 
Posts: 657
Joined: Sun Jul 11, 2010 7:21 am

Next

Return to General

Who is online

Users browsing this forum: No registered users and 35 guests

cron