I have looked at the code and there is no definition of frequency.
I can add a line of int frequency =440.
Then I compile, but get a constant 440 on the serial printout.
The raw value prints out perfectly.
Is there a line or two of code missing?
All the previous example work.