# Why does adding white noise improve the calculation of frequency of a sine wave in the time domain?

I created short audio files with a sine wave (tone) having a set frequency, and added varying white noise to it generated by a random number generator. I wanted to code and test the simple algorithm described in IEEE-STD-1057 & 1241 to calculate the frequency in the time domain by measuring the times the amplitudes flip sign. This works well when white noise has been added, but is less accurate when white noise is absent. What's the reason why the added white noise improves accuracy?

Just guessing; might this have something to do with dithering? The difference between a smooth (analog) sine wave and the digitized one is a sawtooth with varying amplitudes - the quantization error. Dithering is the addition of noise in order to smooth the digitized recording. Digitizing an analog source causes quantization errors, and dithering compensates for that in some way.

• could you post your code for both algorithms?
– Ben
Aug 19 '21 at 13:41
• Are you doing enough simulations per noise level? In a single test it could be. In many, it doesn't should be like that.
– Mark
Aug 19 '21 at 13:51
• It's possible that without noise, your matrices become almost singular creating some numerical issues
– Ben
Aug 19 '21 at 13:59
• The code is way too long to post here. I did many simulations to uncover the trends. No matrices involved in the calculations - just plain elementary arithmetic operations. Aug 19 '21 at 14:03
• Aren't they least-squares fit algorithms ? You usually have an overdetermined set of equations that you solve... If it smells like matrices, it's probably matrices.
– Ben
Aug 19 '21 at 14:16

An easy way to demonstrate how dithering improves accuracy in quantized systems (which includes the approach the OP used to estimate frequency) is to consider this example of a system that is quantized to integers with "truth" being some fraction in between such as $$1.4$$. With no noise added, our result would always be $$1$$. If we added enough noise with a uniform distribution of one quantization level, and could also oversample such that we can average the result- then we can see how in this case 60% of the samples will result in $$1$$ and 40% in $$2$$ resulting in $$1.4$$ on average.