I recently got a job programming the audio system for a new virtual reality room at my school. My first task is to provide a panning algorithm for a sound system with an arbitrary number of speakers. So if there are 20 speakers, it needs to be able to pan sound across a one dimensional array of 20 speakers, where the minimum value of the pan knob would be in the 1st speaker, and the max would be in the 20th speaker, and as you gradually increase the knob, it should pass the audio through each speaker consecutively.
I got this to work in SuperCollider ( http://doc.sccode.org/Classes/PanX.html ) but they need the audio system to be in Javascript. Are there any API's or npm packages I should utilize? I've been considering just using a channel slitter and in the web audio api ( https://developer.mozilla.org/en-US/docs/Web/API/ChannelSplitterNode ) and just modifying the gain of all of the channels with respect to the pan knobs position, but this feels like a naive approach. Has anyone found any packages or apis in javascript that provide tools for working with arbitrary numbers of channels? I've looked but can't seem to find anything. I've found ambisonics tools in javascript too but the system is not going to have a spherical speaker setup so this is not ideal.
Thanks! Sean