Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.41k stars 976 forks source link

Multiple offline context player cease to function #964

Closed rhelsing closed 2 years ago

rhelsing commented 2 years ago

Describe the bug

This produces a sound:

Tone.Offline(() => {
  const oscillator = new Tone.Oscillator().toDestination().start(0);
}, 2).then((buffer) => {
  var player = new Tone.Player(buffer).connect(Tone.getDestination())
  player.start();
});

This does not produce any sound:

Tone.Offline(() => {
  const oscillator = new Tone.Oscillator().toDestination().start(0);
}, 2).then((buffer) => {
  var player = new Tone.Player(buffer).connect(Tone.getDestination())
  player.start();
});

Tone.Offline(() => {
  const oscillator = new Tone.Oscillator().toDestination().start(0);
}, 2).then((buffer) => {
  var player = new Tone.Player(buffer).connect(Tone.getDestination())
  player.start();
});

I would have expected both of them to play. I dont see any errors produced.

rhelsing commented 2 years ago

It seems that context becomes offline. After rendering, if set back to the normal context, you can hear noise.