Baseline Widely available
refDistance
㯠PannerNode
ã¤ã³ã¿ã¼ãã§ã¤ã¹ã®ããããã£ã§ãé³å£°ã½ã¼ã¹ããªã¹ãã¼ããé ãããã«ã¤ãã¦é³éã縮å°ããåç
§è·é¢ãã¤ã¾ãé³éã®ç¸®å°ã广ãå§ããè·é¢ã表ãå精度浮åå°æ°ç¹å¤ã§ãããã®å¤ã¯ããã¹ã¦ã®è·é¢ã¢ãã«ã§ä½¿ç¨ãã¾ãã
refDistance
ããããã£ã®æ¢å®å¤ã¯ 1
ã§ãã
éè² ã®æ°å¤ãå¤ã 0 æªæºã«è¨å®ãã㨠RangeError
ãçºçãã¾ãã
RangeError
ããããã£ã«åãå ¥ããããç¯å²å¤ã®å¤ãæå®ãããå ´åã«çºçãã¾ãã
ãã®ä¾ã§ã¯ãrefDistance
ã®å¤ãå¤ãããã¨ã§ãé³ãèãæããé ãããã«ã¤ãã¦é³éãæ¸è¡°ããæ§åã示ãã¾ãã rolloffFactor
ã¨ã¯ç°ãªãããã®å¤ãå¤ããã¨ãé³ãåç
§ç¹ãééããã¾ã§é³éã®æ¸è¡°ããã¾ãã
const context = new AudioContext();
// all our test tones will last this many seconds
const NOTE_LENGTH = 6;
// this is how far we'll move the sound
const Z_DISTANCE = 20;
// this function creates a graph for the test tone with a given refDistance
// and schedules it to move away from the listener along the Z (depth-wise) axis
// at the given start time, resulting in a decrease in volume (decay)
const scheduleTestTone = (refDistance, startTime) => {
const osc = new OscillatorNode(context);
const panner = new PannerNode(context);
panner.refDistance = refDistance;
// set the initial Z position, then schedule the ramp
panner.positionZ.setValueAtTime(0, startTime);
panner.positionZ.linearRampToValueAtTime(Z_DISTANCE, startTime + NOTE_LENGTH);
osc.connect(panner).connect(context.destination);
osc.start(startTime);
osc.stop(startTime + NOTE_LENGTH);
};
// this tone should decay immediately and fairly quickly
scheduleTestTone(1, context.currentTime);
// this tone should decay slower and later than the previous one
scheduleTestTone(4, context.currentTime + NOTE_LENGTH);
// this tone should decay only slightly, and only start decaying fairly late
scheduleTestTone(7, context.currentTime + NOTE_LENGTH * 2);
ãã®ã³ã¼ããå®è¡ããã¨ãæ³¢å½¢ã¯æ¬¡ã®ããã«ãªãã¾ãã
仿§æ¸ ãã©ã¦ã¶ã¼ã®äºææ§ é¢é£æ å ±RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4