three js positional audio bug

demonstration of an observed bug in three js where positional audio produces a glissando effect when detune or playback rate is set to the audio

by joaquin aldunate

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r124/three.min.js"></script>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js webaudio - timing</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<link type="text/css" rel="stylesheet" href="https://threejs.org/examples/main.css">
	</head>
<body>

	<div id="overlay">
		<button id="startButton">Play</button>
	</div>
	<div id="container"></div>
	<div id="info">
		<a href="https://threejs.org" target="_blank" rel="noopener noreferrer">three.js</a> webaudio - timing<br/>
		sound effect by <a href="https://freesound.org/people/michorvath/sounds/269718/" target="_blank" rel="noopener noreferrer">michorvath</a>
	</div>

	<script type="module">
  
		import * as THREE from 'https://threejs.org/build/three.module.js';

		import { OrbitControls } from 'https://threejs.org/examples/jsm/controls/OrbitControls.js';

		let scene, camera, renderer, clock;

		const objects = [];

		const speed = 2.5;
		const height = 3;
		const offset = 0.5;

		const startButton = document.getElementById( 'startButton' );
		startButton.addEventListener( 'click', init );

		function init() {

			const overlay = document.getElementById( 'overlay' );
			overlay.remove();

			const container = document.getElementById( 'container' );

			scene = new THREE.Scene();

			clock = new THREE.Clock();

			//

			camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.1, 100 );
			camera.position.set( 7, 3, 7 );

			// lights

			const ambientLight = new THREE.AmbientLight( 0xcccccc, 0.4 );
			scene.add( ambientLight );

			const directionalLight = new THREE.DirectionalLight( 0xffffff, 0.7 );
			directionalLight.position.set( 0, 5, 5 );
			scene.add( directionalLight );

			const d = 5;
			directionalLight.castShadow = true;
			directionalLight.shadow.camera.left = - d;
			directionalLight.shadow.camera.right =...