Tone.js icon indicating copy to clipboard operation
Tone.js copied to clipboard

Player chain Destination in offline context

Open carlostorreswav opened this issue 3 years ago • 1 comments

Describe the bug

Hi there,

I guess Tone.Offline creates a new Destination only for the offline rendering purpose (but not sure)

The point is that when I want to create a Player chain, it needs to be connected to Tone.Destination but I get a Failed to execute 'connect' on 'AudioNode': cannot connect to an AudioNode belonging to a different audio context. error

Idk how I could set that chain Destination to that specific offline context, don't know if it's possible.

To Reproduce

I've created a sandbox that reproduce the error https://codesandbox.io/s/wizardly-smoke-j6cw56?file=/src/App.js

Actually I almost got the hole "upload - render - download" process and I saw some people asking how to do it so maybe that sandbox could be useful, I'm new with Tone.js so probably there are better ways to solve that process.

Expected behavior

Id be awesome to put a chain with effects, or at least create new ones and just pass them some parameters, but the issue is (probably) with the chain.

What I've tried

Even pray

Additional context

There's no more context, only congratulate you for this awesome library :D

carlostorreswav avatar Mar 01 '22 00:03 carlostorreswav

But you trying to use realtime destination in offline context.

Get offline context (change line 12 to this):

Tone.Offline((context) => {

And use destination from it:

sample.chain(...PluginArray, context.destination);

Valent-in avatar Aug 22 '22 08:08 Valent-in

thanks for jumping in @Valent-in

tambien avatar Oct 02 '22 14:10 tambien