Page 1 of 2

Updated - pan knob (L/R mix)

Posted: Fri Apr 19, 2013 2:20 am
by Perfect Human Interface
Updated version posted below-- use that one!!

--------------

So when I first started off with this Flowstone thing I was really surprised to find that I couldn't find any proper pan knobs that mixed the left and right signals anywhere. After some time of searching I finally just said hey, I'll make my own, can't be too hard. Well, I did it, but it actually took me a few hours and was quite a convoluted mess of wires for such a simple thing! I knew there had to be a simpler way about it, so yesterday I sat down and figured out how to put this together in DSP code, and that's what I'm sharing with you today.

It would be hard to believe that nobody would have such a basic and simple thing already, but since I had so much trouble coming across an example of this I figured I should share. :D

To be clear, this doesn't just simply fade the left and right signals separately, it progressively mixes one signal into the other like most useful pan knobs you find in software do. I also went so far as to apply a -3dB pan law here (in the last two lines if you want to comment it out). This doesn't match my DAW's (FL Studio's) pan knobs exactly except at the extremes (full left, full right, or center), so I'm not sure if there's a "more correct" way to do this, but it works and sounds just fine. Also it's entirely probable that there's a better or more efficient way of writing this code, but I'm not too worried about it.

Anyways, it's a stinkin' pan knob! Yahoo!

Re: Pan Knob! Woo!

Posted: Sat Apr 20, 2013 10:47 am
by Yuroun
Here's the version I allways use:

Autopan.fsm
(212.7 KiB) Downloaded 1429 times

Re: Pan Knob! Woo!

Posted: Sun Apr 21, 2013 9:47 am
by Perfect Human Interface
That doesn't mix the signals though. :)

Updated - pan knob (L/R mix)

Posted: Wed Mar 11, 2015 1:09 am
by Perfect Human Interface
I came back to this and made what should be a much more efficient version. Back then I thought it would be a good idea to put everything into a DSP block for whatever reason (even division). This version only performs 3 stream multiplies and 2 stream subtracts and moves the rest into green.

As before, this pans a stereo signal by progressively mixing left or right one into the other, and a -3 dB pan law is applied.

I'm also including a simple pan (no mixing signals) suitable for mono inputs.

Enjoy ;)

Re: Updated - pan knob (L/R mix)

Posted: Wed Mar 11, 2015 1:32 am
by RJHollins
Nice work PHI . Thanks for posting :)

Must say ... I appreciate being able to 'look inside' how a design is laid out.
Makes me look at things working in a different light.

Much respect 8-)

Re: Updated - pan knob (L/R mix)

Posted: Thu Mar 12, 2015 11:36 pm
by Nubeat7
thats interesting concept, while i'm not sure if the mixing of one channel into the other is a very common thing, i just tested the pan sliders in the cubase mixer and they don't do this..

anyway while doing some research on that i collected the most common ways for panners which are squareroot panning and sinusoidal panning which has the best constant loudness (3db law)

about the mixing one into the other channel i could found only one example algorithm on some Faust tutorial here which also uses squareroots to archieve constant loudness, just that its a bit more than -3db in the middle..
anyways i ported the algorithm to FS so you can compare it with your version

Re: Updated - pan knob (L/R mix)

Posted: Fri Mar 13, 2015 12:24 am
by Perfect Human Interface
Nubeat7 wrote:thats interesting concept, while i'm not sure if the mixing of one channel into the other is a very common thing, i just tested the pan sliders in the cubase mixer and they don't do this..


My understanding was that it's very common. FL Studio's panners work this way, but I don't have experience with other DAW software (I would hope other DAWs do this honestly). I believe simply scaling the left and right channels individually is technically called "balance." But this is usually much more musically useful for stereo content because you don't lose any information as you pan to the left or the right, and it's more realistic because of that. For a mono source there's of course no reason to mix the signals.

Thanks for digging up those algorithms! I looked at them but I'll "listen" to them later. To my understanding, those would be examples of a "circular" pan law, which you're correct should be more accurate in terms of constant loudness. My example is a "linear" or "triangular" pan law. It's more of an approximation but it works fine (it doesn't matter very much in practice).

Those square roots are certainly a lot simpler to implement than mucking around with all that annoying and confusing green. My understanding is that square roots are expensive though, and especially if you're going to use Ruby, I think my example would be a good bit faster, if you were for example to automate the control. Not sure exactly how much of an impact that would have but it's something to consider.

With my design thing's are getting inverted so often it got really confusing. :P But one thing to note is that since one signal is getting added to the other (gets bigger), rather than just one being attenuated (gets smaller), the pan law was actually applied upside down. I'm not even 100% sure that the whole "equal loudness" thing is applied in exactly the same way here, but to my ear it sounded right and that's, essentially, what this is about. That also means that at neutral the input signal equals the output, which is beneficial in that you can add it to your schematic without having to compensate for the attenuation at default.

