HISE Logo Forum
    • Categories
    • Register
    • Login

    Polyphony in the age of timers

    Scheduled Pinned Locked Moved Scripting
    5 Posts 3 Posters 282 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aulicon
      last edited by

      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!!!

      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by

        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.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        A 1 Reply Last reply Reply Quote 0
        • A
          aulicon @d.healey
          last edited by

          @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?

          d.healeyD LindonL 2 Replies Last reply Reply Quote 0
          • d.healeyD
            d.healey @aulicon
            last edited by

            @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.

            Link Preview Image
            Multiple synth timers

            @d-healey is there a particular reason why you can't just have the timer running while you have sound playing, and where it serves as an engine running at a ...

            favicon

            Forum (forum.hise.audio)

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @aulicon
              last edited by Lindon

              @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...

              HISE Development for hire.
              www.channelrobot.com

              1 Reply Last reply Reply Quote 1
              • First post
                Last post

              50

              Online

              1.7k

              Users

              11.7k

              Topics

              102.1k

              Posts