Counterpoint and voice-leading applied to live coding: How to?

Hi, everyone!

Is it possible to perform on-the-fly polyphonic contrapuntal music on a live coding setting?

All the live-coding or algorave examples I’ve found are of either monophonic or homophonic texture (namely: a single melodic line, or a melodic line accompanied by chords, respectively). Of course, I know they’re both the main musical textures found in most classical, folk and popular music. But I want to explore the old renaissance and baroque polyphonic way to make harmonic music, by combining and layering single, in(ter)dependent melodic lines into a complex, almost chaotic, yet breath-taking musical texture, as masters like Palestrina and J. S. Bach did in their own compositions. I’d love to compose and perform things like rounds, canons and fugues via live coding, as well as apply it to the strict counterpoint exercises found in the infamous Fux’s Gradus ad Parnassum.

If it’s possible to do that, how to?

Thanks in advance for your responses.

Best regards,