I really love the DEIND extensions for SC. I particularly like the “DiodeRingMod” - and I’d like to use it in my DAW as a VST or an AU.
Since the source code is available, I’m curious how difficult it would be to translate into something like FAUST. There’s not a ton of information on how to go about doing something like that - I’m assuming it is not a trivial amount of work - but I’d be interested to understand the process a little better, if anyone here has done that kind of thing.
It will not be too complex, even as your first Faust experiment. At first glance, you must do three key things: initialization, rewriting the transfer functions, and the ring-modulation process loop.
Then, you will need to rewrite the transfer function (you can use ba.if or select3, for example).
A variation would be a simple function, not discrete ( if/else logic) as the original (I’m not sure this will be equivalent, but would be interesting to test):
I just noted one thing. I exposed three parameters that were hidden in the original UGen version. That is good in itself; you can experiment more. But you must add an extra line to prevent division by zero, avoiding nasty glitches. Besides that, I think this version has no issues and three extra parameter controls.
Not yet - there are a couple of things that I might need to do a little follow-up on
But thank you for showing how this would be done, it completely illuminates something that seemed impossible just a few days ago.
This last code is the complete implementation. That’s all the code. I am curious to know if it is equivalent to the UGen. Glad to help!
EDIT: This seems better regarding waveforms; this code returns a waveform with more symmetry or balance between positive and negative samples, which I believe is preferable.
It may not be the original model, but that’s the above transfer function and its parameters. The UGen had hard-coded values for them; you can play with that, too. It seems much more interesting this way, I think.
The idea (from the UGen code) is to split the function into three regions: all-zero, linear, and quadratic, but always the same values, but there is no reason not to control at runtime