Audio DSP as VST plug-ins
I've recrafted some of my older audio DSP work in VST format so you can use the effects within popular recording software. Most products support VST plug-ins these days, it's become something of a de facto standard for audio. Below I've got a guitar processor, a phase shifter, chorus, doppler pitch shifter, FFT pitch shifter, and flange effects implemented.
You can either download the .dll files directly and use them with your recording software by putting them in the appropriate directory that is scanned on startup, or you can grab the source code and play with them yourself. To use the source code you'll need to first get the Steinberg 2.4 VST SDK and install that. Then just drop the projects files into directories at the same level as the SDK top dir and you should be able to build 'em. I used Niall's Pedal Board for a test host. After building, copy to the Niall's directory and start the pedal board host. You can then attach Visual Studio to the running pedal board process for debugging. Oh, and of course you'll need the appropriate Visual Studio redist DLLs which can be found on MSDN.
This implements a one-knob guitar processor. It actually morphs thru a number of presets but it uses a single knob so you don't have to think. It progresses more or less from clean to dirty with in between positions where you get the classic glassy compressed clean sound, medium cruch for rhythm, or further along the high gain metal sounds.
The processor is composed of a several sub-modules: a limiter/gate, a 12db/octave high boost, distortion, a phaser, and a chorus. The ordering of the effects is a little unusual as I enjoy the sound of a phaser driving the distortion--the phasing sound almost disappears and it just turns more into a chewy movement in the distortion. The chorus is used on the output to make the distortion sound a bit juicier and mellower.
This implements a simple all pass filter bank and allows you to select basic phase shifting parameters. You can select from 2-10 sections of all pass and control speed, depth, and feedback. There are also some mix options that might be useful with recording software.
Phase shifting uses an interesting type of filter called an all-pass filter. As the name implies, this type of filter passes all frequencies, but instead "filters" the phase of the signal. While its frequency response is a straight line, its phase response varies by 180 degrees with a 90 degree phase shift at what would traditionally be considered the cutoff frequency of a normal filter.
The normalized transfer function of a first order all-pass filter is:
s - 1 H(s) = ----- s + 1
Using a bilinear z-transform (BZT) method, we arrive at a difference equation of:
y(n) = A * x(n) + A * y(n-1) - x(n-1)
Where the coefficient A is described by:
1 - wp A = ------ 1 + wpand:
wp = (PI * freq) / Fs Fs = sampling rateThe phase shifting effect is then implemented by cascading several such all-pass filter sections and sweeping their cutoff frequencies in unison. Mixing this processed signal with the original signal results in the notching effect as the total phase delay through the filter sections causes certain frequencies to cancel. Like flanging, the effect can be varied by providing a feedback path around the filter sections, and by providing for inverting the processed signal and the feedback.
A smooth sweep function is important; the frequencies of the filters should be changed exponentially over time. This is easily accomplished using floating point in C, but in an assembly version we'd probably use a piece-wise linear approximation of the desired function.
This implements a simple chorus and is about like every other chorus out there except for the fact this has mix options to spread the dry/wet signal in stereo the way I like.
Again, a simple flanger but with a few minor tweaks that make me happy. It can sweep to zero to simulate that cross-over flange sound, and setting the mix mode to "mono minus" or "stereo minus" and turning the feedback up gets a very fun effect. The delay and mix inputs are conditioned so the effect can be driven from automation with no clicks. This allows you to use your DAW to drive the effect and control its blend.
fft pitch shifter
This is a quickie whack at doing an FFT-based pitch shift. It's less warbly than the doppler approach below.
doppler pitch shifter
This was my take on pitch shifting back before CPUs were fast enough. Been supplanted by FFT approaches but this is still nice for smaller shifts.