back to denniscronin.net

Audio DSP as VST plug-ins

I've recrafted some of my older audio DSP work and added a few new ones in the 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 a flanger implemented.

notes

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 project files into directories at the right relative level to 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.

All demos are on an older Tele except the guitar pre one which needed a quieter pickup so it's done with an HSS strat. Also, I obviously put zero time into UI.

guitar

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 crunch 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 and to provide a wide stereo image.

aguitar.dll ready-to-use binary
guitar.zip source code VS project
Demo clip - noodling while SONAR automation slowly sweeps the preamp through its tone range

phase shifter

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 + wp
and:
        wp = (PI * freq) / Fs
        Fs = sampling rate    
The 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.

aphaser.dll ready-to-use binary
aphaser.zip source code VS project
Phaser Demo - down by the open strings

chorus

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.

achorus.dll ready-to-use binary
achorus.zip source code VS project
Chorus Demo - jangly 80s

flange

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.

aflange.dll ready-to-use binary
aflange.zip source code VS project
Flange Demo - crunchy chords thru an out-of-phase mix

fft pitch shifter

This is a quickie whack at doing an FFT-based pitch shift. It's less warbly than the doppler approach below.

afftpitch.dll ready-to-use binary
fftpitch.zip source code VS project

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.

apitch.dll ready-to-use binary
apitch.zip source code VS project

the demo guitars

For what it's worth, here are the guitars used in the demo. They were run direct except for the 'flange' demo where the Tele was run first thru a Tube Screamer distortion pedal.




back to denniscronin.net
old DDJ article