I'm trying to make a keyboard-controlled synthesizer that uses one sample by changing the speed at which the sample is read, and in order to avoid the lower notes being longer than the higher notes, I wanted to implement a decay function. I sent how long the decay was in the main patch, then received the length in the main subpatch. However, now whenever the decay time is not 0, when I press more than one or two notes at once, crazy clipping and speed problems occur, slowing down and amplifying everything until it is unintelligible.
I think the problem might be originating in how I am using my $1 for the length of the decay line, or it could be overloading the output of my subpatch by including all 12 of my synth modules. Can anyone help me with this? I have attached the program (main program is called "slendro attempt") and the files involved in my problem.