I am looking at the web audio API spec and the panning node uses three values to create a 3D spectrum for sound. I was wondering if in order to create a basic 2D \"equal pow
I can still get a panning effect by changing only the first argument to setPosition() and keeping other arguments zero.
Choose your MP3 file:
LR
But to get a natural panning effect, you need to specify the third argument as well.
function pan(range) {
var xDeg = parseInt(range.value);
var zDeg = xDeg + 90;
if (zDeg > 90) {
zDeg = 180 - zDeg;
}
var x = Math.sin(xDeg * (Math.PI / 180));
var z = Math.sin(zDeg * (Math.PI / 180));
p.setPosition(x, 0, z);
}