Polyphony in the age of timers
-
I have been experimenting with manipulating and generating midi events from the OnNote using the OnTimer callback. I was able to create a series of drum articulation scripts fairly easy. So far I have the OnTimer being triggered and playing a sequence of notes and repetitions. Now this is all fun and games but problems start to arise when I try to implement this system polyphonically. Tracking and logging events is not quite useful as in the end I only have one OnTimer callback to trigger. I could create multiple timers and assign voices to them dynamically but this seems crazy in a scenario of where I might have like, idk, 50 timers?
As @d-healey had gently pointed out I might be able to achieve this via the midiplayer but even then I would have a very similar situation since the midi player cannot output notes while its running, making it basically monophonic. I would have to add 50 midi players which is also crazy....
I am sure I am missing something crucial about this.? have you ever encounter this scenario before? In Kontakt I was able to achieve this via polyphonic variables, an array to track ids and a bunch of wait statements.
THANKS!!! -
When I'm doing polyphonic stuff I keep track of eventIds in a MIDI list or array.
For my guitar system I wanted to have one timer per string, but then I found out that timer objects are not for real-time use, so to keep everything in one script I decided I needed to use a single synth timer and sub-divide the time using counters.
So the timer is always running whenever at least two notes are held (in my case I was doing legato stuff so two notes was the minimum). When no notes are held the timer can stop.
I have an array to keep track of the counters for each set of notes. In my case the array has 6 elements, one for each guitar string.
-
@d-healey Sounds genius but I'm having difficulty following the sub-dividing the timer part.
Could you please show a snippet of the code where you do so? -
@aulicon I don't have a snippet to demonstrate it. This is how Aaron explained it to me, it might make more sense than what I said.
https://forum.hise.audio/topic/8830/multiple-synth-timers/6?_=1722873570393
-
@aulicon said in Polyphony in the age of timers:
@d-healey Sounds genius but I'm having difficulty following the sub-dividing the timer part.
Could you please show a snippet of the code where you do so?so lets say you have two things you want to happen.. one every 200 milliseconds, one every 150 milliseconds...
so you run a timer at 50 milliseconds and each time it executes you add 1 to a counter...
when the counter modulo 4 = 0 (if counter % 4 == 0) do the first thing, when the counter modulo 3 = 0 do the second thing...
This is exactly how we used to do it in Kontakt...