one of the commands, i could not identify up to now,
is causing a memory leak.
( see my remark here )
but i was able one time to stop the sketch in p5.js
but the cpu / memory usage stays high ( and some sound? ) until i was able to close the browser.
so, it might be that there is no way to do it with this library
also pls erase my reset idea, as it not helps.
but i do see a big problem in your FOR 9 loop
-a- now in your setup you do already the
env.setInput(song[i]);
so in case you want start that song you not need to do it again, only
env.play();
-b- but pls only one time.
you do that as long mouse over again and again.
-c- you can try a different way of reset,
not the envelope, stop the other songs
if ( mouseover && !song[i]isPlaying() ) song[i].play();
else song[i].stop();
or better change to mouse click instead mouse over