fast array resample in ruby?

For general discussion related FlowStone
Post Reply
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

fast array resample in ruby?

Post by tester »

Can someone help with ruby code for fast array resample?

Actually downsample, so for example input is "44100 x time" samples long and destination should be "600 x time" samples long. Since this is calculated many times per shot, it would be good to speed it up a little.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
TheOm
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: fast array resample in ruby?

Post by TheOm »

Why ruby? I doubt that you can get faster than the resample primitive with ruby. Maybe in ASM.
Also what kind of interpolation do you need?
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: fast array resample in ruby?

Post by tester »

I'm doing a statistical analyzer of audio textures. The signal path is similar to what is in attached file, with the exception that everything goes through analyzer prims, to produce arrays, that go through statistical analysis...

Basically, the concept is this. Signals goes through c.a. 900 filters (32 main filters and 20 + 7 filters per main slot in second order). Each filter produces an envelope at maximum rate around 200-250Hz, each about 10 seconds long. These envelopes are stored to memory via mem prims. So there are about 900 envelopes, each SR*t samples long. At 44.1k or more - this would take a lot of memory, plus statistical module would have too much of unnecessary work.

After filtered samples are stored to memory, serialized multiplexer just brings appropriate mems (various combinations), converts them back to arrays, and arrays are pushed through statistics. The statistics are generally wired, but there are still some trigger and normalization issues to deal with, but it's a second part. Third step (not touched yet) is a simple neural network, that learns from gathered statistics and produces identification ranges... :mrgreen:

Anyway. What I need at this point is a good way to resample these arrays (portions of filtered streamy signals), and it's possible that it could go with additional LP filters combined with resampler, to avoid aliasing (I assumed, that current filtration may do a decent job, but not tested it yet). Simple linear interpolatio should be enough.

BTW, filters are not optimized yet, I just experimentally selected which ones will do probably good job in such small ranges.
Attachments
signalpath.fsm
(20.92 KiB) Downloaded 969 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: fast array resample in ruby?

Post by tester »

I think I found another way to deal with resample/downsample stuff.

Following schematic is an example. To downsample by factor x100 it would just require 100 such modules as inside.

//edit: solved
Attachments
testmem-resample.fsm
(2.16 KiB) Downloaded 878 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply