Tonejs / Tone.js

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

maxPolyphony doesn't seem to respect numerical value during setup #1179

Open PeterHaughie opened 1 year ago

PeterHaughie commented 1 year ago

Describe the bug

When I try and set the maxPolyphony value to anything it doesn't seem to take.

To Reproduce

You can see it in action here: https://codepen.io/PeterHaughie/full/NWLmawv - click through the "emotions" I think Sad and Talking/Excited trigger the max when you hit play.

Expected behavior That the number of available voices increases from the default 32 to a number of my choosing.

What I've tried Changing the value during instantiation:

  const synth = new Tone.PolySynth(Tone.Synth, {
    maxPolyphony: 64
  });

With the setter.

synth.set({ maxPolyphony: 64 });

Additional context I appreciate that I probably shouldn't be getting anywhere near the 32 limit but I feel as though when I set it higher it should act like the API suggests it will.

Garrett-Bodley commented 3 months ago

I am also having this issue. It seems that the ability to change the maxPolyphany value as described in the API does not work.

My code

  synth = new Tone.PolySynth(Tone.Synth, { maxPolyphony: 50 }).toDestination();
  console.log({ maxPolyphony: synth.maxPolyphony })

# console output:

=> {maxPolyphony: 32}