A completely different way to do it is to set up code to play looped sound. I don't know Linux but I bet there is a play equivelent module that will let you do that. Then you set up a sound buffer with the tick and an appropriate amount of silence for the rate you require initially. Then, every update period, reduce the padding and update the sound buffer.
Now your script can perform a much less frequent update and can be sure that the tick rate will be precise, albeit with a glitch if you can't manage a synchronous update of the sound buffer.
Perl is Huffman encoded by design.