We study the wave equation for a string with stiffness. We solve the equation and provide a uniqueness theorem with suitable boundary conditions. For a pinned string we compute the spectrum, which is slightly inharmonic. Therefore, the widespread scale of 12 equal divisions of the just octave is not the best choice to tune instruments like the piano. Basing on the theory of dissonance, we provide a way to tune the piano in order to improve its consonance. A good solution is obtained by tuning a note and its fifth by minimizing their beats.Peer ReviewedPostprint (published version