Ok so below is my patch I have been working on. What I have tried to create is a record loop of 10secs, which will continue to record until a peak is detected, which then deducts 3secs from the record timer so that if someone speaks near the end of 10secs it is not cut, this also counts to 3secs and stops the recording loop and starts the playback cycle loop, which plays back the recording 3 times and then triggers the record loop cycle all over again!
So this is supposed to be a loop for it to work, however, I always get the 'Stack Overflow' message when I click the bang to initiate the process! How can I get around this?
'Stack Overflow' is surely due to a loop... in your control flow! You want an audio loop, not a loop in your control processes. Piece of advice: for such a simple patch, try first to have everything in view, hard to debug when there are several levels (patchers). Maybe instead of banging the [toggle], you could give it the message 1 or 0, that can make things easier to debug as well.
Yes it is dues to a loop in my control flow. But this has been intentional! To realise the idea the programs operation is required to loop, for example:
Loop recording in 10secs cycles > until a peak is detected > then stop recording (after 3sec delay) > start a playback cycle > once playback cycle is complete restart record cycle and begin process again!
Surely, there is some way of achieving this without Overflowing the Stack??
Well I think the issue is you want it to loop but you do not want
to create a loop in your control path. From looking at your patch
you have control lines going all over the place. It is actually
pretty hard to figure out what is going on.
I think your design would be better implemented as a state diagram.
That way you can control discrete conditions and when you need to