Well it is not that difficult: I start with sheet music which i convert to a computable data, then i convert it to frequencies and lengths of the particular notes, then it is converted to the feedrates (which are directly proportional to the frequencies) i put in gcodes. I also need to compute how far the table needs to be moved to generate a sound of the required length at the required feedrate. What is left is to make sure to make movements in different directions so that the position doesn't exceed the limits.
Here is a simple explenation on how frequencies relate to the sounds we hear:
[
www.phy.mtu.edu]
I used python to calculate all the stuff.