Tonejs / Tone.js

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

Tone.PluckSynth runs into "Max polyphony exceeded. Note dropped" problem and cannot proceed #939

Closed twohiccups closed 3 years ago

twohiccups commented 3 years ago

Describe the bug

I scheduled Tone.PluckSynth with Transport method. After certain number of notes have played a warning message "Max polyphony exceeded. Note dropped" message will appear. No more notes will be played after that, even if I stop the transport and wait a while. With other types of synths this message either doesn't appear or goes away after a short wait– notes seem to get recycled(I tested this on AMSynth, DuoSynth, FMSynth, MembraneSynth, MetalSynth, all seem fine). Is this a bug, or am I misunderstanding the PolySynth?

To Reproduce

Using Firefox browser

Code to reproduce:


window.synth =  new Tone.PolySynth(Tone.PluckSynth).toDestination();

Tone.Transport.scheduleRepeat((time) => {
     window.synth.triggerAttackRelease(['A3'], 0.01, time)
}, "8n");
Tone.Transport.start()```
tambien commented 3 years ago

PluckSynth is not meant to be used with PolySynth. Only instruments that extend the Monophonic class (the ones that you listed) can be used with Tone.PolySynth.

It is noted in the docs, but i understand it's probably still unclear unless you study the docs really closely.

Probably the clearest solution is for an error to be thrown if a non-Monophonic class is passed into the constructor of PolySynth.

twohiccups commented 3 years ago

@tambien, thanks for the info!