Odd frequencies are played broken
Certain frequencies cause the toot to sound broken - every 500ms there is a defect in the waveform that looks like this:
The interval of defect is the same regardless of frequency, but not all frequencies cause it.
It seems that odd frequencies are affected. More precisely, any frequency $$f$$ in range $$( (2n + 1 - k) \leq f < (2(n + 1) - k) )$$, where $$k = \frac{2^{29}+1}{2^{45}}$$. I don't know why this particular number, I have found it experimentally and then found the fraction it corresponds to exactly.
This is the broken toot in question, generated with toot.exe -l 10000 -f 250.9999923706054545391452847979962825775146484375.
But toot.exe -l 10000 -f 250.9999923706054545391452847979962825775146484374, only 1e-46 less, will produce defect-free toot.
Environment:
- toot 1.0.9, prebuilt from releases
- Windows 10
On windows toot calls a microsoft function called beep(), described here: https://learn.microsoft.com/en-us/windows/win32/api/utilapiset/nf-utilapiset-beep
I'm afraid anything wrong with this function is a microsoft issue.