Stereo Panning; Linear, Constant Power & Speaker-to-speaker

A human can localize the source of a sound with two ears. But manipulating the panning with a computer is not as easy as you think. We know that if the sound is loud, the sound is close to us. And also we know that if the sound is quiet, the sound is far from us. 

In this case, we can feel that the red violin's sound is bigger than the blue violin's sound. This is also Localization of sound of distance and related to Horizontal Plane. But this is one dimension. Let's think about two dimensions. What if the blue violin is disappeared and the red violin is moving like this?
Today, we'll discuss the horizontal plane and this is the stereo panning. I'll talk about 3 types of stereo panning; Linear, Constant Power, Speaker-to-speaker.

Linear Panning

Linear Panning has the most simple formula. First, let's see the graph. 

Very simple, isn't it? But in acoustics, one sound plus another sound is not double. It means, one sound which has 0.5 amplitude plus another sound that has 0.5 amplitude is not equal to one sound.

Sound Intensity

Why one sound plus another sound is not double? Let's think about violins again. Imagine that you are in a quiet room and the decibel is 20dB. And one violinist comes into the room and playing the violin. Say, the decibel is 70dB. What if another violinist comes into the room and playing violin with the violinist? How much is the decibel in the room? The room was 20dB, one violin is added so it turns to 70dB. 50dB is increased so... The decibel of the room which is two violins are playing is 120dB? Then, if the string quartet is playing, we'll have our eardrums ruptured because that might be at least 220dB. I love string quartets and my eardrums are fine... Because sound waves have pressure, power, energy, and INTENSITY. 
Let's focus on intensity. Sound waves travel outward from the source of the sound. And the power gets spread out over space. “If a certain amount of power is spread out over a large area, then that is a weak sound. If the same amount of power is concentrated in a small area, then the sound is strong. This concept of weak and strong is embodied in the measure called “intensity.” The physical dimensions of intensity are power per unit area. Because power is expressed in metric units of watts, and the area is in square meters, intensity is expressed in “watts per square meter.” We refer to power and intensity by the symbols P and I respectively.

There is an important relationship between pressure amplitude and intensity: The intensity is proportional to the square of the pressure amplitude. We write 

\( I \propto A^2 \)

“Note that this means that if the pressure is doubled, then the intensity is increased four times. If the pressure becomes ten times larger, then the intensity becomes 100 times larger, i.e., it is increased by a factor of 100.”

Excerpt From
Principles of Musical Acoustics
William M. Hartmann
This material may be protected by copyright. 
If you want to study more about acoustics, read this book. Highly recommend.

Therefore, linear panning makes a "hole in the middle"

If the sound is located in the left, like fig.1.1, \( y = 0^\circ \). And \( L_{amp} = 1 \), \( R_{amp} = 0 \). 
So we can make the equation like this. 

In Fig.1.1, \( y = 0^\circ \) and \( y\max = 90^\circ (\text{In radian,}  \frac{\pi}{2} ) \)

\( \begin{matrix} L_{amp} &=& (\frac{\pi}{2} - y) \frac{1}{\frac{\pi}{2}} \\ &=& (\frac{\pi}{2} - y) \frac{2}{\pi} \\ &=& ( y\max - y) \frac{1}{y\max} \end{matrix} \)

\( \begin{matrix} R_\text{amp} &=& y \frac{1}{ \frac{2}{\pi}} \\ &=& y\frac{2}{\pi} \\ &=& y \frac{1}{y\max} \end{matrix} \)

Therefore, in fig.1.1, \(L_{amp} = (90 - 0) \frac{1}{90} = 1 \) and \( R_{amp}=0 \frac{1}{90}=0 \).
In Fig.1.2, \( y = 90^\circ \) and \( y\max = 90^\circ (\text{In radian,}  \frac{\pi}{2} ) \), therefore, \(L_{amp} = (90 - 90) \frac{1}{90} = 0 \) and \( R_{amp}=90 \frac{1}{90}=1 \).
In Fig.1.3, \( y = 45^\circ \) and \( y\max = 90^\circ (\text{In radian,}  \frac{\pi}{2} ) \), therefore, \(L_{amp} = (90 - 45) \frac{1}{90} = 0.5 \) and \( R_{amp}=45 \frac{1}{90}=0.5 \). 

So if we apply this formula and move the sound left to the right, there is a "hole in the middle".

Constant Power Panning

We don't want to make a "hole in the middle" Then, how to make constant power panning? We knew that

The intensity is proportional to the square of the pressure amplitude.

We’ll make that using the Pythagorean theorem. Let's draw one circle and we can make millions of triangles in the circle like this. 
We knew that the radius and hypotenuses are equal and the square of the hypotenuse is equal to the square of the perpendicular add the square of the base.

