Why does this sample have clicks despite starting and ending at 0?

Hello everyone !

I’ve been recoding the Cubic Spline Interpolation algorithm as found here, so I can use it to play with waveforms. One of the major interest is to be able to resize the sample, thus tuning it.

With SC, I’ve generated an array corresponding to a 440HZ sinusoidal waveform :

var array440 = Array.fill(440, { |i| sin(pi * 2 / 440 * i) }) ++ [0];

Which I’ve interpolated, multiplying it’s size by 16 :

It’s not perfect, but good enough.

However, when downsampling, I’ve noticed that clicks happens at the start and the end of the new sample. This is especially audible here, with the 16 times downsampling, which last for ~140 ms.

Still, the sample starts and ends at 0, and follows a curve that I wouldn’t consider brutal :

The end of the file looks the same (mirrored down and backwards that is).

I believed that clicks where caused by ‘brutal’ jumps between a sample and the next one. However, here, clicks are occurring despite a curve that seems smooth enough. I guess it isn’t smooth in the end ?

I tried to fade in the beginning of the curve (and the end) but this did not remove the clicks.
I have an intuition that this might be because the amplitude is raising almost linearly, where it should be naturally raising exponentially ?

Does anybody know why those clicks occur ?

Thank you, Simon.

EDIT : when downsampling a lot, i.e. sampling down to 256 times the original value, the clicks disappear and are replaced by a barely audible frequency, likely caused by aliasing. This frequency changes over time, and I guess that if it is speed up, it resembles a click…

So this is probably not a ‘click’ in itself, but most likely an aliasing artifact caused by the imprecise nature of the interpolation, which resembles a click.

1 Like