Resampling AudioProcessor


#1

Hi All,

I am writing my JUCE app using AudioProcessosor and Graphs due to flexibility of routing the audio within the graph (I need parallel sends etc.. within the graph).

One thing I need is to be able to vary the speed of the audio played through the graph/processor (adjustable while playing). 

Now I can do this successfully using ResamplingAudioSource and it works well, but how can I port this over to a Processor architecture? 

I tried porting the ResamplingAudioSource code into a AudioProcessor and it give distorted sound that kindof chaged pitch when ratio changed.... I am guessing because with a Processor the input and output sample rate should be the same...

Another thing I tried was to wrap the ResamplingAudioSource in a Processor but that failed miserably and produced tonal wierdness....

Any help appreciated...

Thanks,

 


#2

Might be worth double checking the parameters for prepareToPlay.  They are flipped between an AudioSource and AudioProcessor.


#3

 

 

I'd recommend checking out the code in the ResamplingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& info) method.

You can copy that to an AudioProcessors::processBlock() method, and just go from there.

 


#4

Thanks, Graeme; I did note the arse-about-ness off these parameters.. they look ok.

Aaron; that is the approach that I am taking and where I am having these distorted issues.... have you actually got this working yourself? If so any chance you could post or pm and example?

 

I think the problem may be more fundamental to AudioProcessors, and to do with the fixed number of samples that AudioProcessor uses in the graph flow (ie; "buffer.setSize" only makes a difference locally in the processBlock, and not passed out externally) ... where as AudioSource can pull as many samples from the input source as it likes... 

Thanks.