VST Pitch Plugin Crash


first i have to say that i just started programming vst plugins using juce and that i am new here in the forum.

Well, i tried to make a pitch shift plugin with 3 bands (one original and two  filtered that should be pitched).

My problem know is, that compiling works, but when i put my dll in audacity and start the plugin it crashes when i want to use it on a audio track.
I would be very glad if someone could help me :)

Kind regards, flat

Here is the part of the audioprocessing:

void PitchShiftingAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
    for (int channel = 0; channel < getNumInputChannels(); ++channel)
    int numSamples = buffer.getNumSamples();

    AudioSampleBuffer buffer0 = buffer; //original
    AudioSampleBuffer buffer1 = AudioSampleBuffer(1,numSamples);
    AudioSampleBuffer buffer2 = AudioSampleBuffer(1,numSamples);
    float* in_0 = buffer0.getSampleData(0, 0);    
    float* in_1 = buffer1.getSampleData(0, 0);
    float* in_2 = buffer2.getSampleData(0, 0);
    //filter_1->processSamples(in_1, numSamples);
    //filter_2->processSamples(in_2, numSamples);
    processor_0->putSamples(in_0, numSamples);
    processor_0->receiveSamples(in_0, numSamples);
    processor_1->putSamples(in_1, numSamples);
    processor_1->receiveSamples(in_1, numSamples);
    processor_2->putSamples(in_2, numSamples);
    processor_2->receiveSamples(in_2, numSamples);
    buffer0.applyGain (0, 0, buffer0.getNumSamples(), gain0); 
    buffer1.applyGain (0, 0, buffer1.getNumSamples(), gain1); 
    buffer2.applyGain (0, 0, buffer2.getNumSamples(), gain2);
    buffer.applyGain (0, 0, buffer.getNumSamples(), gain);

    // In case we have more outputs than inputs, we'll clear any output
    // channels that didn't contain input data, (because these aren't
    // guaranteed to be empty - they may contain garbage).
    for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
        buffer.clear (i, 0, buffer.getNumSamples());

Why not run it through the debugger to see what the problem is?


Thank you!
I will have a try.

So, i run the DUnit test framework...
The problem seems to be the Process Replacing.

I think its a problem with the buffer but i dont know exactly how to fix it.

Would be nice if someone can help me to find a way :) Thank you


Unless you learn to debug your own code, your career as a developer is going to be short and painful.

Well i spend some time finding a solution and the problem seems to be how i handle the soundtouch library.

I use 
"processor_0->putSamples(in_0, numSamples);"

to feed the algorithm with samples and receive them afterwards:

processor_0->receiveSamples(in_0, numSamples);


The problem is here, i think, that i dont get as many samples out as i put in.

Would it solve my problem when i define another buffer inside the process block? And how would it make sense to implement it?

Thank you so far!

I experimented a bit with soundtouch for PitchedDelay and I think I needed a FIFO with about 8000 samples latency to avoid running out of output which isn’t very useful for real time processing.

In the end I used Dirac LE (only mono & 44.1/48 kHz) and a modification of mda’s detune (which by itself tunes up and down at the same time).

You can have a look at my implementations here. pitchshifter.h/cpp is the Dirac one and simpledetune.h/cpp the detune modification.