@freemo if you want a musical synthesiser to stay in tune, not only with itself, but with other instruments, you have to make sure that this equation is true:
f = 440 * 2^(n / 12)
n is the key that is played, numbered so the 0th key is a middle A (roughly the white key at the middle of a piano) and the key to the right (a black key) is 1, etc.
the frequency doubles/halves every octave (+/- 12 semitones).
if it's even slightly off, it will sound out of tune.