how to analyze an auto-wah effect

Started by Dimitree, September 29, 2014, 04:38:57 PM

Previous topic - Next topic

Dimitree

hi everyone,
I'd like to analyze a digital auto-wah (envelope filter) in order to understand its basics characteristics: ADSR shape/times, cutoff freq., resonance and Q shapes, etc..
So I don't want to perform a circuit analysis (it's digital..so..), rather I'd like to know if there are common technics to perform signal analysis using a signal generator and an oscilloscope (I have both, audio range only).
Can it be done?

Digital Larry

#1
I have just made some updates to my program "SpinCAD Designer" to allow easy creation of auto-wah programs for the Spin FV-1.  I'll tell you what I learned, some of which was from studying patches offered up by Spin themselves.

#1 The envelope signal probably wants to be a fast attack-slow release kind of thing.  The individual sections are created by low pass filters which smooth out the rectified audio.  In the design I'm using now, the attack filter precedes the decay filter.  There is no sustain or release.  The envelope is created by taking the maximum of either the attack or decay filter output.  Since the decay hangs on the end of the attack, it will be at best, the same speed, but generally it is slower.  So on the way up, the envelope tracks the attack filter, and on the way down, it tracks the decay filter.  If the decay and attack are set too fast, then you get filter frequency modulation at audio frequencies, which sounds pretty bad.

#2 The filter code has a control input for adjusting the frequency in real time.  I don't know the math function which maps this number to the filter frequency - I just tweak it by ear.  But the envelope signal needs to be adjusted prior to coming into this control, to keep it within the desired limits.  Again I do this by ear.  On the FV-1 this is done with the scale/offset instruction.  offset sets the lower limit and scale sets the width of the sweep.

#3 You can also impose curves/tapers on the control signal by using a power() or other function - does it just go up linearly, or does it go up suddenly and then taper off, or does it go up gradually and then jump up towards the end?  Each has its own sound.

#4 I used Audacity to make a multi-toned WAV file with bursts of around 200 msec at a bunch of logarithmically spaced frequencies.  My program lets you simulate the algorithm on your PC or Mac along with a log level display, so you can get a sense of where the peak is, although of course I generally turn off the envelope sensitivity to do this.

What implementation are you using to make this filter (chip/code)?
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

Digital Larry

#2
I also wanted to mention that I occasionally route things like control signals to the audio outputs temporarily so I can see what they are doing.

After reading your post again, I get the impression that you don't have access to the internals of the code - you're just trying to measure it as a black box.  That's gonna be a little more tricky.  I think all you will be able to do is to measure the frequency response of the filter when it is NOT moving, so you'd need to turn the sensitivity all the way down.  Then if there are other controls, you can use the multi-tone WAV file method I mentioned to get some idea of where the peak frequency is for different settings of those controls.
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

Dimitree

ok I tried to inject some white noise on the input and measure/observe results.. I discovered many things, like frequency cutoff and attack/release times.
But now how can I measure how many poles the filter is made of? and what about the resonance Q amount?

Digital Larry

OK,  far away from the resonant frequency, the roll-off slope of the filter will be -6dB/octave for each pole.  For example if you have a low pass filter, and above the cutoff frequency, the response goes down by -24 dB when you double the frequency, then it's a four-pole filter.

The "Q" factor can be determined by reading this useful article:

http://en.wikipedia.org/wiki/Q_factor
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

SISKO

Quote from: Dimitree on October 01, 2014, 02:21:47 PM
ok I tried to inject some white noise on the input and measure/observe results.. I discovered many things, like frequency cutoff and attack/release times.
But now how can I measure how many poles the filter is made of? and what about the resonance Q amount?

We need more information in order to help you further, like whats the control are? Inputs?Outputs?

If you could dissable the envelope detector, you could measure its step response and that could give you enough information to estimate how many poles it has.

2nd  order and 4th order (moog) filters are the most used topolgy. Maybe biquad.
--Is there any body out there??--

