my current wire placement rule set is this:
1. groups of wires that all connect to the same parameter on one node are evaluated to see if a wire wrap path makes sense. if so, these are placed first, and the cost of the path is raised arbitrarily high for other wires.
2. wires that travel the farthest go second and search for the shortest path with the fewest bends
3. wires that have the shortest path go last, avoid parallel runs, but favor perpendicular crossings
@aeva embrace the homies and make it real!
it looks really cool, I love visual programming languages and I never thought about making a grid-based one :3
@aeva clamp(x, lo, hi) = med3(x, lo, hi) if lo <= hi
proof:
suppose x < lo. then x < lo <= hi so lo is the median.
suppose lo <= x <= hi. then x is the median.
finally, suppose hi < x. then lo <= hi < x so hi is the median.
@steve @aeva Yup. And you can also use this in reverse for median nodes if you have them.
Specifically, for med3(a,b,c), during "code gen", swap all constant inputs to the right as necessary, and in nondescending order (via commutativity).
Then if b is constant, so is c, b <= c, and
med3(a,b,c) = max(min(a, c), b)
-> med3 is actually a pretty convenient IR for this. Symmetries are good!
@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.)
@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 ^_^