Just some music theory:
The lowest A on a piano has a frequency of 220. Every octave up, the frequency of a note doubles. Since there are 12 notes per octave, this means that to calculate the frequency of the nth note on a keyboard, you would use this:
where the lowest A is notenum zero.