Re: Updated - pan knob (L/R mix)

Posted: Fri Mar 13, 2015 1:18 am
by RJHollins
Thanks NuBeat !

Will check this out :)

Also grabbed the Faust pdf ... interesting stuff. If I could interpret C, probably more so :lol:

Where so you Guys find all this stuff :shock: Well, anyway ... thanks again !

8-)

Re: Updated - pan knob (L/R mix)

Posted: Fri Mar 13, 2015 10:09 am
by Nubeat7
Perfect Human Interface wrote:My understanding was that it's very common. FL Studio's panners work this way, but I don't have experience with other DAW software (I would hope other DAWs do this honestly).


also tested reaper, renoise and ableton and no one is mixing one channel into the other (i just tested this on the master tracks)

it also sounds unlogical to me, because if i have a stereo source the "content" of the left and right channel is already there and normally i don't want some content from one channel inside the other ,

lets take some example
i recorded a drumset, after everything is inside the box and mixed well, i found that the left channel is louder then the right, normally i take the pan knob on my stereo channel and move it slightly to the right until both channels are good, after the mix (the positioning of the single drumset tracks) is already done i don't want to change the positioning of any channel content ( i just want the right side a bit louder) this means i don't want to feed my very leftsided crash or hihats into the right channel, whats left should sty left..

so i would see your case more as a special case

Re: Updated - pan knob (L/R mix)

Posted: Fri Mar 13, 2015 6:33 pm
by Perfect Human Interface
Nubeat7 wrote:also tested reaper, renoise and ableton and no one is mixing one channel into the other (i just tested this on the master tracks)


That's quite interesting. As I said I don't have experience with other DAW software so I only had assumptions.

lets take some example
i recorded a drumset, after everything is inside the box and mixed well, i found that the left channel is louder then the right, normally i take the pan knob on my stereo channel and move it slightly to the right until both channels are good, after the mix (the positioning of the single drumset tracks) is already done i don't want to change the positioning of any channel content ( i just want the right side a bit louder) this means i don't want to feed my very leftsided crash or hihats into the right channel, whats left should sty left..

so i would see your case more as a special case


Here's the thing my friend. We're talking about two different things and there could be usage cases for either. You provided a good one for that method. So I'll give you one for the other method.

Say you have a signal with a stereo chorus, or some kind of wobble or movement between the left and right channels. As you pan this signal to the left or right, without mixing the signals, one of the channels fades to 0, and what you end up with is a sound that's fading in and out, where originally it was just moving side to side. So you've completely lost part of the original signal.

Lets call not mixing the signals "balance" and mixing the signals "panning." Balance would therefore refer to exactly what it sounds like-- the relative balance between the left and right channels. The word "panning" is based on the same word use for film and such, where the image is moved side to side. So the idea is that you're moving the perceived sound source side to side. So where you've described making a correction, this would be more of a creative choice, or a positioning choice in mixing. And I mentioned it being more realistic, that's because if you imagine a real-world sound source moving to the left or right in front of you, all of the sound information from that source is still reaching your ears regardless of how far it's moved (though it's true panning is still not a completely accurate representation of real-world spacial audio). Another way to put it would be that the left and right signals are not being dissociated, which is important because our hearing does not interpret differences in our left and right ears as unique objects, but rather uses sounds from both ears to understand each object, so it makes sense that the software would also maintain association between the signals.

Here's a quote from the Wikipedia page:
The pan pot is not the same as a balance control on a consumer stereo receiver. The balance control takes a stereo source and varies the relative level of the two channels. The left channel will never come out of the right speaker by the action of a balance control. A pan control can send the left channel to either the left or the right speakers or anywhere in between. Note that mixers which have stereo input channels controlled by a single pan pot are in fact using the balance control architecture in those channels, not pan control.


The last sentence is interesting. I believe it's referring to the idea that (in the author's apparent experience) a stereo pan would actually have two pan knobs (one for each channel) rather than one. Obviously a pan design like the one I provided is just combining this into one knob, for simplicity sake. But I'm interested to know if other DAW software might have something like this.

Ultimately I think it's important to note the differences in use cases. One is more likely to be more useful depending on your workflow and style of making music. If you're doing it the old fashioned way, recording with microphones, and generally working with mono signals, then the "balance" style control is likely to be more useful. If on the other hand you're working with stereo synthesizers and pre-recorded samples, you most likely want a pan that mixes the signals.

I will note that this is the Flowstone forums and so we're working with software synthesizers and effects. So my recommendations are that if you specifically want a "balance" control for some reason, then use one. If you have a mono signal you want to pan, either method is identical so use the cheaper one (non-mixing). If you want to move a stereo sound left or right, definitely go with the mixed-signal pan. :)