Hi, has anyone successfully integrated the Bungee pitch shifter library into their JUCE project? They provided a working example, but it’s for a command line case. I’ve tried to make it work, but there’s no output audio:
auto buffer = bufferToFill.buffer;
auto sampleCount = buffer->getNumSamples();
auto writePtr = buffer->getArrayOfWritePointers();
auto readPtr = buffer->getArrayOfReadPointers();
auto pushFrameCount = processSpec->maximumBlockSize;
InputChunk inputChunk = stretcher1->specifyGrain(stretcherRequest);
Push::InputBuffer pushInputBuffer(stretcher1->maxInputFrameCount() + pushFrameCount, processSpec->numChannels);
pushInputBuffer.grain(inputChunk);
int position = 0;
while (position < sampleCount)
{
// Get the next block of audio
mixerSource.getNextAudioBlock(bufferToFill);
// Copy data to pushInputBuffer
int framesToCopy = std::min(static_cast<int>(pushFrameCount), sampleCount - position);
float* inputData = pushInputBuffer.inputData();
for (int c = 0; c < processSpec->numChannels; ++c)
{
for (int i = 0; i < framesToCopy; ++i)
{
inputData[c * pushInputBuffer.stride() + i] = readPtr[c][position + i];
}
}
// Deliver the input frames
pushInputBuffer.deliver(framesToCopy);
// Process available input
while (pushInputBuffer.inputFrameCountRequired() <= 0)
{
stretcher1->analyseGrain(pushInputBuffer.outputData(), pushInputBuffer.stride());
OutputChunk outputChunk;
stretcher1->synthesiseGrain(outputChunk);
stretcher1->next(stretcherRequest);
// Write the output chunk to your buffer
for (int c = 0; c < processSpec->numChannels; ++c)
{
for (int i = 0; i < outputChunk.frameCount && position + i < sampleCount; ++i)
{
writePtr[c][position + i] = outputChunk.data[c * outputChunk.channelStride + i];
}
}
position += outputChunk.frameCount;
inputChunk = stretcher1->specifyGrain(stretcherRequest);
pushInputBuffer.grain(inputChunk);
}
}
Appreciate any help. Thanks
