Panning of individual oscillators


#1

I was watching a video yesterday I haven’t watched in a while https://www.youtube.com/watch?v=_O1jev8JolE&feature=share. It made me realize panning individual oscillators in the stereo field is a great idea rather than the entire instrument.

I’m not sure if this is possible as synthVoice is adding the sample to the buffer. I can definitely see creating a proper panning knob for a master pan effect.

This is a great idea to incorporate into future synths if possible, until I figure this out i’m stuck routing individual oscillators to a single channel in Ableton. :cowboy_hat_face:


#2

It’s certainly possible but you will have to implement it so that it doesn’t interfere with the existing contents of the voice summing buffer. So you will need an additional work buffer per voice (if your panning algorithm works only with buffers) or you need to do the panning sample by sample.


#3

Well, a SynthesizerVoice gets an AudioBuffer<float> via the renderNextBlock(...) method. And that buffer can be multichannel. So it’s up to the Voice itself how to do the panning of its Oscillators (in case it’s additive synthesis).

BTW: What the Ableton 9 Widget does is called Balance, not stereo panning.


#4

Yeah that’s what this video discusses creating a true panning knob. I think you would have to call left and right channel buffer in process block though.


#5

The processor process block was not allowing me to pass buffer.getWritePointer(0) or buffer.getWritePointer(1), only buffer.


#6

Do you want to pan the single voices separately or single oscillators within a single voice?
For both applications, passing a stereo buffer should be sufficient.

If you want to pass single channels you can create a new AudioBuffer using the existing channel data:
AudioBuffer (Type *const *dataToReferTo, int numChannelsToUse, int numSamples):
https://docs.juce.com/master/classAudioBuffer.html#ada2cf3f1e306a207f3d689d37192b823


#7

Still investigating, but I wanted to share as I have never seen a synth with panning of oscillator ability, I was thinking this has great potential. Just turned on the computer today.

void SynthVoice::renderNextBlock (AudioBuffer &outputBuffer, int startSample, int numSamples)
{
for (int sample = 0; sample < numSamples; ++sample)
{
for (int channel = 0; channel < outputBuffer.getNumChannels() - 1; ++channel)
{
outputBuffer.addSample(channel, startSample, (setEnvelopeParameters() * 0.3f) * setOscOneToggleState() * setOscOneVolume() * velocityLevel);
}

    for (int channel = 1; channel < outputBuffer.getNumChannels(); ++channel)
    {
        outputBuffer.addSample(channel, startSample, (setEnvelopeParameters() * 0.3f) * setOscOneToggleState() * setOscOneVolume() * velocityLevel);
    }
    
    ++startSample;
}

}


#8

I was indeed able to create panning of oscillators with ease, however applying delay to individual oscillators is giving me some grief, getting some nasty sounds.