Tonejs / Tone.js

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

Tone Master multi send #412

Closed luisarandas closed 5 years ago

luisarandas commented 5 years ago

Is there a way to send Tone.Master from current page to another context -> for example page2.html ? Best, Luis

rain-sk commented 5 years ago

Fairly certain AudioContexts are window-scoped, so persisting across page-loads is a no-go. You could use a SPA framework with a router (react and react-router) to give the illusion that the AudioContext is persisting across different pages.

luisarandas commented 5 years ago

Is there any link you might find useful?

rain-sk commented 5 years ago

Check out: https://reacttraining.com/react-router/

If you are unfamiliar with React, look through their docs to get a sense for how the framework abstracts HTML and DOM interaction.

If you're interested in sharing data between tabs / windows, there's the new BroadcastChannel API (MDN docs: https://mzl.la/2A2NOYe). You could theoretically broadcast a buffer array or an object reference, but AudioContexts are still intentionally isolated.

luisarandas commented 5 years ago

Thank you very much. Best, Luis

rain-sk commented 5 years ago

Suggest the create-react-app npm package.

$ npm install -g create-react-app
$ create-react-app my-app

On Sun, Dec 16, 2018, 10:42 AM luisArandas <notifications@github.com wrote:

Thank you very much. Best, Luis

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Tonejs/Tone.js/issues/412#issuecomment-447657514, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7ifyGMfP09cyR__dWz_5lZNeQpT42fks5u5ngQgaJpZM4ZVUDA .

tambien commented 5 years ago

as @spencerudnick mentioned, the AudioContext is window specific and there is no built-in Web Audio way pass audio from one page to another. Might be something you can do with WebRTC?