Topikstarter note.
A musical instrument, for example, a guitar or a piano when extracting a single note, in addition to the main harmonic, contains many higher harmonics (multiple of the main one) and many non-multiple timbres and so on.
You can pinch the string in many ways, the attack of sound will change, the sustained strings are strongly influenced by the installed strings, even the sharpening of the nails is drastically affected. Fundamentally the direction of impact on the string.
Tirando and apojando differ very much (although it is necessary to strive to make them sound similar). The sound of the thumb sliding when changing the position of the barre is a separate song. A legato of two notes is not at all the same as two notes one after another.
With the brass and keyboard all the same, do not think that this is only a guitar.
If all this does not happen - the sound will be very unnatural. Get rid of a sinusoid does not work.
I do not discourage writing a program. I do not propose specific algorithms. Just showing that a task in good performance will be much more difficult than it seems to you at first glance. Or you can immediately tune yourself to the fact that the application will be completely toy, educational.
Judging by the javascript
tag, it really will be quite a conditional application.