toot icon indicating copy to clipboard operation
toot copied to clipboard

Odd frequencies are played broken

Open toriningen opened this issue 7 months ago • 1 comments

Certain frequencies cause the toot to sound broken - every 500ms there is a defect in the waveform that looks like this: Image

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

toriningen avatar May 19 '25 07:05 toriningen

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.

vareille avatar May 30 '25 11:05 vareille