bugfixes to frequency calculation, now works with any sample rate and has correct frequencies for musical notes