How do we create more amps like Swanky Amp? (With SPICE modeling for accurate sag/bloom behavior)

DSP, Plug-in and Host development discussion.
KVRist
119 posts since 5 Apr, 2017

Post Sat May 22, 2021 5:34 pm

I just downloaded Swanky Amp and I'm blown away. It really sounds great. I see the developer has posted here sharing and talking about the project. He explains on his GitHub/web page that he took the following approach:

- Model the amp in SPICE
- Run simulations to identify the behavior
- Use curve fitting to model the behavior

Swanky Amp as a result to me sounds very lifelike, dynamic, and real. The sag controls are fantastic. The only limitation is that it is modeled off a Tweed, and while this creates beautiful clean or lightly distorted sounds, it is not an amp good for other types of distortion.

I would love to build some amps using a similar design methodology but of other characters like say a SLO100, JCM800, or Mesa Boogie. But I am not sure where to begin.

I downloaded TINA-TI (Texas Instruments' SPICE program) and I can draw a given amp circuit in it. Except I don't actually see tubes as components available though in TINA-TI. Are these in there somewhere?

After that, what then? Has anyone tried to reproduce the process or does anyone have any good ideas on how to go about it?

My though would be an amp likely has several dynamic and non-dynamic elements. For example, my guess is the filters of the tone stack or input filtering for the tubes might not change regardless of dynamics going into or out of the amp.

However other parts may react strongly to the dynamics. One could simplify the amp to isolate these parts and and run impulses through the amp, looking at the output signals to figure out the behavior that's supposed to occur. Then transfer equations could be written to roughly model that.

I don't know though. Maybe this is a giant rabbit hole. Who knows how long the guy who made Swanky Amp took to figure out the process. But unless he's going to make a whole bunch of new models, we have to run with it, right?

So any thoughts?

KVRist

Topic Starter

119 posts since 5 Apr, 2017

Post Sat May 22, 2021 8:46 pm

Here's the best explanation I could find from Garrin (the Swanky designer) of the method:
garrinm wrote:
Fri Jun 05, 2020 12:21 pm
The sag, bloom etc. are deeply intertwined and that there's no single aspect of a circuit that can be changed to capture that. As far as I can tell voltage sag modulates the actual signal (any change to the plate voltage is nearly directly seen in the waveform, minus some filtering effects), and then this in turns changes the working point of the tube, which totally changes the distortion regime, and on top of that it also modulates the screen grid voltage. Plus, from my understanding, all the tube voltages are loosely coupled as they share a line (I know the line is filtered to make them independent, but circuits don't behave as idealized filters during heavy transients because they're nowhere steady state). You bring up an interesting point about the output transformer, I'll have to look into that a bit more.

Anyway, after much reading and watching youtube, I think in order to add more depth to the dynamic effects I'll need to simulate the dual rectifier. Or find an ad-hoc solution (but as per the previous paragraph, that's likely not to capture the full story). I'll keep investigating and when I think I have a good solution you'll be the first to know. It might also be, as you said, that spice can't really capture all these effects. But for now I don't think I'm done getting all the detail out of the simulation, so it makes sense to me to keep pursing that direction.

But in the meantime I'm hoping the current model has the right behaviour, if not a bit subdued.
So I guess the main gist of it is setting up a basic amp simulation from the block diagram or schematic but with the tube element of the design having a potential for variable voltage supply and those other cascading effects.

I see there's a pretty well described set of equations here for 12AX7, 6L6, and EL34 tubes:

https://www.dafx.de/paper-archive/2010/ ... 10_P12.pdf

It looks like they cover some coupling compression effects from tubes in series, but from what I see there's no attempt to model voltage sag. Not sure how that would get added in.

KVRist

Topic Starter

119 posts since 5 Apr, 2017

Post Sat May 22, 2021 9:16 pm

I also see from this site a summary of three sources for sag:

https://www.aikenamps.com/index.php/what-is-sag
There are three main places where sag occurs in a tube amplifier:

The rectifier: If a vacuum tube rectifier is used, sag is generated because of the internal resistance of the tube. Unlike a solid-state rectifier, a tube rectifier exhibits a fair amount of voltage drop which varies with the amount of current passing through the tube. In a class AB amplifier, the current drawn from the power supply is much greater at full power output than it is at idle. This large change in current demand causes the voltage drop across the tube rectifier to increase, which lowers the available plate supply voltage to the output tubes. This lowering of the supply voltage lowers the output power slightly in opposition to the larger input signal, making it act like a compressor. The lowered supply voltage also tends to decrease the available headroom, increasing clipping and changing the operating point of the tube dynamically. This type of sag can be emulated artificially in an amplifier with a solid-state rectifier by adding a series resistance, typically around 100 ohms or so..

