Polyphonic mess - juce::synthesiser

I have some problem with juce synthesiser. I see that there is some mess with multi voices. It looks like sometimes my app doesn’t know which instance of voice currently playing. For better explanation here is example: I have long attack time (let’s say 3 seconds), so when you hit note on music keyboard, and keeping it, sound is rising, and when you hit second note the sound is rising independently for that second note, and that is great, but sometimes that second note (or third etc) is already rised - like it takes attack phase from the first note. Have anyone the same experience? Don’t anyone know how to fix it? I think I should make some combination with function clearCurrentNote(); But I am not sure what exactly to do. Could anyone help? Thanks in advance.

Can you post some code examples of your implementation?

thanks for reply. Actually I am not sure how to show code, there are few functions in separate files.

But I can say, I use maximilian library, and I asked the same question on other forums, and some people told me it’s not JUCE synthesiser issue, but maximilian envelope algorithm.

But then maybe anyone could give some advice how to repair that?
Is it good idea to use in some way JUCE function clearCurrentNote(); Should I put it in some way to the maximilian envelope algorithm, or it has nothing to do with it?

I am in work now so I can’t copy exact code, but similar code, and with the same issue is in that video tutoria (but the issue is not described)l:

If the issue lies in the Maximilian library, I’m afraid it will be difficult to help you out.

Do you have the same issue if you implement a simple JUCE-only synthesiser using the Synthesiser, SynthesiserVoice and SynthesiserSound classes?

I am not sure, but what you are asking for in that case I will still need some wave function to play (eg. sin wave) and some envelope algorithm, and it canl generate the same issue. So I will end with the same situation.

I think it would be easier to explain with some example:
Let’s say we have set 5 voices polyphonic, and long release (3 sec) for each voice. So when you hit 5 keys, and then you hit sixth key, then JUCE should delete first pressed key. I don’t know how, maybe with launching some fast release on that first pressed key sound.
So I think I need some trigger variable (like int or bool) that can tell me all voices are already used, so if I want next voice first I need to delete first pressed key.
So that trigger should turn on first pressed note some fast release time. But then even very fast release will collapse in some short period with the attack of next sixth note. So you will end with 6 voices in that short period, but it’s impossible, because you can always have maximum 5 voices at once.

So maybe attack of that sixth note should be dependent in someway on the fast release of first pressed note. Oh it’s very complicated.

I need to see how it works in other popular synthesisers, I have some plugins on my home computer, so later I will check.
But here I am just laudly thinking and maybe anyone could give some advice, or had similar issues in the past and now could help to understand it?