VCV Prototype

I’ll start the ball rolling on Faust. These are sketches and I have not tested them (so please expect errors!) but they do compile and I’ve included the block diagrams generated by the online tool. @Vortico, is this what you had in mind? If so, I’ll continue as time permits.

Faust Attenuator: takes an audio signal and a gain parameter and outputs silence if gain <= 0, the original signal if gain >= 5, and a linearly attenuated signal if 0 > gain > 5.

attenuator(audio, gain) = audio * (max(0, min(gain, 5)) / 5);
process = attenuator;

faust_attenuator

Faust XOR Gate: sets an output gate to 10V if either (but not both) inputs are 10V.

xor_gate(gate_in_1, gate_in_2) = ((gate_in_1 == 10) xor (gate_in_2 == 10)) * 10;
process = xor_gate;

faust_xor_gate

Faust (Leaky) Integrator/one-pole filter: @Vortico, this is what you were asking for, right? deltaTime made me think you might have wanted a more-than-one sample delay with no leak.

deltaTime = 0.99;
process = + ~ *(deltaTime);

faust_leaky_integrator

(This is the canonical way to do it, though it needs some explanation. In Faust, A~B feeds the output from block A back into block A, through block B, with an implicit one-sample delay. Here, block A is +; it is adding the feedback from B and the (implicit) input. Block B is multiplying the output from A by a coefficient (presumably <= 1), and then sending it back (after one sample) to A.)


Notes on the above:

Faust does implicit connection between input and output streams. The Faust passthrough program is process = _;, which connects an implicit input to an implicit output using a straight wire (_).

For this exercise, I’m assuming that the Rack wrapper for Faust DSP is implicitly making all Rack inputs available as streams in order and taking all output streams and writing them to outputs[0], outputs[1], etc. This is typically done via architecture specifications but that’s more like tooling than core language stuff. Range conversion can also be done with UI primitives but I’m avoiding that above for simplicity.

1 Like