Pure Programmer
Blue Matrix


Cluster Map

Project: Chromatic Scale Frequencies

Compute the frequnecies of the notes in chromatic scale based on the standard piano keys in twelve-tone equal temperament. Print the note names A, A#, B, C, C#, etc. followed by the frequency in Hertz. One command line argument should be passed that indicates the octave on the piano that should be used, 0-7.

See [[Piano key frequencies]]

Output
$ javac -Xlint ChromaticScale.java $ java -ea ChromaticScale 0 A0 = 27.5000 Hz A#0 = 29.1352 Hz B0 = 30.8677 Hz C1 = 32.7032 Hz C#1 = 34.6478 Hz D1 = 36.7081 Hz D#1 = 38.8909 Hz E1 = 41.2034 Hz F1 = 43.6535 Hz F#1 = 46.2493 Hz G1 = 48.9994 Hz G#1 = 51.9131 Hz A1 = 55.0000 Hz $ javac -Xlint ChromaticScale.java $ java -ea ChromaticScale 4 A4 = 440.0000 Hz A#4 = 466.1638 Hz B4 = 493.8833 Hz C5 = 523.2511 Hz C#5 = 554.3653 Hz D5 = 587.3295 Hz D#5 = 622.2540 Hz E5 = 659.2551 Hz F5 = 698.4565 Hz F#5 = 739.9888 Hz G5 = 783.9909 Hz G#5 = 830.6094 Hz A5 = 880.0000 Hz $ javac -Xlint ChromaticScale.java $ java -ea ChromaticScale 6 A6 = 1760.0000 Hz A#6 = 1864.6550 Hz B6 = 1975.5332 Hz C7 = 2093.0045 Hz C#7 = 2217.4610 Hz D7 = 2349.3181 Hz D#7 = 2489.0159 Hz E7 = 2637.0205 Hz F7 = 2793.8259 Hz F#7 = 2959.9554 Hz G7 = 3135.9635 Hz G#7 = 3322.4376 Hz A7 = 3520.0000 Hz

Solution