Question of how to generate multiple sound by TriOsc

Hi, I’m trying to do some generating music stuff by processing and the sound library.
I am trying to generate note by clicking the mouse, and the note will be played again and agian in draw() function. I want to have a new note playing when each time the mouse click on the screen, but the issue is I found that when I click the mouse twice the second note will replace the first note, so two notes cannot play in parallel.
I’m very new to processing, I want to know how I can solve this problem and is there any better way to build this. Thank you.
This is part of my code:

void draw() {
        if (note == -1){
        }
        //note will note play until mouse click
        else if ((millis() > trigger) && (note< midiSequence.length) && (amp > 0)) {
                  
            triOsc.play(midiToFreq(midiSequence[note]), amp);

            env.play(triOsc, attackTime, sustainTime, sustainLevel, releaseTime);
            
     
            trigger = millis() + duration;
       //other code
void mouseClicked() {
        ellipse(mouseX,mouseY,50,50);
      //using position of X to decide the note
      float  n = map(mouseX, 0, width, 0, 800);
      note = int(n/100);

      notestored.add(note);
      
      amp = 0.5;

 }
 

Hi @Joygou,

Please just read the documentation…

Cheers
— mnse

Thanks for replying, I read the documentation again and I see how the multiple note is played. But what I want is to make each added note playing independently with different characteristic.(pitches frequence and amplitutde), I dont think the content in documentation is what I want but anyway I will read through it agian.
Thanks a lot.