Envelope or algorithm issue

I have this issue with the audio output signal with very weird behaviour.

Basically i have a sampler plugin, it plays samples as notes.
The issue is ::

  1. The amplitude of each note is exactly the same.
  2. There is poping and clicking sounds at the end and start of the waveform.
    and some times when two notes intersect and cut each other.

Now i understand the issue in it of it self, i just don’t understand how to approach to fix it.
For example the FL studio built in sampler has none of these issues, how do they do it?

heres an example of that “poping and clicking” sound

In this case i know whats causing the pop sound, I’m just wondering if theres a correct way to handle this situation.

fade out the waveform instead of abruptly stopping it

Or just use the juce sampler, which takes care of that kind of thing for you.

The issue is that i am already using the juce sampler… but the behaviour is so unpredictable
i really need some help figuring this out.

I tried making an illustration of the issue by taking snap shots of the waveforms.
this is an experiment with 2 notes playing one after the other. both samplers are set to envelope
settings attack 0 and release 0.

The beginning of the waveform on my sampler is much cleaner because we did some work on it.
But now notice the difference in the intersection and the end of the waveforms, Fl’s sampler handles them very good, there is no significant pop sound, and the end is very clean.
On the other hand notice how on my sampler the intersection is significantly nosier.

Also notice the amplitude is much bigger on my sampler then on FL built in one, I’m not sure if the amplitude is the same for all of the notes but its noticeably louder.

it also seems that my sampler acts as 1 voice monophonic.
what is causing all of this?