I am trying to get some help thinking through an issue more than getting a patch to work. I am loading 153 very short files into two sflist~ objects. These cues are then played. When the cue is loaded, an sfinfo~ object finds the length and triggers a bang a few milliseconds before the file ends. This bang triggers the other sfplay~ to start playing. Sometimes in the process of switching between sfplay~s, there are sharp, loud clicks or pops. These pops are not in the sound files. I have played them back using a similar program written in actionscript and there are no pops.
More info: The files are short, ranging from 45 milliseconds to half a second about 10-20 milliseconds from the end of the file, a bang is triggered. This loads a random clip from the cue list and tests it against a list of unacceptable cues. if the cue is found to be unacceptable, a new random cue is generated and this is then tested, so on until an acceptable cue is found.
As far as I can trace it, the issue seems to be the switching is getting caught of by the algorithm and the cue starts playing a bit into the file, causing the pop.
I am looking for any suggestions about how to go about eliminating the pops and clicks. Perhaps a ramp? Any help is appreciated. Below I have posted a patch illustrating the basics of the switching sfplay~ objects. It doesn't include the full patch since that is rather large, but I can post it along with the files if anyone wants to see it.