December 2015
This page contains the report for my final project in MUMT 618 – Computational Modeling of Musical Acoustics, at McGill University. This project aims to develop a model of an analog envelope filter in discrete time using nonlinear wave digital modeling.
Virtual analog modeling is the general technique describing digital methods that imitate the sound qualities and response characteristics of analog equipment that have an interesting musical quality. Virtual analog algorithms are most often physical models of audio effect units that are electronic or electromechanical, such as spring reverb units and voltage controlled filters [8]. For my project, I set out to create a physical model of an analog voltage controlled filter, the DOD 440. This pedal was originally made in the 1970’s and has since been reissued due to its popularity. I chose this subject for my project because I like the sound that the envelope filter produces and wanted to develop a physically realistic model that involves the interaction between circuit components. Some aspects of the envelope filter are unique to this one effect, but the techniques used to make a digital representation can be carried over for a wide range of acoustical modeling applications. Some of the topics that I researched for the development of this model include electronic circuit design, digital filters, fast approximation algorithms, wave digital filters, and acoustical system impulse response analysis.
Envelope-Controlled Filters (ECF) shape the tone of a signal in response to the volume of the sound going through them. ECFs allow the guitarist to accentuate rhythm and become more percussive. Most envelope filters have the same basic structure:
The input signal is sent to a buffer or booster stage at the input which sets the signal level to a point where it is likely to be easily detected by the envelope circuitry [9]. The signal is then split to the detector and the filter. The detector has control over the resistance of the filter stage, which changes the cutoff frequencies of the high pass and low pass stages.
Some models have many controls while others have just an on/off switch. For the DOD 440 there are two controls over the effect, which I defined from response analysis:Sensitivity (Level) – Adjusts input signal going to the envelope detection circuitry, which determines how much the filter responds to guitar playing.Range – Adjusts filter resonance at the fundamental frequency.
The distinguishing factor within an envelope controlled filter is in the envelope follower circuitry. This is mainly what separates one brand from another. The DOD 440 Schematic is shown here after I rearranged the components in order to highlight the detector and filter sections:
A research area related to virtual analog synthesis is wave digital filtering, which was first introduced by Fettweis in [3]. Nonlinear wave digital modeling is a good approach for prototyping virtual analog and physical modeling because it represents the circuit by a set of blocks connected through electrical ports. The interaction between elements, such as resistors, capacitors, and diodes, provides a physically realistic output. Blocks are connected to one another through scattering junctions, called adaptors, one for series and parallel connections. The simplest adaptor has two ports. Three port adapters have an adapted port (reflection free) which can lead to an element or another adapter. These adaptors can be chained together, and create a binary connection tree (BCT). One nonlinear element can be contained in the BCT, provided it’s located at the root of the tree. These tree structures can be connected in different ways, at the leaves (single port elements), at the root, or through cross control, among other techniques which are described in [2]. A good summary of Wave Digital Filters is contained in [5].
Creating complex circuit topologies in the wave digital domain is a challenge because of the inherent computational limitations, mostly regarding non-computable loops which are not a present in analog circuits. There is active research on Wave-Digital filtering to overcome the current topological limitations and define new non-linear elements to cover complicated analog circuit components, for example, in [6] and [10].
I performed an analysis of the envelope filter in continuous time using the swept sine method detailed by Smith in [7]. A logarithmic sine sweep was created within MATLAB based on equations detailed by Muller and Massarani [1].
To capture the response of the device under test, a PreSonus Firepod interface was connected to a Macbook, and the output of the interface was connected to an input. The output volume of the interface was set to that of a guitar signal, so that the device does not clip. Then the input gain of the interface was set so that the test waveform was recorded back at the same level as being sent. In this way, the test setup was normalized and the out/in signals could be compared. The DOD 440 was connected to the input and output of the recording interface. A logarithmic sine sweep was then sent through the device and the response was recorded to a WAV file within Logic Pro 9.
The response of the filter was taken for five values of Range for each of two Level positions, corresponding to low end and high end of the resonant frequency of the filter. To track the movement of the resonant frequency with respect to Input setting, the response was also recorded for five Level settings with Range set constant at the maximum setting to make the resonant frequency clear. Each response was put through a Matlab script [13] that extracted the impulse response based on equations from [1]. This algorithm uses the original sweep signal and the filter response impulse response to calculate the frequency response and plots the response using semilogx.
The filter’s minimum resonant frequency is approximately 330 Hz and maximum resonant frequency is approximately 3400 Hz.
The acceleration from the low and high end of the resonant frequency in response to an input signal envelope is important. I plotted the resonant peaks versus the position of the Level control to back out the curve associated with the envelope follower sensitivity. This curve is useful for capturing and verifying the envelope detector attack and decay parameters. The relationship between Input and the travel of the resonant frequency is roughly exponential. Once an input signal surpasses a certain threshold, the resonant frequency moves quickly from the low end to the high end of the spectrum.
From these responses, it can be deduced that Range controls the Q and Resonance of the Filter. The Range control adds between 6 and 20 dB to the resonant frequency at its lowest and highest settings, respectively. The response from this control is consistent wherever the resonant frequency lies, as shown in this comparison of the two data sets for minimum and maximum Level setting.
Digitization of an analog filter can be completed in several different ways. One way is to back out the filter coefficients from the impulse response of the filter, and interpolate between different filter settings to control the parameters such as Q and resonance. A good reference for this technique is detailed in [2] and [11].
I chose to implement this effect pedal in the Wave-Digital domain. I wanted to the capture the non-linear behavior of the diode envelope detector and the op-amp in the filter structure. Starting with basic circuits outlined in recently published Wave-Digital filtering papers. I used WD building blocks within MATLAB Simulink to emulate their results. The object based coding within Simulink helps to keep track of the topology of the WD structure. I expanded on a library of basic wave digital elements and adaptors [12] throughout my project, adding nonlinear elements, current sources, and diode elements. After getting acquainted with the topological limitations, I designed the binary connection tree structure of a basic low pass and high pass filter structure, comprised of an Ideal Voltage Source, Resistors, and Capacitor.
Decoupling the low and high pass sections allows for independent control of their respective cutoff frequencies. I used the decoupling technique described in “Virtual Analog modeling in the Wave Digital Domain” [3], referred to in the paper as “cross-control’. I cascaded the high and low pass sections to increase the order of the filter and create a smaller Q. This approach worked as detailed in the paper, but the frequency response was not close to the DOD 440’s. This is mainly because the cascaded second order filter is not resonant, so there is no resonant peak and no control over the “range’.
In order to create resonance, I began experimenting wave digital feedback loop design. I fed the high pass BCT output voltage back into a real voltage source with nonlinear resistance, linked in parallel with the input voltage source. The figure below shows the bandpass wave digital filter implementation.
Changing R1 changes the center frequency of the bandpass. An Op-Amp is modeled by taking the voltage across R0, which has a very high resistance value, and then fed into a source voltage.
One issue that arose involved a decreasing gain of the resonance at higher frequencies. Using a trial and error approach, I created a function that compensates for the loss of amplitude as a function of resonant frequency. After many iterations, I retrieved a filter frequency response that matches the DOD across the sweep of the filter, and has the same gain, Q, and resonance characteristics of its analog counterpart.
Once the filter was successfully modeled using Wave Digital Filtering principles (and some generation of nonlinear elements and connections), the next step was to create filter property control. Since the DOD 440 uses a diode to detect the envelope of the signal, a nonlinear element needed to be designed to model the response characteristics of the p-n junction. The equation for an ideal diode is [4]:
Voltage and Current are defined by the incident and reflected waves, b and a, respectively, coming to and from a Wave Digital element:
By substituting (2) into (1) and solving for b, the relationship between incident and reflected waves from a non-linear diode root element is found:
Where W(x) is the lambert function of x. The lambert function is computationally expensive, so an approximate solution is needed in order to make this element practical.
I circumvented the lambert function and its ensuing computational inefficiencies by calculating the equation in the Kirchhoff domain. I did this by creating a nonlinear element, which uses an inverse transform to convert from the WD domain to Kirchhoff variables, computes the Output Current, and then feeds the current back into an Ideal Current Source, which outputs the reflected wave “b”.
A diode detector circuit includes a resistor and capacitor in parallel, which is connected in series to a diode. The diode only lets current flow in one direction (positive), to the RC connection. The voltage across the capacitor is taken as the output of the system. Capacitors dissipate energy over time. If the capacitance is high, the envelope would not decay. If the capacitance is very low, then the voltage out is a perfect match to the envelope of the signal. My alternate approach to computing the incident wave is computationally efficient and sufficient for this application because it has energy dissipation characteristics that are similar to RC diode detector circuits.
Cutoff frequencies within the feedback filter circuit are controlled by the amplitude of the detected envelope from the diode RC circuit. This is done by changing the resistance value of the resistor within the feedback HP filter from 55k ohms to 550 ohms (340 Hz to 3400 Hz).
There are several nonlinear responses to the frequency sweep which need to be compensated for, and all of them must be automatically controlled by the envelope. Make up gain is added to keep a consistent level from 330 Hz to 3400 Hz. I created a function that takes the envelope and outputs a gain that is multiplied into the output of the filter. Here are the responses after normalizing the gain to achieve consistent decibel levels across the span of cutoff frequencies:
The final step in creating the emulation of the DOD 440 was to create controls over the level and range of the effect. Varying the gain of the input signal into the diode detector circuit was the best way to influence the Level parameter.
Level maps the envelope detector output amplitude values between 0 and 1 from arbitrary input signal gains, which corresponds to having between no or full travel from the low and high fundamental frequency. This control can be used to compensate for different input signal volumes. It’s also the main control over the effect’s tonal character, and how the effect will response to different dynamic levels. Here are the simulation results for a constant capacitance with varied Level values:
Range is a parameter that controls cutoff frequency resonance. This is very important as it provides more emphasis at the cutoff frequency, resulting in a pronounced wah effect at higher settings. With no resonant peak, the effect would be subtle, if not indistinguishable.
The resonant peak in my wave digital filter is created mainly by the ratio of input to feedback signal. As the voltage source resistance of the input signal is increased, the feedback becomes more pronounced, and a peak is formed. Therefore, I created the control for the peak by varying the resistance of the non-ideal input voltage source. While this seemed straightforward at first, I found that it was not linear with respect to frequency, so I had to compensate for this change once again by factoring in Range to my feedback voltage signal. Iterating through different order functions and constants landed me at a Range control that is consistent through the frequencies and matches the DOD 440’s response.
Once the main controls of the effect were parameterized, I decided that it’d be useful to add a third parameter that controls the decay rate of the envelope detector.
Decay of the detected envelope can be directly controlled by varying the capacitance value in the parallel RC circuit. At a low setting, the detector output is the envelope of the signal, following drops in signal closely. At higher settings, the capacitor holds more energy over time, with little dissipation after drops of signal. The decay parameter can be used to make the filter hover around a certain range of cutoff frequencies, for example, between 700 and 1000 Hz, rather than drop back down to 340 Hz after a drop in input volume.
The model was tested with sound sources that varied in dynamic range and tonal properties. The model reacts differently depending on the frequency density and dynamic range of the input signal, and can be used to create subtle to extreme effects. A rhythmic guitar sample was used to demonstrate different settings of the wave digital filter model of the DOD 440, for which the output is provided below.
Comparing the analog circuit sample to the digital model, a difference exists with respect to the attack time of the envelope detector. The reference has a slower sweep time up to the cutoff frequency, while the digital model is quick. This may be due to the approximation of the Lambert function. When I ran a simulation using the lambert function, the attack was slower than my Kirchhoff implementation. The frequency characteristics match well, and the overall sound of the effect is very similar to the analog counterpart.
A DOD 440 was analyzed with a logarithmic sine sweep response test to extract the frequency and impulse response of the filter. Digitization of the effect was completed using nonlinear wave digital filter modeling within Matlab. The frequency response of the computational model was verified to match that of the DOD 440 given audio inputs with a variety of dynamic ranges. Parameterization was completed in concurrence with the referenced analog audio effect through control of the wave digital filter resistors and capacitors. Unique approaches to modeling nonlinear wave digital elements, such as a diode and op-amp, were taken and executed successfully to increase computational efficiency. The wave digital DOD 440 envelope filter is a functional model of the original circuit, with a bonus control for extended possibilities.
[1] S. Muller and P. Massarani, “Transfer Function Measurement with Sweeps,” JAES Volume 49 Issue 6 pp. 443-471, June 2001
[2] G. De Sanctis and A. Sarti, “Virtual analog modeling in the wavedigital domain,” IEEE Tran. Audio, Speech, Language Process., vol.18, no. 4, pp. 715–727, 2010.
[3] A. Fettweis, “Wave digital filters: Theory and practice,” Proc. IEEE, vol. 74, no. 2, pp. 270–327, 1986.
[4] R. C. D. Paiva et al., “Emulation of operational amplifiers and diodes in audio distortion circuits,” IEEE Trans. Circuits Syst. II: Expr. Briefs, vol. 59, no. 10, pp. 688–692, 2012.
[5] D. T.-M. Yeh, “Tutorial on wave digital filters,” https://ccrma.stanford.edu/~dtyeh/papers/wdftutorial.pdf, Jan.25 2008.
[6] K. J. Werner et al., “Resolving wave digital filters with multiple/multiport nonlinearities,” in Proc. Int. Conf. Digital Audio Effects (DAFx-15), Trondheim, Norway, Nov. 30 – Dec. 3 2015.
[7] J. O. Smith, “Making virtual electric guitars and associated effects using Faust,” Dec. 2007, http://ccrma.stanford.edu/realsimple/-faust strings/.
[8] V. Välimäki, S. Bilbao, J. O. Smith, J. Abel, J. Pakarinen, and D. Berners, “Virtual analog effects,” in DAFX—Digital Audio Effects, U. Zölzer, Ed., 2nd ed. Wiley, 2011, ch. 12, pp. 473–522.
[9] M. Hammer, “The Technology of Auto-Wahs / Envelope-Controlled Filters,” http://www.geofex.com/article_folders/ecftech/ecftech.htm, 2000.
[10] M. Karjalainen and J. Pakarinen, “Wave digital simulation of a vacuum tube amplifier,” in IEEE Int. Conf. Acoustics, Speech and Signal Process. (ICASSP), 2006, pp. 153–156.
[11] V. Välimäki and A. Huovilainen, “Oscillator and filter algorithms for virtual analog synthesis,” Computer Music Journal, vol. 30, no. 2, pp. 19–31, 2006.
[12] M. Hotz, “A Study of Tube Amplifier Modeling Using Nonlinear Wave Digital Filters,” https://www.spsc.tugraz.at/student_projects/nl-wdf-amp-sim, Mar. 17, 2011.
[13] Oygo Sound LLC, “Swept-Sine Analysis,” http://www.mathworks.com/matlabcentral/fileexchange/29187-swept-sine-analysis, Oct 30, 2010.