PannerNode.maxDistance

The maxDistance property of the PannerNode interface is a double value representing the maximum distance between the audio source and the listener, after which the volume is not reduced any further. This value is used only by the linear distance model.

The maxDistance property's default value is 10000.

Syntax

var audioCtx = new AudioContext();
var panner = audioCtx.createPanner();
panner.maxDistance = 10000;

Value

A double. The default is 10000, and non-positive values are not allowed.

Exceptions

RangeError

The property has been given a value that is outside the accepted range.

Example

See BaseAudioContext.createPanner() for example code.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
maxDistance
14
12
25
No
15
6
≤37
18
25
14
6
1.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/maxDistance