FOF grain with independent period widths

I recently did an FOF patch that generates a grain with a specified number of half-cosines, and with independently variable amplitude for each half-cosine. Now as a variant I’m trying to have each half-cosine’s width be independently variable, and I’m trying to do this at the signal level.

I think the attached patch is running into sync problems between count~ and snapshot~ because the values coming out of the latter are not at the signal level. If anyone can think of a way around this I’d be very grateful!