Transmogrifox

Probably the best things would be to characterize its step response at high and low cutoffs.

For low cutoff, apply a low-amplitude step and you'll get its step response.  You can get anything you need from its step response in terms of how many poles, cut-off frequency, and Q.

Then to get its high-end step response, force it high by application of high-amplitude white noise followed by long enough period of silence to wait for filter response tail to be substantially damped, then apply a step response.  You should be able to see if there was a change in Q at the high end. 

Once you have identified the extremes, then you can measure various points along the middle to interpolate an input power vs Fc curve.  It may warble a little bit, but unlikely much over the time period of its impulse/step response.

If you save the step response to a CSV output format, you can import it into a program such as MatLab (or the free gnu Octave, or SciLab).  From there, window the step response, take the derivative (x[n]-x[n-1]) and perform an FFT, plot magnitude response (sqrt(real^2 + imaginary^2)).

Here is some help on the relationship between impulse response and step response:
http://www.swarthmore.edu/NatSci/echeeve1/Class/e12/Lectures/ImpulseConvolution/ImpulseResponse.html

Once you have the magnitude response of the impulse response, you can easily see visually how many poles by counting off the slope in dB/octave.  The Q will also be apparent.

In fact, you could probably do all of this with a computer and Audacity as DigitalLarry suggested.  You can generate the test signal and measure all at once. 

I think the main gotcha with the computer is that the response to the step function will reflect the frequency response throughout your whole system (D/A, cables, auto-wah, cables,A/D).  We assume everything interesting will occur at less than say, 10 kHz, so I expect the result will be accurate enough for your purposes.

Even better, Audacity has the spectral analysis utility built-in, so you can simply apply a derivative filter in the form of a plugin (there has got to be a simple derivative among the free plugins), draw a window of the recorded step (now impulse response) and use the graph in Audacity to do the same analysis.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

Transmogrifox

Follow-up Notes:
Q = Fc/BW
Fc : Center (resonance) frequency
BW : Bandwidth measured as Fhigh - Flow,
Flow, Fhigh : Frequency at which magnitude is Fc peak - 3dB.  This is assuming a bandpass or relatively high-Q filter.  It is hard to measure this on a low Q filter, but I don't think you'll have that problem.

1rst-order filter = 6 dB/Octave
2nd order bandpass will have 6 dB/Octave slope on high and low. 
If you see a symmetrical 12 dB/Octave roll-off on each side, high to low, then it is a 4rth order bandpass filter.

Basically sum the rising and falling slopes in dB/Octave, then divide by 6 to get the filter order.  There are holes in this visual inspection method when the filter topology is not straight-forward, but I assume a simple digital auto-wah will have a simple filter implementation.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

Dimitree

thank you it's a great help.. I'm reading it more than once to understand correctly.
One thing that is not clear to me is: what kind of test signal should I generate?

Transmogrifox

For the envelope filter on its low range, the test signal should be a low-frequency square wave with a period of probably a few hertz -- long enough for the impulse response of the filter to decay into the noise floor before the next square wave cycle begins.  You'll probably want to tweak it interactively looking at the output on the scope -- you don't want it to have a large enough amplitude to have much effect on the envelope detector, and you want it slow enough to emulate a step function.  A theoretical step function is a change from 0V to 1.0V at time = 0, and stays at 1.0V forever.  You are emulating this with a square wave with such low frequency that the salient features of the step response are long decayed before starting a new step.

For envelope filter response in the high range, the test signal should be a strong burst of white noise to drive the envelope detector to its maximum.  Then the noise will be silenced just long enough for the filter response to decay, then you apply the square pulse.  In this case you're attempting to capture this step response while the envelope detector is still maxed out, so the idea is to apply a high amplitude signal to drive it up there, then try to get a step response measurement before it moves very much.  I anticipate this will be fast, like 10 cycles @ 2kHz (5ms) break between shutting off the noise and turning on the pulse.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.