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);
は何が必要ということですか?
ありがとうございます!これはうまくいった。 –