I think the most simple route would be to generate midi files and throw that file at a midi compiler/interpreter with play media.
Otherwise
You could probably code a sound generator that could take your harmonic weights and give it an ASDR (Attack Sustain Decay Release) profile and generate a waveform.
That would be the basic program, subsequently it could be expanded to have reverb swell echo etc knobs for enhancing the generated sound more, but that's getting into even more complexity.
There comes a time when you should probably look at other environments for coding, then maybe define api to allow tasker to call it. All depends upon your skillset.