HISE Logo Forum
    • Categories
    • Register
    • Login

    How to code some intricate legato logic... use onTimer() ?

    Scheduled Pinned Locked Moved Scripting
    20 Posts 3 Posters 810 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.
    • d.healeyD
      d.healey @tonewolf
      last edited by

      @tonewolf Yes that's basically it. Start simple with just two notes before trying to make this work with many.

      Use a MIDIList to store your times, it's more efficient than an array.

      This whole thing should be in a separate MIDI processor to the UI script.

      You must use the Synth timer (not a timer object). You only get 1 synth timer per script and (I think) 6 per container, so you should try hard to make it work with a single timer - it can be done.

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

      T 1 Reply Last reply Reply Quote 0
      • T
        tonewolf @d.healey
        last edited by

        @d-healey okay, this makes sense. I thought I read something about the timer being limited to 40ms intervals, though? Not sure if this would have the resolution I need.

        That aside, I have a follow up question regarding MidiList…

        I’m logging quite a bit of information per note on event, and currently must admit to having them in an array, where each array index has an object. So I might set and get Middle C meta data at noteLog[60]["noteLength"] or noteLog[60]["noteOffTime"] etc.

        Is there significant advantages to separating those all out into discrete MidiLists?

        const var noteOffTime = Engine.newMidiList();
        const var noteOnTime = Engine.newMidiList();
        etc.
        etc.

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

          @tonewolf said in How to code some intricate legato logic... use onTimer() ?:

          I thought I read something about the timer being limited to 40ms intervals, though

          Looks like 4ms to me - https://github.com/christophhart/HISE/blob/develop/hi_core/hi_dsp/modules/ModulatorSynth.cpp#L410

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

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

            @tonewolf said in How to code some intricate legato logic... use onTimer() ?:

            Is there significant advantages to separating those all out into discrete MidiLists?

            Yes, do this

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

            1 Reply Last reply Reply Quote 1
            • T
              tonewolf @d.healey
              last edited by

              @d-healey ah, great. So is this something different from…

              Link Preview Image
              HISE | Docs

              favicon

              (docs.hise.dev)

              Which says it is limited to 40ms…?

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

                @tonewolf said in How to code some intricate legato logic... use onTimer() ?:

                Which says it is limited to 40ms…?

                Well the code says otherwise, unless my maths is wrong and 0.004 seconds is not 4ms

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

                T 1 Reply Last reply Reply Quote 1
                • T
                  tonewolf @d.healey
                  last edited by

                  @d-healey great! Just wanted to make sure we were talking about the same Timer.

                  Wonderful. That’s been super helpful, thanks! I’ll see what I can come up with using this method.

                  1 Reply Last reply Reply Quote 0
                  • T
                    tonewolf
                    last edited by tonewolf

                    Perhaps missing something obvious, but how can I use MidiList to store times, when it only seems to be able to store integer values between -128 and 128?

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

                      @tonewolf said in How to code some intricate legato logic... use onTimer() ?:

                      store integer values between -128 and 128?

                      hmmm, integer yes, but you can store any value (well I'm sure there'll be an upper limit).

                      So yeah you'll probably need to use arrays for the time for the precision you need.

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

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        tonewolf @d.healey
                        last edited by

                        @d-healey I think I must have misunderstood the online docs (or they are out of date), as it appears to state the values must be between -128 and 128. But testing, it seems I can have 9 figure integers. Perhaps it means there are indexes between -128 and 128?

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

                          @tonewolf Not sure which doc but the indexes go from 0 to 127, so you get one value for each MIDI note - hence the name, MIDI list.

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

                          T 1 Reply Last reply Reply Quote 0
                          • T
                            tonewolf @d.healey
                            last edited by tonewolf

                            @d-healey this is the doc…

                            Link Preview Image
                            HISE | Docs

                            favicon

                            (docs.hise.audio)

                            But in reality, I think it can store a 32bit integer

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

                              @tonewolf Ah yeah, that's confusing and wrong :)

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

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

                              17

                              Online

                              1.7k

                              Users

                              11.8k

                              Topics

                              102.3k

                              Posts