Estimating onset time of a tone burst in noise?
As we've been discussing in the comments, the Goertzel algorithm is the usual way to detect a tone in noise.  After the discussion, I'm not sure it's quite what you are after (you want the onset time), but there seemed to be confusion over how the Goertzel algorithm might be applied to your problem, so I thought I'd write it up here.

Goertzel Algorithm

The Goertzel algorithm is good to use if you know the frequency of the tone you are looking for (call it $f_g$), and if you have a reasonable idea of the noise level so that you can select an appropriate detection threshold.

The Goertzel algorithm can be thought of as always calculating the output of ONE FFT bin:

$$y(n) = e^{\jmath 2\pi f_g n} \sum_{k=0}^n x(n) e^{-\jmath 2\pi f_g k}$$

where $f_g$ is the frequency you're looking for.

The Wikipedia page has a better way to calculate this.

Here is a (feeble) Scilab attempt at implementing it:

function [y,resultr,resulti] = goertzel(f_goertzel,x)
realW = 2.0*cos(2.0*%pi*f_goertzel);
imagW = sin(2.0*%pi*f_goertzel);

d1 = 0;
d2 = 0;

for n = 0:length(x)-1,
    y(n+1) = x(n+1) + realW*d1 - d2;
    d2 = d1;
    d1 = y(n+1);
    resultr(n+1) = 0.5*realW*d1 - d2;
    resulti(n+1) = imagW*d1;
end
endfunction


Consider the signal with $f = 0.0239074$ and $\phi = 4.4318752$ :

$$x = \sin(2\pi fn + \phi) + \epsilon(n)$$

where $\epsilon(n)$ is zero-mean, unit variance Gaussian white noise.

In this example, the tone starts one third of the way into the signal at index 1001.

If we run the Goertzel algorithm on it with $f_g = f - 0.001$ then we get the top two traces of the figure.

If we run the Goertzel algorithm on it with $f_g = f$ then we get the bottom two traces of the figure.

The four traces are:


$x$ (blue) and $y$ (red) for $f_g = 0.0229074$
The resulting $\sqrt{resultr^2 + resulti^2}$
$x$ (blue) and $y$ (red) for $f_g = 0.0239074$
The resulting $\sqrt{resultr^2 + resulti^2}$ (solid line) and the first result (dashed line).


As you can see, the case where the tone we are interested in is present peaks at about 250.  If we set the detection threshold at about half this value (125), then the detection occurs (the square-rooted value is greater than 125) at about index 1450 --- 450 samples after the tone started.

This threshold (125) will not cause a detection in the other case (for this run, anyway), but the maximum value of that output is 115.24, we we cannot reduce the threshold too much without getting a false detection.

Reducing the threshold to 116 will cause detection in the true case (for this run) at index 1401... but we run the risk of more false alarms.