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

Slow start when using noteOn #41

Open
batata004 opened this issue May 3, 2023 · 1 comment
Open

Slow start when using noteOn #41

batata004 opened this issue May 3, 2023 · 1 comment

Comments

@batata004
Copy link

Hi my friend,

This library is awesome! But for real time playing, it is very slow. I tracked the reason of the slow execution and it looks like that noteOn creates the source variable everytime it runs (based on createBufferSource). Creating this variable, setting gain, effects... make it too slow. Even if I am not using any effect, the if (effects) gets executed.

Isnt it possible for you to implement a faster audio play, like using web audio .play() ? I used other real time libraries and all of them use the play() and everytime it needs to replay it, they use load() -> play() and it gets executed very fast.

Doing so, you could save each node/velocity in the array sources as you already do, and you can simply play it if the index in the array exists everytime the user requests a note, if it does not exist than you create the index and play. This would make your library near 0 latency and would improve a lot its performance and usage!

@gleitz
Copy link
Owner

gleitz commented May 3, 2023

That's a great exploration! You can open this issue (or a PR) into the MIDI.js repo.

https://github.com/mudcube/MIDI.js

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