Sample accurate Array shifting.

For general discussion related FlowStone
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Sample accurate Array shifting.

Post by trogluddite »

OK, so it looks like; interpolater module 'Step' input = streamin 'v' = the position in the Array that you want to interpolate. Presumably this value loops (or whatever) between zero and whatever maximum index you need.

So another few questions, I'm afraid.

Is the whole array always scanned through?
Does the array size need to change during run-time, or does the size stay fixed after loading?
Are you OK with the array size having to be a power of two?

None of those are a problem either way, but if you can manage with a fixed array that's always a power of two in size, some very neat and fast index-wrapping code is possible.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Sample accurate Array shifting.

Post by tulamide »

However, IIRC, there is a sneaky way to get the memory address of the raw sample data from a Frame, which might ease the translation from Ruby to Blue (though it has to be used somewhat, erm, carefully!)
Not so sneaky, actually. Frame's instance method :data contains the actual memory address to the data, not the data itself. I once saw this in one of your examples, and later made use of it for a project that Martin was working on (something with direct access to memory from assembler or something like that)

Not that it matters much in this case, but since you mentioned it... :mrgreen:
"There lies the dog buried" (German saying translated literally)
User avatar
lalalandsynth
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: Sample accurate Array shifting.

Post by lalalandsynth »

@ Trog

Yes the whole envelope array value is looped in sync to daw and used to control various other modules.

1. The whole array is always used.
2. The array size is always the same.
3. The whole array is indeed 1024 .

As for how its setup at the moment.( With the dodgy green setup)

For example the Offset knob is at 0 at center and goes full ccw to -1024 and shifts the envelope until its back to the same position , same with moving it cw +1024 and it moves until its fully at the same position. With snap these values are quantized so moving the knob moves the envelope one beat value , essentially snapping to the selected grid size.

LFO is operated in the same manner i, e snapping to Quantise/Grid value selected,but behaves little differently and therefore requires the shift Array prim to do what it indeed does and that is.. I can start the index at 1024 (same as zero) and keep increasing the shift past 1024 and up to 2048 . This is required to achieve a forward, Backward and bipolar moving LFO.

In essence , being able to shift using these values would be nice to maintain if possible.
I mention that as I am not sure if it needs to be shifted in samples or something when in DSP ?

Hope I am not complicating things with my "explanations" :)
User avatar
lalalandsynth
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: Sample accurate Array shifting.

Post by lalalandsynth »

Offset , manual moving of the envelope , represented by they grey area.
Blue lines always stay at original drawing point and then grey area moves either with offset or LFO.
This function is mostly fine as its static , unless of course someone will automate.
Offset.jpg
Offset.jpg (213.38 KiB) Viewed 15344 times


LFO Moves envelope either with no snap , linear or snapped to grid via quantised LFO values.
It can either move backwards from origin point, forwards or in both directions.
Therefore the Shift Array prim being able to keep on shifting up to 2048 is needed.
moving lfo env.jpg
moving lfo env.jpg (184.6 KiB) Viewed 15344 times
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Sample accurate Array shifting.

Post by trogluddite »

tulamide wrote:...I once saw this in one of your examples

What? One of mine, you say? Errr... :lol: I wish I could sort out the memory addressing problems in my own brain by tinkering with the assembly in FS - the seg-faults get more frequent with every passing day! :?

@lalalandsynth
Great, that all makes a circular buffer an even better fit - wrapping out-of-range values and being able to sum offsets wherever you like come as standard in its simplest form. I'm sure I've coded this somewhere before, and I might have some idea where - I'll get back to you after a rummage (caveat: see above comment to tulamide! :lol: )
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
lalalandsynth
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: Sample accurate Array shifting.

Post by lalalandsynth »

@ Trog :)

Thanks so much mate , would be great to solve this issue.
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Sample accurate Array shifting.

Post by trogluddite »

That turned out to be easier than expected - once I looked closer at the code in your earlier post, I realised it only needed a couple of little tweaks!

For the moment, it's strictly mono-only, and with a fixed array size of 1024 (extending it for mono4/poly should be relatively easy, which I might have a go at). There are comments in the code about what values to change if you need a bigger or smaller array, but note that the size must be an integer power of two. The test set-up in the schematic should make clear how offsets sum and wrap around etc.

circular_buffers_001_mono1024.fsm
(374.65 KiB) Downloaded 912 times
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
lalalandsynth
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: Sample accurate Array shifting.

Post by lalalandsynth »

SWEET ! , Cant wait to test this !
its getting late here in Iceland , will test this first thing .

Thanks man , super appreciated !
User avatar
wlangfor@uoguelph.ca
Posts: 912
Joined: Tue Apr 03, 2018 5:50 pm
Location: North Bay, Ontario, Canada
Contact:

Re: Sample accurate Array shifting.

Post by wlangfor@uoguelph.ca »

lalalandsynth wrote:Here is the current version of the plugin, mostly finished except for the Shifting issue .

martin.jpg


GIF.
https://imgur.com/xYAgCnP


Looks great btw :)
My youtube channel: DSPplug
My Websites: www.dspplug.com KVRaudio flowstone products
User avatar
lalalandsynth
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: Sample accurate Array shifting.

Post by lalalandsynth »

AAAND, It works perfectly ! Nulls out in Reaper , even at stupid settings and speed .
Need to torture test but so far , beautiful !
My plugin is officially viable now .

THANKS Trog!! Massive thanks !
Post Reply