A page for the final project write-up for the course MUMT 618 – Computational Modeling of Musical Acoustics.
Virtual analog synthesis uses physical models and algorithms to recreate sounds generated by analog circuitry. Virtual analog runs the gamut of analog musical devices from modeling analog synthesizers, to guitar effect pedals, or even amplifier synthesis. Moog synthesizers were very popular during the 1970s, and there has been a wealth of research into the modeling of the various sounds the synthesizer’s modules could produce. In particular, the Moog low-pass voltage-controlled filter (VCF) has been studied by many researchers attempting to model the filter in discrete time, while still maintaining the many properties in continuous time that made this filter such an integral part of the Moog sound. This project aims to look at the research being done to model the Moog VCF in discrete time and to replicate one of the models using MATLAB.
What is the Moog VCF?
The Moog VCF is a voltage controlled low-pass filter designed by Robert Moog and patented in 1969 . Moog synthesizers were a very common part of electronic music during the 1970s and 1980s. They used subtractive synthesis to create sounds. This means a signal with many harmonics, like a sawtooth wave, is passed through controllable filters to achieve the required timbre. Thus the Moog VCF was an integral part of the Moog sound, as well as being an important feat of electrical engineering. Robert Moog used a unique ladder like structure of transistors to create the filter, giving it the nickname “ladder filter”. This was an innovative analog design for the time.
Figure 1: Circuit diagram for the Moog VCF from original patent 
Figure 2: Block diagram of Moog VCF in continuous time 
The low-pass filter block seen in Figure 1 is actually four stages of low-pass filters. Each transistor pair forms a low-pass filter. However, all stages are tuned to a single cutoff frequency, seen in Figure 2 as G1(s). Part of the “voltage controlled” aspect of the filter is provided by a feedback path. In the circuit this can be seen as a potentiometer in Figure 1, and can been seen in the block diagram as a gain with a variable value of k in Figure 2. Depending on the value of the potentiometer, you could adjust the resonance at the cutoff frequency set for the filter. When the gain in the feedback path is at its lowest setting, the VCF acts like a typical low-pass filter. As the value increases, resonance in the form of “corner peaking” occurs .
Figure 3: Frequency response of Moog VCF for different feedback path gains 
Tim Stilson and Julius Smith performed a thorough analysis of the filter in continuous time in their paper “Analyzing the Moog VCF with considerations for digital implementation” before attempting to discretize the filter. One particularly desirable property they found in their analysis was that if they set the feedback gain (k) to a constant value and swept the cutoff frequency control, the filter exhibited constant quality factor (Q). As well, the control for feedback gain and the control for cutoff frequency were uncoupled, so changing one would not change the other. They sought to preserve these good properties that the filter had in continuous time when they attempted to discretize the filter .
Stilson and Smith model
Stilson and Smith attempted to discretize the transfer function for each low-pass filter section using the Bilinear transform and the Backwards Difference transform. They set out three design goals to meet: that the controls were uncoupled, that the controls changed useful parameters (such as frequency and Q), and that the controls were efficiently implemented without too much computational overhead. The results from the two transformations did not meet their design criteria, mainly due to the addition of a delay term in the feedback loop to help computability. However, when they compared the results of the two filters, they noticed something interesting. For the bilinear transformed filter, Q increased as cutoff frequency increased. For the backwards difference transformed filter, Q fell as cutoff frequency increased. The only fundamental difference between the two was the location of the zeros. The bilinear transformed filter had a zero at z = -1 and the backwards difference transformed filter had a zero at z = 0. They attempted to find a “compromise” between the two which would yield constant Q. They found one that was very close to meeting this requirement which had a zero at z=-0.3 . The following is the transfer function for one low-pass filter section:
Where the following is the overall transfer function of the filter with the feedback loop:
This “compromise” filter met their design requirements to a certain extent. It was then used as the basis for further research by Välimäki and Huovilainen to improve upon the filter.
Välimäki and Huovilainen model
Välimäki and Huovilainen had analyzed the filter further and had developed some adjustments to Stilson and Smith’s compromise filter. This allowed them to more accurately model the Moog VCF. They proposed the following block diagram for each low-pass filter section:
Figure 4: Block diagram for proposed change to each low-pass filter section 
Where the value of g is defined in the paper  as:
As well they proposed the following block diagram as an improved way of modeling the Moog VCF:
Where Gres is defined in the paper  as:
And Cres and Gcomp can be values between 0 and 1. The values A, B, C, D, and E can be used to obtain different filters, such as band-pass and high-pass filters, but in the case of the 4 pole low-pass filter, the values of A, B, C, and D are set to 0 and the value of E is 1. As well, to accurately model the non-linearities in the original Moog VCF, a waveshaper block is added before the input to the first low-pass filter section. This waveshaper can be any “smoothly saturating function”; Välimäki and Huovilainen used a hyperbolic tangent function .
Analysis and results
Välimäki and Huovilainen’s model of the Moog VCF was used as a basis to create a MATLAB implementation of the discretized filter. From the block diagram for each low-pass filter section by Välimäki and Huovilainen in Figure 4, the following difference equation was found:
Using this difference equation, the transfer function was derived, and it was determined that it did in fact maintain the zero at z = -0.3 from the Stilson and Smith compromise filter:
The input to the first low-pass filter was found from the overall block diagram in Figure 5 to be:
From this, the following algorithm was written in MATLAB to determine the output of the filter on a sample by sample basis:
for i = 1:N %Input to first LP filter stage (after waveshaping) input = tanh(x(i) - 4*Gres*(ym1(4) - Gcomp * x(i))); % Send input through 4 stages of LP filtering for n = 1:4 %Output of each stage output = ((glp1*input + glp2*xm1(n) - ym1(n))*g) + ym1(n); xm1(n) = input; %store x[n-1] for each stage ym1(n) = output; %store y[n-1] for each stage input = output; %input to next stage is this stage's output end y(i) = output; end
After writing this code in MATLAB and confirming it gave the desired frequency response, an analysis was performed to determine the effect of the parameters Gcomp, Cres, and fc on the output. To determine the effect of Gcomp, a script was written to plot the frequency response for the filter at five different values of Gcomp between 0 and 1. The value of Cres was set to 0.9 and the cutoff frequency was set to 500 Hz. The following plot was obtained in MATLAB with the GcompEffectPlot.m script:
Figure 6: Frequency response for multiple Gcomp values. fc = 500 Hz Cres = 0.9
From this plot it was clear there was some effect, but it was not very much. The pass-band region was determined to have been effected the greatest by a variation in Gcomp and was magnified in the plot below:
Figure 7: Zoomed in view of pass-band for frequency response in Fig. 6
As can be seen, a higher value of Gcomp reduces the amount of attenuation in the pass-band and keeps the magnitude more or less constant, but seems to have diminishing returns after Gcomp=0.5. The paper recommends to keep the value of Gcomp at 0.5 because it results in “a 6-dB pass-band gain decrease at the maximum resonance” , so for the rest of the scripts it will remain at a value of 0.5.
Then, a script was written to plot the frequency response for the filter at five different values of Cres between 0 and 1 to see its effect on the filter. The value of Gcomp was set to 0.5 and the cutoff frequency value was set to 500 Hz. The following plot was obtained in MATLAB with the CresEffectPlot.m script:
Figure 8: Frequency response for multiple values of Cres. fc = 500 Hz Gcomp= 0.5
As can be seen from the above figure, the value of Cres controls the amount of resonance that occurs at the cutoff frequency. A value of 0 provides a typical low-pass response without any corner peaking at the cutoff frequency. As Cres increases, the peak becomes more pronounced. However, a value of Cres = 1.0 does not produce a typical attenuation of the frequencies above the cutoff. It was determined that a value of 0.9 would produce a good amount of resonance, while still keeping the typical attenuation of high frequencies.
Then, a script was written to plot the frequency response for the filter at five different values of cutoff frequencies between 250 and 1500 Hz to see if it would move the cutoff frequencies correctly. The value of Gcomp was set to 0.5 and the value of Cres was set to 0.9, as established by the previous analyses. The following plot was obtained in MATLAB with the fcEffectPlot.m script:
Figure 9: Frequency response for multiple values of fc Cres = 0.9 Gcomp= 0.5
From this graph, it can be seen that it did indeed move the cutoff frequency as assumed. Peaks in Fig. 9 were found with the Data Cursor tool in MATLAB at: 242.6 Hz, 485.2 Hz, 974.8 Hz, 1182 Hz, and 1473 Hz. This means the maximum amount of resonance is provided at slightly below the specified cutoff frequency, but they are within an acceptable limit.
After analyzing the effects of the frequency response graphically, the filter was tested on audio. Thanks to Pekonen et al., it was possible to pass recordings of the sawtooth waveform from an original Moog oscillator . To download the recordings, see the companion website for the paper and download the reference recordings they have.
Firstly, a recording of the waveform at a fundamental frequency of 495.44 Hz was passed through the discretized Moog lowpass VCF model at several different cutoff frequencies. The following audio file was generated using the MATLAB script fcSweep.m. The audio contains the original waveform, then the filtered waveforms at 1500 Hz, 1200 Hz, 1000 Hz, 500 Hz and finally 250 Hz.
From the audio, it can be heard that the higher harmonics of the original waveform are actually filtered out by this filter model. As the cutoff frequency decreases, the tone starts sounding more and more like a pure sinusoidal tone, especially when it reaches a cutoff frequency close to the fundamental.
Changing the resonance constant and its impact on the audio was also examined. The
following audio file was generated using the MATLAB script CresSweep.m, which takes in
an audio recording of the Moog sawtooth waveform at 495.44 Hz and passes it through
the Moog lowpass VCF model at different values for resonance constant
(Cres). A constant cutoff frequency of 500 Hz was chosen. The audio contains the original waveform and the filtered waveform at Cres values of 0, 0.2, 0.5, 0.8, and 1.
From the audio, it can be heard that increasing the Cres value seems to provide more energy to the fundamental frequency, which gives a fuller, more pleasing tone.Finally the response of sawtooth waveforms with different fundamental frequencies as they pass through the Moog lowpass VCF model was examined. The following audio file was generated using the MATLAB script InputFreqSweep.m that takes in several audio recordings of Moog sawtooth waveforms and passes it through the Moog lowpass VCF model at a cutoff frequency of 1000 Hz. The audio contains filtered tones that were originally sawtooth waves with fundamental frequencies at: 98.10 Hz, 220.62 Hz, 495.44 Hz, 1.049 kHz, 2.096 kHz, and 6.256 kHz.
The audio generated behaved as expected. The harmonics above 1000 Hz are effectively attenuated, because the sounds produced are a lot less grating than your typical sawtooth waveform. The lower frequency waveforms produced more interesting timbres than the ones near the resonant frequency, but this is because they have several harmonics, where as the waveform near the cutoff effectively only has the fundamental.
The ultimate test to see if this is an effective model would be to compare the generated waveforms with actual recorded waveforms of the Moog lowpass VCF with similar settings. Unfortunately, recordings like this are not widely available and access to a Moog synthesizer or recording equipment necessary to produce this was unavailable. This is an area where more study would be required. Further improvements to this would be to implement a real time version of this model, as well as model other components of a Moog synthesizer, to provide a real time virtual analog synthesizer in a software environment.
In conclusion, an implementation of Välimäki and Huovilainen’s model of the Moog lowpass VCF was made using MATLAB. The implementation produced frequency responses that were as expected and that were quite similar to what the literature has shown about the Moog lowpass VCF in continuous time. This was shown both graphically and with audio examples. To really test the capabilities of this implementation, a comparison between an actual recording from a Moog synthesizer and the model’s output would be necessary. Further study would be require to complete this task.
 Robert Moog, “Electronic High-pass and Low-pass Filters Employing the Base-to-Emitter Resistance of Bipolar Transistors,” U.S. Patent 3,475,623, October 28, 1969
 T. Stilson and J. O. Smith, “Analyzing the Moog VCF with considerations for digital implementation,” in Proceedings of the International Computer Music Conference, pp. 398–401, Hong Kong, China, August 1996.
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.
 J. Pekonen, V. Lazzarini, J. Timoney, J. Kleimola, and V. Välimäki, “Discrete-time modelling of the Moog sawtooth oscillator waveform,” EURASIP Journal on Advances in Signal Processing, 2011.