Skip to content

provide an audiocontext for superpowered to use. #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
weepy opened this issue Apr 27, 2025 · 2 comments
Closed

provide an audiocontext for superpowered to use. #50

weepy opened this issue Apr 27, 2025 · 2 comments

Comments

@weepy
Copy link

weepy commented Apr 27, 2025

I already have my audiograph running, and I need to dynamically load superpowered and use some of the provided nodes. Currently Superpowered creates it's own audiocontext, so I would like to be able to provide the one I already have. The alternative is to either always load superpowered and use its context (ideally not for a number of reasons), or pipe audio between the audiocontext via a mediastream which sounds pretty brittle.

Any ideas?!

@dodds-cc
Copy link
Contributor

dodds-cc commented Jun 5, 2025

Hi @weepy ,

Good suggestion, it sounds like a simple enough change for us to make. We'll include this change in v2.7.5.

For now, I've included a modified version (rough draft) of the lib that allows you to pass a previously created AudioContext as the third argument to the SuperpoweredWebAudio constructor.

So you constructor should now look something like this

const Superpowered = await SuperpoweredGlue.Instantiate('ExampleLicenseKey-WillExpire-OnNextUpdate');
const myAudioContext = new AudioContext();
const webaudioManager = new SuperpoweredWebAudio(myAudioContext.sampleRate, Superpowered, myAudioContext);

You'll need to import this modified version on both your main thread and audio worklet processor script too.

Hope this helps.

Superpowered.js.zip

@dodds-cc dodds-cc closed this as completed Jun 5, 2025
@weepy
Copy link
Author

weepy commented Jun 5, 2025

nice thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants