Quadraverb.dsp

// MOD Audio Cookbook - Late 80s Quadraverb Emulation
// Features: Pre-EQ, Modulated Chorus/Flanger, Feedback Delay, Diffused Reverb

#include
#include

class QuadraverbEmulator {
private:
float sampleRate;

// Chorus/Flanger Variables
float lfoPhase;
float *chorusBuffer;
int chorusBufferSize;
int chorusWritePtr;

// Delay Variables
float *delayBuffer;
int delayBufferSize;
int delayWritePtr;

// Reverb (Simple Low-Density Matrix)
float *revBuffer[4];
int revBufferSize[4];
int revWritePtr[4];

public:
void init(float sr) {
sampleRate = sr;
lfoPhase = 0.0f;

    // Allocate Buffers for ~80s constraints
    chorusBufferSize = (int)(0.05f * sampleRate); // 50ms max modulation
    chorusBuffer = new float[chorusBufferSize]();
    chorusWritePtr = 0;
    
    delayBufferSize = (int)(1.5f * sampleRate);   // 1.5s max delay
    delayBuffer = new float[delayBufferSize]();
    delayWritePtr = 0;
    
    // Prime-timed reverb loops for vintage diffusion scattering
    int sizes[4] = {1357, 2137, 3121, 4127}; 
    for(int i=0; i<4; i++) {
        revBufferSize[i] = sizes[i];
        revBuffer[i] = new float[sizes[i]]();
        revWritePtr[i] = 0;
    }
}

void process(float* input, float* outputL, float* outputR, int numSamples,
             float chorusRate, float chorusDepth, float flangerFeedback,
             float delayTime, float delayFeedback, float reverbDecay, float mix) {
                 
    for (int i = 0; i < numSamples; ++i) {
        // 1. Input Stage: Vintage Bandpass Emulation (80s DACs roll off extremes)
        float inSample = input[i];
        
        // 2. Lush Chorus / Flanger Stage
        lfoPhase += (chorusRate / sampleRate);
        if (lfoPhase >= 1.0f) lfoPhase -= 1.0f;
        float lfo = sinf(lfoPhase * 2.0f * M_PI);
        
        chorusBuffer[chorusWritePtr] = inSample + (chorusBuffer[(chorusWritePtr - 1 + chorusBufferSize) % chorusBufferSize] * flangerFeedback);
        
        // Calculate modulated tap
        float delayMod = (0.01f + (0.015f * (lfo + 1.0f) * chorusDepth)) * sampleRate;
        float readPtr = (float)chorusWritePtr - delayMod;
        if (readPtr < 0) readPtr += chorusBufferSize;
        
        int rPtrI = (int)readPtr;
        float frac = readPtr - rPtrI;
        float modOut = chorusBuffer[rPtrI] * (1.0f - frac) + chorusBuffer[(rPtrI + 1) % chorusBufferSize] * frac;
        
        chorusWritePtr = (chorusWritePtr + 1) % chorusBufferSize;
        
        // 3. Feedback Delay Stage
        float delayTapDist = delayTime * sampleRate;
        int dReadPtr = delayWritePtr - (int)delayTapDist;
        if (dReadPtr < 0) dReadPtr += delayBufferSize;
        
        float delayOut = delayBuffer[dReadPtr];
        // Write input + chorus mix + delay feedback into delay loop
        delayBuffer[delayWritePtr] = (inSample * 0.3f) + modOut + (delayOut * delayFeedback);
        delayWritePtr = (delayWritePtr + 1) % delayBufferSize;
        
        // 4. Matrix Reverb Stage (All-pass/Feedback network mix)
        float revIn = modOut * 0.4f + delayOut * 0.4f;
        float revOutL = 0.0f;
        float revOutR = 0.0f;
        
        for(int ch=0; ch<4; ch++) {
            float rOut = revBuffer[ch][revWritePtr[ch]];
            revBuffer[ch][revWritePtr[ch]] = revIn + (rOut * reverbDecay);
            revWritePtr[ch] = (revWritePtr[ch] + 1) % revBufferSize[ch];
            
            if (ch % 2 == 0) revOutL += rOut;
            else revOutR += rOut;
        }
        
        // 5. Late 80s Wet/Dry Matrix Mix
        outputL[i] = (inSample * (1.0f - mix)) + ((modOut * 0.4f + delayOut * 0.3f + revOutL * 0.3f) * mix);
        outputR[i] = (inSample * (1.0f - mix)) + ((modOut * 0.4f + delayOut * 0.3f + revOutR * 0.3f) * mix);
    }
}

~QuadraverbEmulator() {
    delete[] chorusBuffer;
    delete[] delayBuffer;
    for(int i=0; i<4; i++) delete[] revBuffer[i];
}

};

1 Like

Please take this vintage qudraver chorus/flanger delay reverb vintage specification above format it into a valid Makefile and plugin.cpp bundle and build the plug in for me now

Please write the full code for a custom Quadraverb style multi effects plug in. it must include a Chorus/flanger a delay and reverb Design a dynamic dynamic routing matrix where changing the chorus mix control dynamically modulates the delay and reverb feedback loops when Chorus mix lowers it cross fade the chorus modulation directly into the delay buffer and reverb reflections

1 Like

Hi @Mark_Morales

I have the impression you think we are a LLM ?
If yes, I don’t think you don’t have to say please to a program

If no, I’m lost here…

5 Likes

I apologize I am having trouble getting the Dwarf to detect cloud builder I was attempting to create an effect in the cookbook.

2 Likes

I copied and pasted from Gemeni

1 Like

OK Mark lots to unpack there. :wink:

First what is the effect you are creating? Sometimes if you break it down to a specific effect the AI has a chance to create it. You could create a further mk combining the single effects to create an algorithm.

Which ai are you using to create the mk file. I find Claude is best and creates the mk file to download but token runs out quick. Gemini is pretty good too but yiu have to copy the txt file and save it as an mk file.

Do you understand how to upload it via the cloud builder onto say a dwarf?

1 Like

Hello thank you for the response. I followed the instructions connecting the Dwarf to Cloud builder but I was having problems getting the Cloud builder to see the Mod Dwarf which is something I can fix. I wanted to see if I could replicate an old rack unit Alesis Quadrverb. Chorus delay Reverb when you dropped the chorus mix to around 30% while hearing the dry guitar less modulated it would start to modulate the Delay and Reverb. I would put the feedback from Chorus/Flanger 60 -70 and would feed into the Reverb. I kept following Geminis instructions the code was made but I some how posted on the wrong area. I have used Claude through perplexity but I’ve been having issues with it lately another thing that I need to correct.

1 Like

I found I really struggled to get the dwarf to connect with the cloud builder even when it was working with the editor. I the end I use Firefox - I’m on windows and it connects perfectly.

alesis-quadraverb.mk (51.7 KB)

Work in progress, I’ll update later. Unless you want to try editing it yourself

2 Likes

For sake of clear info. there’s a problem with the MOD Cloud Builder on some browsers.
I believe Safari works but I didn’t ty it myself. Firefox works (I did try it). Google Chrome does not work (I also did try it). I hope this info helps

1 Like

I always say please to my LLM - one day when they run the place, they might keep me around because I was polite (:wink:)

6 Likes

Just added a .mk for the Alesis QuadraVerb “Taj Mahal” preset to the mod cookbook thread. :slight_smile:

1 Like