- The over-whole MT2 tone (and the bass variation)
- The MT2 pedal sections: analysis
- Analysis of the Boss MT2 Metal Zone pedal (2)
- How to model an opamp? (the implications on simulation)
- Should I invert my matrix or not?
- Analysis of the Boss MT2 Metal zone pedal (1)
- From netlist to code: strategies to implement schematics modelling results
- From netlist to code: strategies to implement schematics modelling
- Analog modelling: The Moog ladder filter emulation in Python
- Analog modelling: A prototype generic modeller in Python
- Comparing preamps
- Triode circuit
- SD1 vs TS9
When I started reviewing the diode clippers, the goal was to end up modeling a triode simple preamp. Thanks to Ivan Cohen from musical entropy, I’ve finally managed to drive the proper equation system to model this specific type of preamp.
Schematics
Let’s have a look at the circuit:

There are several things to notice:
- We need to have equations of the triode based on the voltage on its bounds
- There is a non-null steady state, meaning there is current in the circuit when there is no input
For the equations, I’ve used once again Ivan Cohen’s work available in his papers (the modified Koren’s equations), available in Audio Toolkit.
Steady state
So, for the second point, we need to compute the steady state of the circuit. This can be achieved by putting the input to the ground voltage and remove the capacitors. Once this is done, we can have the final equations of the system in (for voltage of the plate, the grid, and finally the cathode):
The Jacobian:
With this system, we can run a Newton Raphson optimizer to find the proper stable state of the system. It may require lots of iterations, but this is not a problem: it’s done once at the beginning, and then we will use the next system for computing the new state when we input a signal.
Transient state
As in the previous analog modeling posts, I’m using the SVF/DK-method to simplify the ODE (to remove the derivative dependency, turning the ODE in a non linear system). So there are two systems to solve. The first one is the ODE with traditional Newton Raphson optimizer (from , we want to compute
):
Which makes the Jacobian:
Once more, this system can be optimized with a classic NR optimizer, this time in a few iterations (3 to 5, depending on the oversampling, the input signal…)
The updates for ickeq and icoeq are:
Of course, we need a start value for the steady state. It is quite simple as the previous state is the same as the new one which makes the equations:
Result
Let’s start with the behavior for a simple sinusoid signal:

You can spot that in the beginning of the sinusoid, the output signal is not stable, the average moves down with time. This is to be expected as the tube obviously compresses the negative side of the sinusoid, while it almost chops the positive side after 30 to 40V. The non symmetric behavior is what gives the warmth to the tube. The even harmonics are also clear with a sine sweep of the system:

Strangely enough, even if the signal seems quite distorted, really harmonics are not strong (compared to SD1 or TS9). This makes me believe that it is a reason for the love of the user for tube preamps.
Conclusion
There are a few new developments here compared to my previous posts (SD1 and TS9). The first is the fact that we have a more complex system, with several capacitors that need to be individually simulated. This leads to a vectorial implementation of the NR algorithm.
The second one is the requirement to compute a steady state that is not zero everywhere. Without this, the first iterations of the system would be more than chaotic, not realistic and hard on the CPU. Definitely not what you would want!
Based on these two developments, it is now possible to easily develop more complex circuit modeling. Even if the cost here is high (due to the complex triode equations), the conjunction of the NR algorithm with the DK method makes it doable to have real-time simulation.
Hi, great work Matthieu, many thanks for publishing this.
One question, cause i tried to implement new Cohen’s model but hardly found the parameters values…
I tried with the one’s catched in your code and that fit with the old one, so i wanted to know : how do you find them?
And by the way, did you try other model’s like Cardarili?
Actually Ivan gave me some values 😉
I haven’t tried other models, I don’t know of all of them, so I may try that one as well. The issue there is always the one you are pinpointing: what parameter values to use?