Wave Digital Filters (WDFs) is a circuit modelling paradigm that has become quite popular in recent years. While using WDFs to emulate circuits made up entirely of series and parallel combinations of elements is fairly straightforward, using WDFs for more complicated circuit topologies is a bit more difficult.
The idea for this article is to run through a simple example of constructing a wave digital model of a circuit containing an R-Type adaptor. The rest of this article assumes that the reader has a basic understanding of circuit theory (i.e. you know what series and parallel connections are), and knows a little bit about wave digital filters. This article also will not attempt to explain how and why R-Type adaptors work, and will just show an example (for more reading on the background on wave digital R-Type adaptors, check out some of Kurt Werner’s research).
The Circuit: ’59 Fender Bassman Tone Stack
The circuit that we’ll be analyzing for the rest of this article is the tone stack from the ’59 Fender Bassman guitar amplifier. This circuit has been widely discussed in analog modelling literature, starting with this 2006 DAFx paper by David Yeh and Julius Smith.
The Fender Bassman tone stack contains three potentiometers, which control the treble, mid, and bass response. The circuit’s output is taken from the center tap of the “treble” potentiometer.
Why Do We Need An R-Type Adaptor?
At first glance, this circuit seems like it should be pretty simple to model with wave digital filters: the circuit contains no nonlinear elements (e.g. diodes) or multi-port elements (e.g. op-amps). However, if we try breaking down the circuit topology into a binary tree of series and parallel connections, we quickly run into trouble. For example, consider the relationship between the resistor R4 and capacitor C2. These elements are neither in series with each other, nor are they in parallel with each other. Since traditional WDFs require circuit elements to be connected with series and parallel adaptors, it appears that we’re out of luck!
The problem here is that the Bassman tone stack circuit topology can’t be broken down into a series-parallel graph, however, it is possible to construct an SPQR tree describing the circuit topology. SPQR trees extend series-parallel graphs by adding “Q” nodes (these are trivial nodes which should never appear in circuit topologies), and “Rigid” nodes, which can be used to describe parts of a connection graph which are not series or parallel connections. Below we see the full SQPR tree for the Bassman tone stack circuit:
Deriving the R-Type Adaptor
While series and parallel adaptors can be re-used between WDF circuit models, R-Type adaptors typically need to be re-derived for every circuit model. In this section, I’ll go through my process of deriving the scattering matrix for the R-Type adaptor in the Bassman tone stack model.
Labelling the Circuit
First, let’s label all of the “ports” that will be connected to the R-Type adaptor:
Note that since C1 and R1 are in series with each other, we can just group them together as a single port (same with R2 and the top part of R3).
Next, let’s label the “nodes” in between the ports:
I typically label the “ground” node as “1”, and then count up from there, but the order in which the nodes are labelled really shouldn’t make much difference.
Constructing the Netlist
Next, we’re going to want to construct a “netlist” of the circuit components surrounding the R-Type adaptor. However, rather than trying to deal with the full circuit topology, we’re going to replace each port with a Thevenin “equivalent circuit,” made up of a voltage source and a resistor. Let’s start by writing down the netlist entries for Port A, connecting nodes 1 and 2:
Note that since the equivalent circuit contains two elements, we need to add a “node” in between them. Since the circuit itself has 5 nodes, I start by adding node 6 for Port A (Port B will add node 7, and so on). Next let’s add Port B, connecting nodes 2 and 4:
Now, we can continue the same pattern, and complete the netlist:
Generating the Scattering Matrix
Now that we have the netlist for the R-Type adaptor, we can go ahead and generate the adaptor’s scattering matrix. The math for this step is pretty involved, so I’ve developer R-Solver, a system for automating the scattering matrix generation process using a Python script and SageMath. Since installing SageMath can be a bit of a commitment, I’ve also been working on developing a web app that can be used to run the script from a server, although the web app is still a bit prone to crashing (help wanted!).
When running the script, we need to tell the script which port of the R-Type adaptor needs to be adapted. While not all circuits will need a port to be adapted, the Bassman tone stack has an unadaptable voltage source element at Port A, so we’ll need to tell the script to adapt the “0th” port (the Python script starts indexing at 0). Now we should be ready to run the script!
When the script has finished (on my Mac Mini, it takes about a minute to run), it will generate a text file containing the scattering matrix for the R-Type adaptor as a 2-dimensional C-style array. The file also contains an expression for the adapted port resistance at Port A. You might notice that the scattering matrix is generated “symbolically,” that is, the value of each entry of the matrix has been generated as a function of the port impedances of the R-Type adaptor. Having a symbolic scattering matrix means that when the values of the resistors in the circuit are changed (i.e. the user has turned the knobs controlling the potentiometers), the scattering matrix can be recomputed to reflect the new state of the circuit. It also means that we can use the symbolic scattering matrix for wave digital models that run at any sample rate, as well as wave digital models of other circuits with the same R-Type topology.
Implementing the circuit model
Now that we have derived the R-Type adaptor, we can finish implementing a wave digital model of the Bassman tone stack circuit! For this example, I’ve chosen to implement the circuit model using Gustav Anthon’s Python WDF framework. The plots below show the frequency response of the circuit model at various settings of the Bass and Treble knobs. The code for generating the plots is shown below as well.
In this article we’ve gone through a step-by-step process for constructing a wave digital model of a circuit containing an R-Type adaptor, using the tone stack from the ’59 Fender Bassman as an example circuit. There’s a lot more to cover regarding wave digital models with R-Type adaptors, including circuits containing op-amps, or circuits with multiple nonlinear ports, but hopefully this article will suffice as a brief introduction.
Thanks to Xavi Lizaragga for inspiring the writing of this article.