logoalt Hacker News

dupedtoday at 3:06 AM1 replyview on HN

There's definitely such thing as a zero crossing, it's where sign(x[n-1]) != sign(x[n]) (or rather, there's "no such thing as a zero crossing" in the same way there's no such thing as a peak). Picking a suitable `n` as a start/end point for sample editing is a judgement call, because what you're trying to minimize is the difference between two samples since it's conceptually a unit impulse in the sequence.

I don't think people who talk about zero crossings were totally misguided. It's a legitimate technique for picking start/end points of your samples and tracks. Even as a first step before BLEP or fades.


Replies

PaulDavisThe1sttoday at 3:23 AM

Theoretically, it makes sense (go look at any of the diagrams of what a "zero crossing" is online, and it totally does.

The problem is that sign(x[n-1]) != sign(x[n]) describes a place where two successive samples differ in sign, but no sample is actually has a value of zero. Thus, to perform an edit there, if your goal is to avoid a click by truncating with a non-zero sample value, you need to add/assign a value of zero to a sample. This introduces distortion - you are artifically changing the shape of the waveform, which implies the introduction of all kinds of frequency artifacts.

Zero crossings are not computed by finding a minimum between two consecutive samples - that would almost never involve a sign change. And if they are computed by finding the minimum between two consecutive samples that also involves a sign change, there's a very good chance that you'll be long way from your desired cut point, even if you ignore the distortion issue.

It really was a completely misguided idea. If the situation was:

     sign(x[n-2) != sign(x[n]) && x[n-1] == 0
then it would be great. But this essentially never happens in real audio.
show 1 reply