PannerNode: distanceModel プロパティ

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.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

distanceModelPannerNode インターフェイスのプロパティで、音声ソースがリスナーから遠ざかるにつれて音量を縮小するために使用するアルゴリズムを決定する列挙値です。

取りうる値は次の通りです。

  • linear: 線形距離モデルで、距離によって誘発されるゲインを計算します。 1 - rolloffFactor * (distance - refDistance) / (maxDistance - refDistance)
  • inverse: 逆距離モデルで、距離によって誘発されるゲインを計算します。 refDistance / (refDistance + rolloffFactor * (Math.max(distance, refDistance) - refDistance))
  • exponential: 指数距離モデルで、距離によって誘発されるゲインを計算します。 pow((Math.max(distance, refDistance) / refDistance, -rolloffFactor).

inversedistanceModel の既定値です。

列挙型です。 DistanceModelType を参照してください。

例のコードのについては BaseAudioContext.createPanner() を参照してください。

仕様書

Specification
Web Audio API
# dom-pannernode-distancemodel

ブラウザーの互換性

関連情報