Unknown Amplitude Fluctuation in Stereo Panning Mixer

Cem Guney's icon

Dear All,

Just trying to make sure that my stereo panning mixer is made correctly.
Actually it works, but the thing is when the peak amplitude is at 0.707 i get a wierd fluctuation of
amplitude from cycle~. During my first test: say with the frequency at 440 hz, the sound is stable but then
in a short amount of time it sounds like there is an increase in amplitude, then a bit later it gets back to it's
normal amplitude (i couldnt detect the variation via any meters). the annoying thing is that when i tested the patch
a second time there was no wierd fluctuation...was wondering if i'm missing out on something.

As a beginner level in Max i would very much appreciate the help.

All the best & cheers!

4533.stereomixertest.maxpat
Max Patch
mzed's icon

This looks like a good, equal-power panner to me.

Cem Guney's icon

hello mark,

thx very much for your feedback, it's much appreciated!...so if you havent heard any irregular fluctuations
in amplitude then theres no reason for me to be paranoid about it, :) and it's been a relief to get confirmation!

thx again, all the best & cheers!
PS: will be nice to check out your website, great stuff!

Roman Thilenius's icon

wihout looking at your patch:
0.707 is the center position .. is there everything ok with
the phase, can it for example be that the left and the right
side have an offset of 1? so that when one channel is in
the centerposition the other one is one step off from the center?

Peter McCulloch's icon

Minor point: there actually will be a minor fluctuation in your volumes. It may or may not matter for your purposes, but it's going to happen because the line~ is transitioning linearly, even though the destinations are set with sqrt.

If you use a longer transition time, you'll hear it. (Try going from 0 to 1 over 1000 ms)

Max Patch
Copy patch and select New From Clipboard in Max.

Two ways of solving it: use sqrt~ on the output of line~ (you can just use one line~, and then invert its output with !-~ 1 and then sqrt~ for the other channel) or make a lookup table. You can read through a stereo buffer use wave~ with a 0-1 signal.

4535.StereoPanCurve.aif
aif
Cem Guney's icon

Hi Roman,
by offset of 1, do you mean a phase difference of 360?.
in regards to phase, that was one of the things i thought that might be the problem
after i heard the fluctuations, but i couldnt see how that could have happened since the
left and right side are processed equally in center position. however as Peter points out,
"there actually will be a minor fluctuation in your volumes, because the line~ is transitioning
linearly...

Cem Guney's icon

Hi Peter,
thx much for your help!...the fluctuations seems to be gone after i used the sqrt on the output of line, but
then you get a click at the end of the each transition...how do you think i can get rid of the clicks?...as to the lookup
table, although i understand the logic, i couldnt get it to work out yet so i couldnt test it, will see what i
can do.

thx much again, cheers!

Peter McCulloch's icon

You shouldn't be getting clicks (with the one I posted), but if you post your patch, I'll take a look.

Cem Guney's icon

Hi Peter,
Your probably right because my revision of the patch maybe incorrect.
As to the clicks, it's especially audible when you pan suddenly from hard right
to hard left and vice versa and also when you suddenly pan from right or left to center.
In any case i think i'm missing something, so i really appreciate that you'll take
a look at it...by the way do you think the fluctuations are gone for good?

hope to talk soon, all the best & cheers!

4545.stereomixerrevised.maxpat
Max Patch
Peter McCulloch's icon

This is correct; it's an equal power pan curve. You're changing the volume rapidly (100 ms) which is usually going to introduce some sort of artifact if it's extreme. (and going from hard left to hard right over 100 ms will be extreme)

Sudden changes usually produce artifacts in digital audio. There's ways of compensating for some of them (e.g. antialiasing measures in oscillators).

Cem Guney's icon

i'm aware of what your saying, i'm only hoping to attain a simple panner like the one in
"ableton live" where sudden shifts dont introduce clicks, but the good thing is the learning process,
so any objects/externals/abstractions for "antialiasing measures in oscillators"?

PS: even if i change the pan with a 1000ms ramp it still clicks at the end, so that was my actual concern.

have good sunday, cheers!

Peter McCulloch's icon

I don't get clicks with the last patch you posted, and you absolutely shouldn't be getting them with a ramp of 1000 ms!

Is this the entire patch? (and is the panner constrained to 0-1 for its input?)

Cem Guney's icon

the last one i posted was the revised version: single line~ to √~.
the one i posted now includes the clip~ which doesnt make any difference(hope it's correct).

ex: when i ramp from hard L to hard R or vice versa you get the click at the end of each
ramp and like a said it doesnt matter if i constrain the panner via clip~.

...the patch will be the abstraction, "panner" for my stereo mixer.

by the way i found the user that i'd lost track of whose the maker of an 8-Channel Mixer.
I learned the panning algorithm from his patch: https://cycling74.com/tools/8-channel-mixer/.

as to the links thx very much, i'm not a math guy, but i've just started working trying to understand
the FFT which i'm especially interested in but i've yet to study the nature of imaginary numbers and how
singals are represented mathematically. will be getting back to fft after i finish the stereo mixer i'm working on.

cheers to the big apple from izmir-tr!

4559.stereopanrevised.maxpat
Max Patch
Peter McCulloch's icon

Can you post a recording? I can't duplicate this. (Mac/Windows? Max 5/6? and which version? (e.g. 6.0.7))

Cem Guney's icon

Hi Peter,
Sorry for my late response, my schedule with school and my projects has really intensified in
the past couple of weeks so i didnt have the chance to respond/record...i'll post a recording as soon
as i can...as to my Max version: 6.0.5 with Mac.

Cheers, and have a good weekend!...by the way hope you werent effected by the hurricane,
and hope everythings getting better down there.

Roman Thilenius's icon

by "offset of 1" i was thinking about an integer number coming from a GUI object - a frequent source of such errors.

Cem Guney's icon

Hi Peter,

Sorry for the long delay, i posted the recording. As i've said the clicks are heard at
the end of each ramp at the opposite channel (so if i pan from hard left to hard right,
the click is heard from the L-channel). The ramp is set to 1000 ms.

all the best, cheers!

Cem Guney's icon

Hi Roman,

could you please give an example because i dont understand what you mean by,
"an integer number coming from a GUI object", how would it create such errors?

all the best & cheers!

RBBlackstone's icon

Just an FYI.

A strictly accurate equal power curve is 6 dB down in the center and that's what you have here. Most pro consoles use 3 dB down (Neve and most) or 4.5 dB down (SSL) in the center since two speakers in an acoustic space tend to sum roughly to +3dB instead of the electronic +6dB. (if they sum at all)

If you pan something and leave it there, this makes little difference. If your stereo pair is also used in mono, some instruments may balance differently than you expect. Most people will not notice, but if you have worked on pro gear for a long time, it will feel different.