LFO Shape Designer
-
I'm looking into building a designer for custom LFO shapes, similar to that of the original NI Massive:
My version would differ slightly in that you would drag the Shape onto a dynamic grid (8 steps max, 2 min), which would then update the table. Something a little bit like the below but a lot more developed (and with less complex shapes!)
My main concern (aside from the draggable panel design!) is updating the table points. I'd need a way to update the index of each point when new shapes get added to the table, as the total number of points will often increase / decrease. A table script often looks like the below:
inline function ontableShapeControl(component, value) { tableShape1.reset(0); tableShape1.setTablePoint(0, 0, 0.00, 0, 0.2); tableShape1.setTablePoint(0, 1, 0.15, 0.5, 0.2); tableShape1.addTablePoint(0, 0.5, 1); tableShape1.addTablePoint(0, 0.75, 0.5); tableShape1.setTablePoint(0, 4, 0.75, 0, 0.2); }; Content.getComponent("tableShape").setControlCallback(ontableShapeControl);
So the function would need to be able to dynamically add and remove lines to allow for additional points, update all the indexes if needed, and change all the values. In my head this just seems super tricky
Any ideas on this would be hugely welcome. Could be a really cool feature for lots of us.
-
@DanH said in LFO Shape Designer:
In my head this just seems super tricky
All you need is a loop. From 0 to the number of table points.
Another UX you could use instead of dragging, and which avoids the need for drawing table points, is using copy paste of the tables.
-
All you need is a loop. From 0 to the number of table points.
How would you update the other values?
Another UX you could use instead of dragging, and which avoids the need for drawing table points, is using copy paste of the tables.
Its like adding tables together, rather than one whole table (which is what I've just made on that other thread). Unless I've misunderstood? Dragging seems in vogue and intuitive right now.
Thanks :)
-
@DanH said in LFO Shape Designer:
How would you update the other values?
Not sure what you mean by other values, maybe I've misunderstood the concept.
-
@d-healey oh sorry, I think I'm confusing things!
So every time a new shape is added to the sequence it will add / remove some table points. So lets say a table has only two points:
tableShape1.setTablePoint(0, 0, 0.00, 0, 0.2); tableShape1.setTablePoint(0, 1, 0.75, 0, 0.2);
Then a shape is dragged on and the code would become:
tableShape1.setTablePoint(0, 0, 0.00, 0, 0.2); tableShape1.setTablePoint(0, 1, 0.15, 0.5, 0.2); tableShape1.setTablePoint(0, 2, 0.75, 0, 0.2);
So actually perhaps the x/y/curve values don't need to change, only the index does. And adding the points obviously...
-
So you need an array to store the table points, you then run the loop over the array to add the points to the table.
-
@d-healey but I HATE arrays!
-
@DanH You need to embrace them.
And array is just like have multiple variables but with less code.
So you could use lots of variables like this
const myVar0 = 10; const myVar1 = 20; const myVar2 = 30; const myVar3 = 40; Console.print(myVar3); // 40
or you can use a single array
const myArr = [10, 20, 30, 40]; Console.print(myArr[3]); // 40
They are not much different, but arrays are much more useful for doing batch jobs because you can loop over them.
-
@d-healey you forget that I inspired you to make the make the arrays video a few years ago
I've come a long way since then :) Not far enough however...
I've just seen there's an api for it perhaps:
-
@DanH said in LFO Shape Designer:
I've just seen there's an api for it perhaps:
Looks like it will save you from a loop, Looks like it will save you from a loop, Looks like it will save you from a loop, Looks like it will save you from a loop
-
@d-healey perhaps, if it worked!
tableShape1.setTablePointsFromArray([0, 0.5, 0.30, [0]], [0.5, 0.75, 0.5, [1]], [1, 0.9, 0.9, [2]]);
-
@DanH Looks like it's only for Tables, not ScriptTables
-
@d-healey ok so my script is:
const var Table1 = Content.getComponent("Table1"); const var LFO1 = Synth.getModulator("LFO1"); const var tableShape1 = Synth.getTableProcessor("LFO1"); const var makeShape = Content.getComponent("makeShape"); inline function onmakeShapeControl(component, value) { tableShape1.reset(0); tableShape1.setTablePointsFromArray([0, 0.5, 0.30], [0.5, 0.75, 0.5], [1, 0.9, 0.9]); }; Content.getComponent("makeShape").setControlCallback(onmakeShapeControl);
The other API's (add/setTablePoint) work fine here....
-
@DanH TableProcessor != Table
Try this
-
@d-healey ah, yes got it working, thanks :) Ok so this array needs to dynamically load points into the table..
-
@DanH Each time you update your array you call that function to update the table
-
@d-healey can the array have a dynamic number of variables?
-
@DanH An array is a variable. You can dynamically change the values within it. Check out the API
-
@d-healey so push and remove might help here I guess....
-
@d-healey or concat
Making some (slow) progress... please let me know any pointers if you have any...
HiseSnippet 1391.3oc2X8tZabDDeOYeoQJMgFZ9PoPgC+IEhQH4XmXSojyVVJHpjknxMotlPX8oUVa7c6d8tU1UMD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