To be honest, I hadn't tested the patch before I shared it. Which I definately should have, because I just found some serious distortion problems! Not the kind of distortion that you may want, of course ...

The problem is this: In a digital (sampled) signal you can never really find zero-crossings. All you can get is the first sample **after** the zero crossing. So I had to calculate an imaginary point between the samples n (> 0) and n-1 (< 0) using linear interpolation. The point of zero crossing then is: n - x[n] / (x[n] - x[n-1])

Fortunately, the vline~ object is sub-sample accurate and can handle this!

So here is an improved version of the patch: waveset-experiments-ms.pd

One more problem might be pd's limited precision. But I've never worked with "double precision" and it would probably be an overkill for this kind of problem anyway.