This is a detailed description of how the Plusdistortion works. You're free to borrow ideas and functions for your own effects.
You can find a schematic of the MXR Distortion+ here: http://home.comcast.net/~snmavronis/mxr_distortion_plus_wiring_schematic.jpg
This is the structure of the Plusdistortion, with the controls that affect each stage:
This 1-pole filter allows you to cut off some of the low end using the tweak menu. The cutoff frequency can be set from 14Hz to 1.4kHz.
Resonant LP Filter
This filter simulates the effect of the 1nF capacitor on the input loading the guitar pickup. It has a 4dB boost at 2kHz, and then a 12dB/Oct cut afterwards.
This is the gain section of the op amp stage. It multiplies the signal based on the position of the distortion control. The gain goes from around 2 to 200.
Becaues of the 50nF capacitor in the Distortion+, there is audible high pass filtering at the end of the range of the Distortion control. This is inaudible for most of the range, but it does get up to around 700Hz at the end.
The op amp has limited bandwidth, which means that it filters out high frequencies at high gain. This too is inaudible for most of the range, but it get to around 5kHz at the end of the range of the Distortion control.
This is a triangular upsampling filter that you can find at http://www.synthmaker.co.uk/dokuwiki/doku.php?id=tutorials:oversampling. It's a FIR with coefficients of 0.5, 1, and 0.5. The oversampling control chooses between two chains, one with the upsampling and downsampling filters, and one without. It's a simple filter with a gentle slope, but the effect isn't hi-fi enough to require a more complicated and CPU-gobbling filter.
Op Amp Clipping
This is simple clipping, based on data taken from a ua741 op amp. The clipping normally occurs at +3.25V and -2.5V, but this can be tweaked with the Op Amp Clipping control.
This is a filter made to even out some differences between the Plusdistortion and a breadboarded D+.
This filter emulates the 10k-1nF LPF on the output of the Distortion Plus.
This is based on measurements taken from a 1N34A diode. The formula is based off of one I found on the internet, but I can't find it.
out = in * ( hardness + |in| ) / ( 1 + ( hardness + 1.4 ) * |in| + in^2 ) * 0.3
The hardness parameter is controlled by the Diode Clipping control. The default is around 3.
The decimating version of the upsampling filter.
This 1-pole filter allows you to cut off some of the high end using the High Cut control. The cutoff frequency can be set from 440Hz to around 20kHz.
This is the final stage, and it allows you to set the output volume using the Output control.