what if I made a little visual programming language for my synthesizer 🤔
I'm considering replacing the register machine I wrote with an evaluator graph as a convenience for polyphony, but this would also open up the possibility of live editing patches. My register machine allows for no flow control, and each operation has at most two inputs and exactly one output. This is geometrically very convenient, so I'm thinking maybe something grid based to hopefully keep it simple.
Another thing that would be nice is being able to make patch-specific touch interfaces.
I'm thinking something like this for the visual language frontend. The nodes are grid aligned with space between for connections to run. Placing a new node in that space would insert a new row or column into the grid. Wire paths will probably be automatic, and the whole thing would ideally have a deterministic textual representation to make revision control easier.
Also important: graph cycles are allowed. If there's a feedback loop, the value is pulled from the previous frame's computation or is zero if there is no previous frame.
Commutative instructions get to be variadic. I'm not sure what to do about non-commutative instructions syntaxwise. I'll probably have it make you select which parameter your connecting when you draw a connection, and then display information about the connection when you touch wires, and draw the name along the wire where possible. Color coding and ordering where the inputs connect also would make sense to supplement that.
I'm really tempted to just not have division or subtraction, and provide rcp and sign flip as instructions instead. Likewise who needs clamp when you've got min(max(v, low_bound), high_bound), right? I think I'd want lerp and some other functions that don't really fit this syntax well though so idk I'll have to think about that.

@aeva Reciprocal and negation/inverse would let me cover basic arithmetic in combination with an attenuverter that can scale and offset a signal. Perfectly chromulent way of subtracting/dividing.

Clamp in a single node can be useful, but through minimalism goggles, I'd see that as a special case of wave-shaping.

(Spent a minute building this in Bespoke Synth, but then realised it's quicker in Ableton. Bespoke's waveshaper lets you input maths expressions, so would kinda miss the point anyway.)

@nex someone pointed out in another reply branch that clamp can be expressed as a median of 3 values, which is commutative, so that would be a good candidate for a single instruction

@aeva Whoa … from the point of view of an idiot who wants to munge signals that traverse noodles, that's not the most intuitive way of doing clamp. BUT:

From a nerdy point of view, it's really intriguing how this node would generalise to accept any number of inputs. When you consider how median is defined for an even number of inputs, this could also provide an average of two values, and probably be abused in even more delectable ways ^_^

@nex median wouldn't be the average, but also idk what the most useful interpretation of clamp would be for more than three values. I figure I'd just have it only accept three values.

@aeva The median of two values is commonly understood to be the arithmetic mean of those values.

https://en.wikipedia.org/wiki/Median

Median - Wikipedia

@nex oh right, that makes sense.