\( r^2 = h^2 = p^2 + b^2 \)
\( r = h = \sqrt{p^2+b^2} \)

Let’ say the radius of the circle is 1. Then, the hypotenuse is always one in the circle. And the square of the perpendicular adds the square of the base. This is exactly what we're looking for. Therefore, we'll control the amplitudes using sine waves.
The r equals 1 and if we use the trigonometric function,

\( \sin\theta = \frac{p}{r} \)
\( \sin \theta \times r = \frac{p}{r} \times r \)
\( \sin \theta = p \)

\( \cos\theta = \frac{b}{r} \)
\( \cos \theta \times r = \frac{b}{r} \times r \)
\( \cos \theta = x \)

And \( \sin(x+ \frac{\pi}{2}) = \cos (x) \).
If \(x + y = 90^\circ\), \( \sin x = \cos y\)

So we can avoid the "hole in the middle"

If the sound is located in the left, like fig.2.1, \( y = 0^\circ \). And \( L_{amp} = 1 \), \( R_{amp} = 0 \).
And we can make the equation like this.

\( L_{amp} = \cos (y) \).
\( R_{amp} = \sin (y) \).

Let's prove that there is really no hole in the middle.
In Fig2.3, \( y = 45^\circ \). 

\( L_{amp}= \cos(45^\circ ) = \frac{ 1 }{\sqrt2}= 0.707... \)
\( R_{amp}= \sin(45^\circ ) = \frac{ 1 }{\sqrt2}= 0.707... \)

\( \left( \frac{1}{\sqrt2} \right)^2 + \left( \frac{1}{\sqrt2} \right)^2 = 1 \)

This is the graph of constant power panning.

Speaker-to-speaker Panning

What if the sound is moving straight like this and how to express it on a computer?
Let's see Fig.3.1. There are two triangles. But this time, I'll set the standard of angles as b. Therefore, \( b = 1, \ x = 45^\circ, \ y = -45^\circ \) and I'll use midi values (0~127) because we'll control the panning by midi controller. The midi value of Fig3.1 is 0, \( m = 0 \).
\( \cos(x) = \frac{b}{a}= \frac{1}{a} \)
\( a =  \frac{1} { \cos (x)} =  \frac{1} { \cos \left( 2 \pi \times  \frac{45}{360} \right) } = 1.4142... \)
\( c = \tan \left( 2 \pi \times \frac{45}{360} \right) = 1.000... \)
\( s = \frac{(m-64)}{64} \times c = \frac{(0-64)}{64} \times1 = -1 \)
\( d = \sqrt{s^2 + 1} = \sqrt{2}=1.4142... \)
Therefore, \( \text{Amp} = \frac{ a \times \cos \{ (y+x) \times 2 \pi \} } {d} = \frac{ 1.414 \times \cos \{(-0.125+0.125) \times 2 \pi \} }{1.414} = 1 \)
But we can normalize that because if the amplitude of the left speaker starts from 1 and moves to the center, the amplitude should be louder. In that case, there will be a clipping noise.
\( \text{Normalizing} = \text{Amp} \times (\text{Maximum}) = \text{Amp} \times \frac{2}{a+1} \)
\( \begin{matrix}\text {Normalized Amp} &=& \frac {\frac{ \cos \{ (y+x) \times 2 \pi \} }{d} \times 2 a}{(a+1)} \\ &=& \frac {\frac { \cos \{ (y+x) \times 2 \pi \} \times 2 a }{d} }{\frac {(a+1) }{1}} \\ &=& \frac{ \cos \{ (y+x) \times 2 \pi \} \times 2 a }{ d(a+1)} \\ &=& \frac {\frac{ \cos \{ (-0.125+0.125) \times 2 \pi \} }{1.414} \times 2 \times 1.414}{(1.414+1)} \\ &=& 0.8285... \end{matrix} \)

\( L_{amp}= \frac{ \cos \{ (y+x) 2\pi \} \times 2a} {d(a+1)}= 0.8285...\)
\( R_{amp}= \frac{ \cos \{ (y-x) 2\pi \} \times 2a} {d(a+1)} =0 \)

Speaker-to-speaker panning is complicated. If you do not fully understand, use this calculator and copy and paste the equation below.

Visit Here ->








Amp * (2/(a+1))

Normalized Amp






Thank you for reading. You can download all patches on my GitHub.

Related Posts


{{posts[0].date}} {{posts[0].commentsNum}} {{messages_comments}}


{{posts[1].date}} {{posts[1].commentsNum}} {{messages_comments}}


{{posts[2].date}} {{posts[2].commentsNum}} {{messages_comments}}


{{posts[3].date}} {{posts[3].commentsNum}} {{messages_comments}}

Contact Form