Infernal Diseased Dire Rat - JSFX plugin

Started by ashcat_lt, March 03, 2014, 06:36:10 PM

Previous topic - Next topic

ashcat_lt

I'm re-posting this here partly because you folks were very important in helping to understand this thing well enough to build it, partly because it's based on a DIY pedal, and partly because it's kind of like a socketed Rat where you can play with various mods without having to breadboard or do much of anything.
___________________________

I'm slowly and carefully working toward replacing my pedalboard with a USB controller/software solution.  The most important part of that, of course, is finding the actual plugins that are going to replace each of the pedals.  I need them to sound and otherwise respond as close to what I expect from their meatspace counterparts as possible.  Plus, I'm Nutz, so I'm not really willing to settle for "kinda close", and so I've taken the plunge into hacking together some of the "pedals" on my own. 

For those not aware Reaper is an incredibly robust piece of software that costs almost nothing. It would honestly be my DAW of choice for four or five times its price just for all of its other features. Then you throw in the fact that it comes with a powerful scripting engine in the form of Jesusonic that literally allows you to write your own plugins, and test them in realtime, right inside the program!

This one is interesting in that it's a DIY coded version of a DIY built pedal - my Diseased Dire Rat.  I messed around with a few different approaches, and ended up finding something that I think is a very close workalike to the original.  You can download it from the Reaper Stash at Infernal Diseased Dire Rat.  Download it, drop it in your Reaper FX folder (Windows usually puts this in the current user's Documents and Settings/Application Data/Reaper/ something directory.  You can open any JS effect and click Edit, look at the top of the window and it should show you the path) and insert it on a track, preferably before a good amp sim.

I'm not going to claim that works exactly like the original pedal, but it is pretty darn close.  It is sort of an emulation/model hybrid of some sort.  The fun part, I think, is that all of the critical values which make the most difference to the sound of the circuit are easy to modify even if you don't know anything about code.  You can literally just hit the Edit button and change resistors, pots, caps, didoes, power supply (but remember it's based on a +/- 4.5V split supply), even slew rate and open-loop bandwidth properties of the "opamp".  The values are specified in real world values like V and Ω and F.  It's like all of these components are socketed and you can play with them as you see fit.  Be a bit careful here, I'm not taking responsibility for damaged speakers or earballs!

A few notes on these values:

1) No, they are not the exact values in the actual meatspace pedal!  I did not keep track of the specific values when I built it, and I'm not willing to tear it apart to get them now.  Most of them are just "random" numbers within tolerance of the standard values.  Some of them were maybe fudged a little in the direction I thought I wanted them to go, but they were not really tuned by ear or anything.

B) Yes, the gain pot is 186K audio taper pot.  The actual pedal has a 100K pot with a 186K resistor across the outside legs and a cut in the resistive track right at the "high" end, such that it goes almost up to 100K and then jumps to 186K.  That's what makes it a "Dire" Rat.  The plugin goes smoothly through this transition region, and includes all of the in-between values, but the logarithmic action of the slider means it's pretty close to the same.

III) Slew rate and unity gain bandwidth are kind of fudged a bit.  My physical version has TL080 opamp with a very large 180pF compensation cap which is supposed to slow the slew rate down to something resembling the Rat's original LM308, but I was not able to determine from the datasheet exactly what the slew rate should be, or how this cap affects the bandwidth.  So, I picked a slew rate value in the range of the LM308, and ended up tweaking the bandwidth by ear and by eye, comparing it to the pedal until it was as close as possible.  It's pretty close!

So, you can get in there and play with values and then just save the plugin and see what it sounds like.  Want to try the Ruetz mod?  Make r4 really big with respect to the gainpotsize parameter.  10M should do it, but this is a 32bit float, so it can be really stupid big if you want.

What makes the thing "Diseased" is the Special Abilities control.  This is basically a "clipping mod" switch with 5 positions:
S = Silicon = one "silicon diode" in each direction
A = Asymmetrical = one diode one way and two the other
L = LED = two diodes in each direction (because two silicon diodes in series is about the same Vf as a red LED)
W = Way asymmetrical =  one diode one way and no diode (just the opamp rail clipping) the other way
O = Off = No diodes (just opamp rail clipping) in either direction

