PannerNode: positionY プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.

positionYPannerNode インターフェイスのプロパティで、垂直軸(上下)に対応する、 3D 直交座標での音声ソースの位置の Y 座標を指定します。完全にベクトルを定義するのは、 (positionX, positionY, positionZ) で指定された音声ソースの位置と、 (orientationX, orientationY, orientationZ) で指定された音声ソースの方向(つまり、それが向いている方向)です。

音の指向性(属性 coneInnerAngle, coneOuterAngle, codeOuterGain を使用して指定)によって、使用する音の方向が、知覚される音量を変えることがあります。音が聞き手の方を向いている場合は、音が聞き手から離れている場合よりも大きくなります。

このプロパティが保持している AudioParam は読み取り専用ですが、 AudioParam.value プロパティに新しい値を割り当てることで、引数の値を変更することができます。

AudioParam で、その value は音声ソースの位置の Y 座標(3D 直交座標)です。既定値は 0 です。

次の例は、発振器を開始し、 1 秒後にリスナーの上へ、 2 秒後にリスナーの下へ、 3 秒後に中央へパンします。この場合、単純なモノラル波なので、変化は主に発振器の音色に影響することに注意してください。

js
const context = new AudioContext();

const osc = new OscillatorNode(context);
const panner = new PannerNode(context);
panner.panningModel = "HRTF";

panner.positionY.setValueAtTime(1, context.currentTime + 1);
panner.positionY.setValueAtTime(-1, context.currentTime + 2);
panner.positionY.setValueAtTime(0, context.currentTime + 3);

osc.connect(panner).connect(context.destination);

osc.start(0);

仕様書

Specification
Web Audio API
# dom-pannernode-positiony

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
positionY

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報