Rao,
We Initiated from 3 octave because a C with 130,8 is a good listen --- I'll like Know How make instrument path ( piano, guitar, drum)
Static aTone := { 130.8, 138.6, 146.8, 155.6, 164.8, 174.6, 185.0, 196.0, 207.7, 220.0, 233.1, 246.9,; // 3 octave
261.7, 277.2, 293.7, 311.1, 329.6, 349.2, 370.0, 392.0, 415.3, 440.0, 466.2, 493.9,; // 4 octave
523.3, 554.4, 587.3, 622.3, 659.3, 698.5, 740.0, 784.0, 830.6, 880.0, 932.3, 987.8,; // 5 octave
1047 , 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1976 ,; // 6 octave
2093 , 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951 } // 7 octave
I arrive on 4 octave ( 48 keys) .. I insert your modifies and the post the new sources
I add also the possibility to save the music on a file and load music from this file