-
-
Save mattly/4933 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def note_to_freq( note_num ) | |
base_note_num = note_num - 69 | |
440.0 * Math.exp( 0.057762265 * ( note_num - 69 ) ) | |
end | |
60.upto(72) {|n| puts note_to_freq(n) / note_to_freq(60) } | |
1.0 | |
1.05946309430986 # 61, C# | |
1.12246204820462 # 62, D | |
1.18920711483625 # 63, D# | |
1.25992104965971 # 64, E | |
1.3348398538586 # 65, F | |
1.41421356197715 # 66, F# | |
1.49830707638728 # 67, G | |
1.58740105137563 # 68, G# | |
1.68179282980115 # 69, A | |
1.78179743544925 # 70, A# | |
1.88774862439444 # 71, B | |
1.99999999888011 # 72, C4. really is 2, this is the only legit rounding error here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment