I would look at ornament and crime - the source code is available on github and some of the existing functions are similar/ partially what you want so creating a new one should not be that difficult - and it will do exactly what you want it to

"some of the best base-level info to remember can be found in Jim's sigfile" @Lugia

Utility modules are the dull polish that makes the shiny modules actually shine!!!

sound sources < sound modifiers < modulation sources < utilities