Tone.js
Tone.js copied to clipboard
Volume increases when transport.loopStart and player.start are set to same time
The code below will consistently trigger a large, unexpected volume increase. Everything starts out fine, but when the transport loops for the first time the volume goes up significantly.
The issue only happens when the player.start and transport.loopStart are set to the same value or values that are < 0.002 seconds apart. It only happens when certain values are used - other values do NOT cause this problem. Test values are listed in code below. The problem is repeatable in Chrome and MS Edge.
Tested 3/16/2023 (Windows 11 desktop)
- Chrome Version 111.0.5563.65 (Official Build) (64-bit)
- Microsoft Edge Version 111.0.1661.41 (Official build) (64-bit)
<head>
<script src="http://unpkg.com/tone"></script>
<script>
async function test() {
await Tone.start();
console.log("Audio context started");
player_Melody = new Tone.Player({onload: () => console.log("player_Melody loaded")}).toDestination();
player_Melody.sync();
await player_Melody.load("https://tonejs.github.io/audio/loop/FWDL.mp3");
// Start_Time values that cause error...
// 1.8333
// 1.84
// Start_Time values that DO NOT cause error...
// 0
// 1.8
// 1.8334
let Start_Time = 1.8333;
player_Melody.start(Start_Time, 0, 5);
Tone.Transport.setLoopPoints(Start_Time, 5);
Tone.Transport.loop = true;
Tone.Transport.start("+0.1", 0);
console.log("Audio playing - first 2 seconds are silence")
}
</script>
</head>
<body>
<button onclick="test()">Click to Play MP3 Loop</button>
</body>
I'm also getting the same problem when using the "0:0:0" time format... Tone.Transport.bpm.value = 180; Tone.Transport.timeSignature = [6, 8]; Start_Time = "0:0:22";
I'm wondering if this issue is the same as/related to other reported issues:
https://github.com/Tonejs/Tone.js/issues/999 https://github.com/Tonejs/Tone.js/issues/944 https://github.com/Tonejs/Tone.js/issues/1098 https://github.com/Tonejs/Tone.js/issues/1080