The transformers: The resistance of the high-voltage secondary winding also creates sag. From Ohm's Law, the voltage drop across a resistance is equal to the resistance multiplied by the current flowing through it. This means that there is no voltage drop if there is no current, and the amount of voltage drop goes up linearly with increases in current draw. A typical power transformer B+ winding might have a resistance of 50 ohms - 300 ohms, depending upon the current rating and regulation of the transformer. For example, if the current draw in a push-pull class AB output stage at idle is 70mA total, and it increases to 170mA at full power, there is a change of 100mA in the current drawn through the secondary windings. If the winding resistance of the secondary is 200 ohms, there is a voltage drop of 100mA*200 ohms = 20V in the plate voltage to the output tubes. Likewise, the resistance of the primary winding of an output transformer varies as well, typically 80 ohms - 200 ohms plate-to-plate, depending upon the primary inductance, the transformer power rating, and the rated impedance. This resistance also creates a voltage drop, but the amount of sag introduced is minimal in pentode mode, because the plate voltage doesn't have near as much effect on the plate current as does the screen voltage. In triode mode, there is more sag because the plate voltage has more of an effect on plate current in a triode. The supply sag created by the power transformer resistance lowers not only the plate voltage, but the screen voltage as well, since the screen is nearly always a filtered version of the supply going to the plate. The amount of sag induced by the power transformer winding can be offset if there is a large filter capacitor reservoir to hold the voltage constant during current peaks.

The filter capacitors: The size of the filter capacitors in relation to the amount of current drawn from the power supply also creates sag. The filter caps charge up during the peaks of the AC input cycles, and hold the voltage constant during the "valleys". If the ratio of peak to idle current is high, and the peak current demands are high in relation to the capacitance size, the voltage will sag appreciably during the valleys, creating a lower average voltage. If there is no further filtering, there will also be a 120Hz sawtooth ripple riding on the B+ supply. This normally doesn't induce much hum into the output stage because of the inherent power supply rejection afforded by the push-pull output stage, and the screen supply is usually filtered further with a choke and another capacitor. However, insufficient filtering can induce ripple into the amplifier if the output stage is not well balanced, or if the screen and preamp supplies aren't well filtered.
Perhaps this is where the SPICE simulation and curve fitting needs to come in. If we don't have good published equations explaining how these things happen, then maybe you have to run simulations with transients or impulses and measure the voltage changes so you can curve fit them (and then put them into tube equations like the ones posted)?

KVRist

Topic Starter

119 posts since 5 Apr, 2017

Post Sat May 22, 2021 9:21 pm

Oh I just noticed the article I posted does seem to cover sag effects:
The push-pull power amplifier with two 6L6GC tubes was simulated with the input 1 kHz sinewave signal with an amplitude of200 V and a sampling frequency of 96 kHz. Firstly, the opposite grid voltages were computed from the grid current circuit. Subsequently, these voltages were used as inputs for the plate current circuit. The output signal from the amplifier is shown in Figure 16.One can see the symmetrical signal limiting, which is typical for power amplifiers and also the output signal amplitude compression(sagging effect) can be seen in Figure 16. The power supply drops due the current flowing through the resistor RD and the level of the output voltage decreases while the input signal has the same amplitude.
So if that was published in 2010 and seems to capture some sag behaviors, why do most modern amp sims suck at sagging and what was the need for the Swanky SPICE analysis and curve fitting?

Perhaps it's as the Swanky designer says - the power amp voltage drop then manipulates the other components like tube distortion characteristics which a model like that article does not cover?

For one extra point of reference I just found this which suggests the article's use of a resistor (RD) for simulating the sag may be less than ideal:

http://hotroddiy.com/The-Tube-Rectifier-Sag-Mod.pdf
It must be realized that the effect produced by a resistor will never be exactly the same as an actual tube. The voltage drop across a resistor proceeds in a linear fashion, or like a straight line, while the voltage drop across a tube is logarithmic, or a slope shaped line.

User avatar
KVRist
225 posts since 26 Sep, 2019

Post Sun May 23, 2021 6:00 am

Hi Mike, very cool initiative. I'll check back on this thread but here just a few resources to help get more info out there:

Here's a great overview of an amp circuit with an explanation of how the parts work in isolation https://www.ampbooks.com/mobile/classic ... eluxe-5e3/.

As you've noticed in your research a lot of the dynamic effects that make an amp come to life come from the interplay of the various components, so for that you'll need some kind of simulation. There's also a live spice simulation project that could be very interesting for getting all those dynamics in full detail, thought I don't know if it'll be feasible to do this in a plugin audio-thread setting without some major modification http://www.livespice.org/.

And as for getting a good understanding of how a tube works under various conditions, I think spice models are a good place to look, though it takes some time to decipher the meaning of it all. Here's a couple of forum posts where you can find such models: https://www.diyaudio.com/forums/tubes-v ... 072-a.html. https://www.diyaudio.com/forums/instrum ... -0-5v.html, https://www.diyaudio.com/forums/tubes-v ... perly.html, https://www.diyaudio.com/forums/tubes-v ... s-167.html.

Garrin

AXP
KVRist
96 posts since 24 Mar, 2012

Post Sat Jul 24, 2021 10:57 am

The outlined approach (SPICE reference -> fitting a model) is what I guess most of the developers are using in this or that form (definitely true for my models at least). The main difference is that people usually omit power line effects (sag, consequential coupling between stages, etc.) because they either believe they are irrelevant or are saving computational power for something else.

The SPICE itself is pretty accurate, as long as the individual part models are. There are some well-known models of tubes, but one can always create their own given they have access to circuits, measurement equipment and have experience with curve fitting.

There's no principal problem in modelling the whole circuit that way, apart from computational complexity and numerical stability. That's why the circuits are usually first decomposed into separate decoupled blocks (which results in some loss of the model's accuracy) and some blocks (e.g. non-ideal power sources, transformers, etc.) are omitted altogether (which further degrades the model's quality).
My free VST guitar effects
www.soft-amp.com

Return to “DSP and Plug-in Development”