A Portion of Buff

Everybody else had one, so...

Keeping it real-time (3)

These late nights are going to catch up with me, but until then...

I've kicked off Noise, an open source project for this managed VST plugin thing I'm working on:

(Last year I was working on an abortive software synthesizer called "Noise!", so it seemed appropriate to recycle the name).

It's obviously quite rough at the moment, but please, if you use any VST-compatible audio software (Cubase, SoundForge, FruityLoops etc), download it, give it a try, and let me know if you had any problems (positive feedback is nice too).  If you don't have a VST host, there's a free one included, so you can still play around if you're interested. 

So far I've got delay, lo/hi-pass filter, gain and reverb plug-ins - the latter being the most fun to do and the most difficult to get my head around.  One thing that struck me tonight was just how incredibly fast computers are.  I know I should be accustomed to that, being a developer, but when you're writing code which applies 12 different filters to 44,100 stereo samples per second, in parallel to a software synthesizer which is generating those 44,100 stereo samples per second with its own oscillators, filters and envelopes, on top of a host application routing all these samples from the synth, through your plugin (via layers of C, Managed C++ and C#) and out to a sound card, and it only takes 3% of available CPU time, it kind of brings it home.

Here's a stereo comb filter:


public class CombFilter
{
    float feedback;

    float damp1;
    float damp2;

    float lastLeftValue;
    float lastRightValue;

    int leftIndex;
    int rightIndex;

    float[] leftBuffer;
    float[] rightBuffer;

    public CombFilter(int leftTuning, int rightTuning, float damp, float feedback)
    {
        this.feedback = feedback;
        this.damp1 = damp;
        this.damp2 = (1 - damp);
        this.leftBuffer = new float[leftTuning];
        this.rightBuffer = new float[rightTuning];
    }

    public float ProcessLeft(float input)
    {
        lastLeftValue = (leftBuffer[leftIndex] * damp2) + (lastLeftValue * damp1);

        leftBuffer[leftIndex] = input + (lastLeftValue * feedback);

        if (++leftIndex >= leftBuffer.Length)
        {
            leftIndex = 0;
        }

        return leftBuffer[leftIndex];
    }

    public float ProcessRight(float input)
    {
        lastRightValue = (rightBuffer[rightIndex] * damp2) + (lastRightValue * damp1);

        rightBuffer[rightIndex] = input + (lastRightValue * feedback);

        if (++rightIndex >= rightBuffer.Length)
        {
            rightIndex = 0;
        }

        return rightBuffer[rightIndex];
    }
}

Comments

Dustin said:

Holy crap. This stuff WAILS!
# March 22, 2005 2:18 PM

Huge dude said:

You know it, cupcake
# March 22, 2005 4:06 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)