Bad Circuit Modelling Episode 1: Component Tolerances

Jatin Chowdhury
6 min readNov 18, 2019

--

I want to start by addressing something I’ve heard a few times in the world of virtual analog modelling for digital audio effects. Let’s say I wanted to make a model of the famous LA-2A optical compressor. So I buy an actual LA-2A, I take measurements, analyze the circuit diagrams, etc, and construct a virtual model of the effect. In recent years, modelling accuracy has reached the point where it is possible to construct a model that sounds more like my unit than my unit sounds compared to another unit of the same make.

In the analog modelling world, this level of precision is often considered a great success, and without a doubt, achieving that level of precision is certainly a great feat of engineering, requiring a deep knowledge of the system being modelled, as well as incredible attention to detail. However, from an audio perspective, I would consider this result somewhat of a failure.

When I buy an LA-2A, I an buying a unique piece of hardware, that sounds unlike anything else in the world. This uniqueness, particularly when compounded across the many effects used in a production, can give my sounds an interesting character that is specific to my studio. On the other hand if I use a software model of an LA-2A, the version on my computer will sound exactly the same as everyone else’s. For some mixing engineers this uniformity is seen as a good thing: if I go to someone else’s studio and they have the same plugins as I do, I can be assured they will sound exactly the same as I am accustomed to. That said, in my experience as a mixing engineer, the variations in hardware effects can add a ton of positive elements to a mix, including stereo width, perceptual depth, and once again, a characteristic sound of my studio.

In this series, I’m planning to explore some of the elements that can cause variations in analog effects. While I plan to focus mostly on basic electrical components (resistors, capacitors, etc), similar ideas can usually be applied to more complex circuit elements, as well as other analog audio elements including speaker cones, guitar strings, magnetic tape, and more.

Before I continue, I’d like to mention that this article is also available as a Jupyter notebook for those of you who prefer to look at code: https://ccrma.stanford.edu/~jatin/Bad-Circuit-Modelling/Tolerances.html.

Component Tolerances

In this article, we’ll be talking about component tolerances, one of the most fundamental causes of variations in analog circuits. The basic idea is that no electrical component can be manufactured with perfect precision. With that in mind, manufacturers label their parts with a tolerance rating. So if you buy a 500 Ohm resistor, the resistor will also have a tolerance rating, say +/- 5%, or +/- 1%, or something of the sort. In general, for a more precise overall circuit, it is better to use parts with lower tolerance ratings, however, such parts are also more expensive, so circuit designers try to build robust designs that can handle a little bit of component variation, and will often optimize their circuit to find a balance between cost and precision.

Circuit Analysis

As an example of this phenomenon, let’s analyze and construct a model of an ideal Sallen-Key second-order lowpass filter.

Note that in this idealized model, we will assume that the op-amp provides perfect, linear gain, as opposed to the more nonlinear response that might be observed in real life. From this model, we can can calculate the cutoff frequency and Q value for the filter as follows:

Now let’s design our example filter such that fc=1 kHz, and Q=2. In other words, we choose C=4.7 nF, R=33.8 kOhms, R2=1.5 kOhms, and R1=1 kOhms. When we construct a digital model of this filter we obtain the following frequency response.

Inserting Imperfections

Now let’s see what happens when we make our circuit elements less perfect, specifically by including component tolerances as part of our model. For now we’ll use a Gaussian distribution for the randomness of our component values, but we’ll discuss more realistic distributions in more detail later on.

The following plot demonstrates how the frequency response varies for different levels of component tolerance:

Now I should note that the above plot is a little bit of an exaggeration, with regards to the actual variations present in analog hardware. First off, 10% is a pretty large tolerance, and one would expect manufacturers, particularly those who make high-end gear, to use higher quality parts. Additionally, most respectable hardware makers have some form of quality control both in rejecting abnormally bad components before including them in their circuits, as well as testing their completed products before they are shipped. So the actual variation in a lowpass filter circuit that you might buy should never be quite as bad as that shown in the plot above, but the basic idea that such variation exists definitely still stands.

Probability Distributions

When I first started looking at this idea of introducing component tolerances into circuit models, I had expected the actual component values to follow a more or less Gaussian distribution. The reality turns out to be a bit more complicated. Although there appears to be a lack of academic writing on the subject, engineers and hackers seem to agree that actual component values follow something like a “truncated Gaussian” distribution. The interested reader is encouraged to read this insightful and humorous article on the subject from Howard Johnson [link].

Now we can see what our new frequency responses should look like with our updated component value distribution.

Implementation

Now for an audio plugin to include component tolerances, is actually a pretty simple matter. As an example, I’ve developed a simple plugin that models the Sallen-Key lowpass filter circuit from above, and includes an option to change the component tolerances. In my implementation, the values of each component for each tolerance are calculated when the plugin is initialized, using the truncated Gaussian distribution. Another option could be for plugin manufacturers to generate some sort of random seed from the registration or installation process of their plugin, so your copy of their plugin will sound the same every time you use it, but will sound different from everybody elses.

Another important thing to consider (in my opinion), is to use different components for the two channels of a stereo effect, so that for tolerance values greater than zero, the circuits being modelled between the two channels is not exactly the same. For large component tolerances, this stereo mismatch can make the effect seem unbalananced, and sort of “lean” to one side, however for smaller values it still sounds correct, while lending the sound a little bit of extra stereo “width”, that would be missing otherwise.

Finally…

That’s all for today’s article, thanks for reading! For my next article, I’m planning to examine the effects of aging on electrical components, and see how that affects our models of audio effect circuits.

--

--

Jatin Chowdhury
Jatin Chowdhury

No responses yet