Digital Panning Effect

To get a panning effect I know that there is a need for a Circular Matrix. The angle is can be set as a default or I can let the user to select the angle.

So if the angle is $\theta$, the circular matrix will be:

$$\begin{pmatrix}\cos \theta & \sin \theta \\ -\sin \theta & \cos \theta\end{pmatrix}$$ and the gain is actually set in which channel (Right or Left) the audio will be.

So if I'm sampling the signal from a guitar and get the sequence $X$, all I need to do is to do is to multiply each sample value with the circular matrix?

This operation (multiply each sampled value with the circular matrix) calculates the gain right? So I will know in which channel - right or left to play the signal.

I don't understand when the signal is converted again to analog. After the calculation of the gain? Because if you play with a panning effect, you will hear the sound in the left or the right channel very fast.

I don't understand if it's a multiplication the whole signal with the circular matrix and then just playing it back on the different channels. Or is it actually a multiplication of each sampled value of the signal by the matrix, conversion to analog and then processing of other sampled values.

• You're doing this processing in the digital domain, on a computer, right? Then the conversion to analog is done right at the end, by your soundcard, and you don't have to care about it. – pichenettes Dec 12 '13 at 12:06
• yes, but I want to know it theoretically. after the sampled value was processed it converts to analog to sound it at the suitable channel. and then it return to process the other sampled value or it processed to whole sampled values and then sound it as analog? – Elior Dec 12 '13 at 12:13
• Whether the samples are processed one by one, by small blocks, or entirely before being sent to the DAC is not relevant to your question. It actually depends on the hardware/software platform on which things run. – pichenettes Dec 12 '13 at 14:30
• Are you simply trying to implement something like a palling knob in any recording software, or are you actually looking for this thing to sound like it's somewhere in space in front of the listener? – Phonon Jun 10 '14 at 21:13

To get a panning effect I know that there is a need for a Circular Matrix. The angle is can be set as a default or I can let the user to select the angle.

How do you know this? Can you cite a source? Audio Panning is typically done with one input and two outputs. It's either done with constant energy or constant amplitude pan. Constant energy is similar to what the second column of your matrix would do if the angle goes from 0 to 90 degree with 45 degrees being "centered"

• Its from the DAFX book of Udo Zoler, pages 138-142 – Elior Dec 12 '13 at 13:26
• The name is Udo Zoelzer. You already mispelled it in another question. Please, get it right – Jazzmaniac Dec 12 '13 at 21:46

Said Matrix maps one stereo signal to another "panned" one, that is, one where the phases of both channels have a different phase to before. Even if your guitar produces a two channel signal (some do, however this is not "stereo" in the sense that the signal implies a certain angle to the listener), this alone will not give real panning.

Actual stereo signals (eg. a sound source recorded with two microphones) do not only have amplitude differences, but also a phase relation, and direction is mostly percieved through phase difference. Amplitude differences alone do make the signal sound directional, but with phase differences (actually: mostly plain delays - the time the signal takes to travel from one ear to the other, so to say) the effect is much more pronounced and sounds far more realistic, too. You can't express that as a matrix (of scalars) alone, you'd need filters, too.

It is just short of a science to make stereo recordings that sound realistic, and even harder to play these back without headphones. With speakers, you will always have cross-talk between the channels, an effect that does not happen to actual sound sources. However, almost everybody is used to how stereo played back through speakers sounds, so just imitating what happens in a recording of a real sound source is not the worst idea of all.

If you want to go even more realistic, you could model parts of a skull and of ears. Turns out, the finer you can do this, the more subtle effects you can achieve, eg. making sound sounding like coming from behind instead of in front, or above or below - which makes differences that are not explainable without considering the actual anatomy of a human (and which would be different, would you mix a signal for a dog eg.). There's people out there who actually build "dummy heads" that have acoustic properties close to an actual head, put mics inside and make a recording like that. These sometimes turn out to be completely awesome.