CreatePanner()
を使用してsetPosition()
から、目的のチャネルを使用できます。前のノードをパンナー ノードに接続し、パンナーを に接続することを忘れないでくださいcontext.destination
。
例えば:
//Lets create a simple oscilator just to have some audio in our context
var oscillator = context.createOscillator();
//Now lets create the panner node
var pannerNode = context.createPanner();
//Connecting the nodes
oscillator.connect(pannerNode); //Connecting the oscillator output to the panner input
pannerNode.connect(context.destination); //Connecting the panner output to our sound output
//Setting the position of the sound
pannerNode.setPosition(-1, 0, 0);//If you want it to play on the left channel
pannerNode.setPosition(1, 0, 0);//If you want it to play on the right channel
//Playing the sound
oscillator.noteOn(0);
それはあなたが必要とするものですか?