Tonejs / Tone.js

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

Feedback When maxPolyphony Is Exceeded #1112

Closed abswiz closed 1 year ago

abswiz commented 2 years ago

The feature you'd like The PolySynth appears pretty resource hungry. A console log is produced when maxPolyphony is exceeded and the sound seems to just cut out. Can this log also be raised as an exception or sent via same callback? This would be useful for end users when providing some context on the system load.

tambien commented 2 years ago

Currently it defaults to a maxPolyphony of 32. After that, all notes will be silenced. If you'd like to raise the max polyphony, you can pass in a greater value in the constructor.

something like this should work:

const synth = new PolySynth({maxPolyphony: 64});

You're also able to find the current number of active voices to know when you are getting close to the max polyphony and surface that to the user or stop triggering voices at that point.

abswiz commented 1 year ago

That's great ... it helps ... and very useful to know. Thank you :)