Skip to content
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

Initialize Without Web Audio Context #145

Open
andrejhronco opened this issue Feb 25, 2019 · 3 comments
Open

Initialize Without Web Audio Context #145

andrejhronco opened this issue Feb 25, 2019 · 3 comments

Comments

@andrejhronco
Copy link

I use Nexus UI only for the UI and am wondering if there is a way to stop seeing the 'The AudioContext was not allowed to start' warning in the console.

Since, in my case, I have no need for the Web Audio API, can there be an option to use Nexus UI without Web Audio? Something like:
Nexus.WebAudio = false
called before any other Nexus UI API calls?
Thank You

@taylorbf
Copy link
Contributor

taylorbf commented Mar 6, 2019

Hey Andrej, cool to hear you are using this for a non-web-audio project -- what is the situation (in max or an app or something else?)

The Web Audio API is used within a few interfaces, which is why it's required. It's used for timing the sequencer, and then for the audio analysis interfaces. I don't have a non-web-audio build, unfortunately.

You could try eliminating the web audio context by commenting out a few lines. If you use dist/NexusUI.js, and you look around lines 140-150, you should find the pertinent code and you could try commenting out the relevant lines:

var DefaultContext = window.AudioContext || window.webkitAudioContext;
this._context = context || new DefaultContext();

and

this.clock = new WAAClock(this._context);
this.clock.start();

Not much of the library uses the context or the clock, so it is possible that you would be able to comment these lines out and run your UI without any errors. But, my guess is that you might see an error or two from some part of the library that calls Nexus.clock or Nexus.context. It's worth a shot but I don't know if it will send you down a rabbit hole of commenting out pieces! I'd be curious to hear what you find though.

I'll leave this open to consider creating a no-WAAPI setting.

@andrejhronco
Copy link
Author

Hi Ben, I use the Multislider for graphically setting velocity curves for note-on in the configuration editors for my company's MIDI controllers. Working on a new one for the K-Board Pro 4 that will probably use the Dial & Input interfaces as well.
malletSTATION
BopPad

I was thinking of the same approach when looking at the code. I'll give it a go and let you know if I run into any issues.

Thank you for your work!

@lazzarello
Copy link

Hello, I've been following this issue and the referenced PR since it was not too obvious how to enable the web audio context with the framework I'm using, called Vue.js. I'm building a UI for a specific multichannel USB audio device ALSA mixer controls.

I figured out how to load the web audio context asynchronously with Vue.js and wrap the relevant parts in a function that executes when the user clicks on a button. If anyone is curious here's my code.

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

3 participants