Audio drops while updating parameters binaural audio player

I’m trying to build a binaural audio player but I’m having problems with the GUI, when I start move parameters I start hearing ‘clicks’ in the audio. I’m not sure why. I have a component and inside it I have an object that is derived from an AudioIODeviceCallback. I’m changing the parameters from the component with setters, and when I do that I start to hear clicks. All is built as a stand alone app. Please help. Here are parts of the code and here is the github repo if you are interested:

class MainContentComponent : public Component,
public ButtonListener,
public SliderListener
BinauralAudioPlayer audioPlayer;

void MainContentComponent::sliderValueChanged (Slider* sliderThatWasMoved)
if (sliderThatWasMoved == azimuthSlider)
else if (sliderThatWasMoved == elevationSlider)


class BinauralAudioPlayer : public AudioIODeviceCallback

int azimuth;
int elevation;


void BinauralAudioPlayer::audioDeviceIOCallback()
AudioSampleBuffer outputBuffer (outputChannelData, totalNumOutputChannels, numSamples);

AudioSourceChannelInfo info;
info.buffer = &outputBuffer;
info.startSample = 0;
info.numSamples = numSamples;
transportSource.getNextAudioBlock (info);

if (transportSource.isPlaying())
    hrir.update(azimuth, elevation);
    convolverLeft.process(outputChannelData[0], convolutionResult, numSamples);
    for (int i = 0; i < numSamples; i++)
        outputChannelData[0][i] = convolutionResult[i];
    convolverRight.process(outputChannelData[1], convolutionResult, numSamples);
    for (int i = 0; i < numSamples; i++) {
        outputChannelData[1][i] = convolutionResult[i];           


Are the parameter values being smoothed? Clicks are a very common symptom of parameter values changing to quickly. Try the LinearSmoothedValue class in JUCE.

1 Like

Thanks a lot Fabian!!! I’m going to try this