Best practices to handle polyphonic midi output in node for max?

weuoimi 's icon

Hello, my current node script implies polyphonic note output. The thing is it abundantly uses js timeout and generates notes asynchronously. So far it only capable to output strings of text as list of currently active ones, which should be turned to real midi notes with different sustains, pitches etc. I just want to figure out how would i generate real polyphonic midi output purely from the node.script object.