Crackling sounds in simple melody

I don’t really think that has anything substantially to do with the code (of course… in the end it is always the code ;). I can run this for a minute or so (did not try longer) having set tact = 0.25, thus double speed, without any warnings or cracks (xruns); the DSP load is pretty low. That’s on SP 3.2, Linux Mint 19.3, Intel Core i7, 16GB RAM and of course Jack Audio.

Just a shot in the dark (I noticed several posts concerning performance and Windows mentioning this): You are using the ASIO driver, right?