First time here? Check out the FAQ!

Stereo Spread

+1 vote

Thanks a lot for your answers, all of you !

Here's another question: now that my supersaw is up and running with a proper detune,
how can i implement a basic stereo spread using the same technique (if i can)

basically, the idea is to give every replicated oscillators their own pan, the more detuned/harder the pan

keeping the fundemental frequency centered 

related to an answer for: Detune Spread
asked Feb 2 in Sound Design by nicolas-petitfrere (260 points)
Hi Nicolas, could you please show the expression in your Oscillator Frequency field? If you would like to keep the base frequency centered, it would be useful to see which ?VoiceNumber has no detuning on it. Would you like the "flatter" the oscillator, the more panned to the left and the "sharper" the oscillator, the more panned to the right? Thanks!

Hi Ssc,
hope this is helpful,
Thanks !

4 Answers

0 votes

You can put a Pan Sound between the Oscillator and the Replicator.

Put something like this in the Pan parameter:

((?VoiceNumber - 1) / (?NumberVoices - 1)) / 2) *
((?VoiceNumber mod: 2) * 2 - 1)
+ 0.5


With the Pan parameter 0 is hard left, 1 is hard right and 0.5 is in the centre. What the expression above does is first turn the VoiceNumber into a number in the range of 0 to 0.5. The second line makes the number swap from positive to negative by multiplying it by 1 or -1 every other value. Then we add that to 0.5.

So the first voice will have a pan of 0.5 (centre). The second voice will be a little bit left, the third more right and so on.

This formula could be improved. For 4 voices the pannings work out like:

voice 1: 0.5
voice 2: 0.333
voice 3: 0.833
voice 4: 0

So the voices aren't in balanced pairs (where one voice would be 33% left and then the next would be 33% right). You could improve this by balancing the voices.


answered Feb 3 by alan-jackson (Master) (8,040 points)
+1 vote

Another alternative for the pan value (where 0.5 is the center) could be:

?VoiceNumber - 1 / (?NumberVoices - 1) - 0.5 * !Spread + 0.5

To put the original frequency at the center of the pan, you could change the Frequency parameter to:

?VoiceNumber - 1 / (?NumberVoices - 1) - 0.5 * !Detune nn + !KeyPitch

The reasoning behind it is that

?VoiceNumber - 1 / (?NumberVoices - 1)

has a range of [0,1]. We add an offset of -0.5 to get a range of [-0.5, 0.5]. We want that to be our deviation around zero. Scale it by !Spread so we can control how much it deviates from 0 (so when !Spread is 0, there is no deviation and when !Spread is 1 we have the maximum deviation of ±0.5):

?VoiceNumber - 1 / (?NumberVoices - 1) - 0.5 * !Spread

Finally, because the center of the pan is at 0.5 (rather than zero), add an offset to put the center at 0.5:

?VoiceNumber - 1 / (?NumberVoices - 1) - 0.5 * !Spread + 0.5

The pitch detuning is similar, except in this case we want the center to be !KeyPitch, rather than 0.5, so we add a final offset of !KeyPitch to make that the center of the spread.

answered Feb 3 by ssc (Savant) (86,790 points)
Thank you for taking the time to clarify everything ssc !
+1 vote

Here's an improved version that balances the voices:

(((((?VoiceNumber - 1) / 2) rounded * 2) / (?NumberVoices - 1) / 2 * ((?VoiceNumber mod: 2) * 2 - 1) * !Spread + 0.5) max: 0) min: 1 

But I like SSC's answer better, which is to change the Frequency expression to work the same way as the panning one which then makes the resulting expressions much simpler (and means the detuning will centre around the KeyPitch).

answered Feb 3 by alan-jackson (Master) (8,040 points)
+1 vote

I've played around with both methods, my more complicated "voice balancing" expression and SSC's simpler method.

SSC's method puts all the Sounds that are detuned below !KeyPitch on the left and those above on the right, which for a detuned oscillator like you've asked about is great.

Then I started using this on a long samples of musical pieces (from 30 seconds to a few minutes), and setting the detuning to octaves (in the Sample's Frequency parameter):

default *  (2 ** (?VoiceNumber - ((?NumberVoices / 2) rounded)))

I thought it sounds better when the voices alternate left and right to avoid having all the low detuned Sounds on the left and all the high ones on the right. Instead they're intermingled. I either had to do the alternating behaviour in the Frequency field or in the panning expression (I did it in the pan using the voice balancing expression in my other answer).

Here's some examples of what it sounds like:

original wavetable doodle (2 mins 44 secs)

wavetable doodle with 9 replications at different octaves and panned


I then tried attenuating the higher octaves and using a lot of repeatingTriangle expressions in the Pan's Level parameter to turn the different octave voices on and off:

original ponumi test (26 secs)

ponumi test with 9 octave panned replications (1 mins 44 secs)


I took that last recording and used it as the sample and did it again:

ponumi test 2nd order octave panned (1 min 41 secs)


And then did it a third time, but this time used harmonics instead of octaves with this Frequency expression:

| voiceIndex |

voiceIndex := ?VoiceNumber - ((?NumberVoices / 2) rounded).

default * ( (voiceIndex < 0)
    varIfTrue: [voiceIndex - 1 ** -1]
    ifFalse: [voiceIndex + 1] )

ponumi test 3rd order mangling (1 min 39 secs)


(The "ponumi test" is an early test recording for Banrei's AMNMA piece we performed at KISS2016 in Leicester. The clipped vocal samples are all his. Domo arigatou gozaimasu, Banrei!)



answered Feb 4 by alan-jackson (Master) (8,040 points)
edited Feb 4 by alan-jackson
Stereo Spread