In this paper we extend a sensorless algorithm proposed by Bonnardot et al. for angular resampling of the acceleration signal of a gearbox submitted to limited speed fluctuation. The previous algorithm estimates the shaft angular position by narrow-band demodulation of one harmonic of the mesh frequency. The harmonic was chosen by trial and error. This paper proposes a solution to select automatically the mesh harmonic used for the shaft angular position estimation. To do so it evaluates the local signal-to-noise ratio associated to the mesh harmonic and deduces the associated low-pass filtering effect on the time synchronous average (TSA) of the signal. Results are compared with the TSA obtained when using a tachometer on an industrial gearbox used for wastewater treatment. The proposed methodology requires only the knowledge of an approximate value of the running speed and the number of teeth of the gears. It forms an automated scheme which can prove useful for real-time diagnostic applications based on TSA where speed measurement is not possible or not advisable due to difficult environmental conditions.