A system includes a handpiece configured to generate vibratory energy and a generator coupled to the handpiece. The generator includes a processing device and a memory device having encoded thereon computer-readable instructions that are executable by the processing device to perform functions including applying a first tuning signal to the handpiece. The first tuning signal has a first variable frequency within a predetermined frequency range. The functions further include detecting a first parameter and a second parameter of the ultrasonic handpiece in response to the first tuning signal, comparing the first parameter to the second parameter, and applying a second tuning signal to the ultrasonic handpiece. The second tuning signal has a second variable frequency within the predetermined frequency range.