The engine noise of vehicles is dominated by harmonic components, and its fundamental frequency is related to the engine speed directly. In this paper, the performance of the filtered-x least mean square (FxLMS) algorithm and a transformer algorithm suitable for harmonic noise control is compared. The noise reduction and convergence speed of these two algorithms for one tonal component with a fixed frequency or a varying frequency are analysed. The simulation results show that the FxLMS algorithm tracks the frequency change well. Therefore, the FxLMS algorithm is adopted in an active headrest system with the Direct Digital Synthesized (DDS) reference signal from the engine speed. Experimental results show that the selected 2nd order harmonic component of the engine noise can be reduced by over 20 dB with a proper step size when the engine speed increase from 700 rpm to 5600 rpm within 3 seconds.