Control polyphony number

  • Well I'm using the command
    Sampler.setAttribute(Sampler.VoiceLimit, value ? 1 : 128);
    Assigned with a knob that allow to switch in mono or polyphonic mode. (clic= mono, second clic=128 voices)
    The problem I have is that this dosn't change max voices, but the number of voices played at the same time...
    For example 1=note with no stack
    2=note + a second one (stack, +6 dB)
    3=note + a third one (Stack, +9dB)...

    So there's still no limit to polyphony number and the sound gets ultra-limited by the compressor included...
    What's the right command please?


  • VoiceLimit is the actual amount of voices that the sampler has, and setting this to 1 will kill the last voice without a fade (also changing this value will cause clicks during playback because it needs to reinitialise some internal buffers). Also, the Sampler does not have named attributes but this one is on me 🙂

    Quick 'n Dirty solution: Use Sampler.setAttribute(6, value ? 1 : 128); until I added the parameter name constants. 6 is VoiceAmount which is rather a "soft limit". You also might want to combine this with a call to Engine.allNotesOff() to make this cleaner.

  • Nice, but a small correction:
    Sampler.setAttribute(6, value ? 2 : 128); the sound gets really mono 🙂

    Sampler.setAttribute(6, value ? 1 : 128); cuts the sound when you replay a note, so 2= play a note, then a second after cut and restart 😉
    Thanks Christoph 🙂

  • And this one is better 😄

    mainSampler.setAttribute(6, value ? 2 : 40); 
    mainSampler.setAttribute(2, value ? 1 : 40);

    6: Amount
    2: Soft Limit