Some of the differences, once level matched, are kind of subtle, and very much dependent on the gain pot.  At high gain settings these things are clipping hundreds if not thousands of "attempted volts" down to less than a volt, and the asymmetry really doesn't amount to much change in the duty cycle of the rectangular waves that come out.  It's a pretty popular way to mod these things, though, and there are interesting sounds available in each position.  The fun thing is that this switch doesn't actually work as expected in the physical unit because asymmetrical clipping like this ends up making an effective DC offset, which the AC coupling caps on either end won't allow to stand.  They "float" up/down in such a way that the wave ends up clipped symmetrically anyway.  This digital version acts as though it were DC coupled through this section, and actually does asymmetric clipping like most folks think they get from these mods.  The DC offset is stripped out later.

K, cool.  Now it works pretty much exactly like the physical pedal, but what makes it Infernal?

Two things that would be much more difficult to do in analog (which I have not come up with snappy D&D themed names for yet):

flip bottom - This was actually kind of a happy accident that came from a bit of a wrong turn that I had taken early on in development.  Basically, there was a whole lot of noise.  Like, much more even than the analog version.  That's kind of the opposite of the point of digital.  I tried a couple of things to help it, but ended up just hacking in my "diode crossover distortion" code.  This is supposed to act pretty much like putting a pair of back-to-back silicon diodes in series with the signal, except that you can kind of bias each of the diodes separately.  In this case, it's set up to actually overlap a bit at the zero-crossings so that the "positive going" diode actually "turns on" at some small negative voltage, and the "negative going" diode at some positive voltage, and there is a small section of the swing where they overlap.  It's kind of like a misbiased push-pull stage, and the overlap alleviates some of the "gating" that you'd get if you actually biased these things to 0.  This worked very well to suppress the low-level noise that was getting amplified to unreasonable levels, but it introduced noticeable crossover distortion, and it was a very delicate balance to avoid too-bad gating.  It worked well at high gain settings where the distortion was kind of lost amongst all the other artifacts, and with my higher output guitars which had more of the desired signal louder than the unwanted noise.  I fixed the noise issue and started messing with different guitars and lower gain pot settings, and started to realize that I was just getting too much crossover distortion.  I very well could have just yanked that piece of code out of there at that point, but this chunk of code has the "flip bottom" logic built into it, and by now I had added a drop-down to turn it on and off and kind of really come to enjoy it.  It does exactly what it says.  The "crossover distorter" literally splits the wave form into positive and negative halves, and the flip bottom control inverts the bottom half - literally full wave rectifying the signal at the very front of the pedal.  It basically turns it into an octave fuzz, and like any octave fuzz you get the strongest effect with the neck pickup up around the 12th fret, and preferably with the guitar's tone control rolled down.  I managed to decrease the amount of crossover distortion and gating simply by gaining the signal way up (I used 4350 times gain, approximately the "passband gain" of the opamp section on 10) before the crossover section, and then attenuated back down on the other side.

R chan bias - This is fun, too.  In normal usage, this is effect is mono-in, mono-out (like any guitar pedal).  It takes its input from the left channel, ignoring the right, and spits its output to both left and right output channels.  When this control is set to On, though, it adds the right channel in after the high pass filters and gain have been applied.  If you just run the same thing into both inputs of the pedal, this sort of works to blend the original clean signal in a little bit, but if you run DC signal into the right channel, it's very much like adjusting the bias voltage at the input to the opamp, allowing you to get more asymmetrical clipping from both the opamp and the diodes which follow.  Run a very loud LFO in here, and things get really funky!  This alone offers a very broad pallet for experimentation, and it's good fun.

Any DC offset created in any of this madness is eventually stripped before leaving the plugin, and the both left and right outputs are always the same (the output of the "pedal"), so you don't have to worry much about that DC voltage "leaking" out to the rest of the world.

I guess I didn't mention it earlier, but the other sliders are the three pots you'd find a stock Rat:
HP = Distortion
AC = Filter (though it works backwards, which is actually the way you'd expect a Tone control to work)
ATT = Volume

Please take a look/listen, play around, mod away, and definitely LMK if you have any suggestions of how to improve either its authenticity or its efficiency as code.  I wanted to add parameter smoothing, but I wasn't able to get it working properly, and I'm not completely convinced that it's necessary.  Any comments, questions, advice, or opinions are