This function plays musical tunes. Write your own musical tune and call the function to play it.
[CDEFGAB] keys, 5 full octaves
 key/rest duration, with the default  semiquaver,  quaver,  crochet and  minim
[#] sharp / [b] flat / [.] rest / [^] raise octave / [_] lower octave
The musical scores for Canon in D (Pachelbel), Prelude No 1 (Bach), The Globe Trotter and Fantasie Impromptu (Chopin) are also attached.
But still can be improved.
e.g: '4F4F'(command)='8F'(what i got),actually i want two F
and whatever the note is(semiquaver or quaver and so on),the duration of each note is decided by how many beats there are in one second(which is set by the composer),maybe we can add a input value to change the tempo?
Hi John, I've taken your advice and added some examples and included the notation (above) in the help of playtune.
28 Jun 2006
I do wish the author had included a bit more help with playtune. For example, the notation is described in the website description, but not in the help for playtune. (Please fix this!) I've rated it a 5 anyway.
20 Jun 2006
Edited the function for a more natural sounding tone.
21 Jun 2006
Added residual phase to generating signals.
22 Jun 2006
Added the musical score of Prelude No 1 by Bach.
27 Jun 2006
Enabled customizable tone generator; at the same time, set the lowest note to C(-2), i.e., two octaves below the middle C of the piano. Also added a new musical score "The Globe Trotter" which plays both right and left hands.