I don't understand the pseudocode, but at first glance it looks fairly wrong.
I'd take a look at VBAP (excellent paper at http://lib.hut.fi/Diss/2001/isbn9512255324/isbn9512255324.pdf). For a horizontal rig this boils down to a standard cos/sin pan law across the nearest speaker pair. And watch this space, because I've an interesting project on its way... --Richard > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Paul Davis > Sent: 11 March 2002 19:10 > To: [EMAIL PROTECTED] > Subject: [linux-audio-dev] surround/n-channel panning > > > ignoring the subtleties of things like ambisonics and filtered > channels for the time being, am i right in thinking that surround > panning is just simple math? my mental model is: > > total_distance = 0 > > foreach speaker > speaker.distance = speaker.compute_distance (pan center); > total_distance + speaker.distance > > foreach speaker > speaker.pan_gain_coefficient = speaker.distance/total_distance; > > i think there is more to it than this. i know that this doesn't work > for stereo, for example - it doesn't produce an equal power pan. > > can someone point me at some good references?