HISE Logo Forum
    • Categories
    • Register
    • Login

    Synth.isNote(eventID)

    Scheduled Pinned Locked Moved C++ Development
    25 Posts 5 Posters 1.2k 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 @Lindon
      last edited by

      @Lindon I'm focusing on this example because each situation has a different solution and I'm trying to help you get your project working :) While a catch all solution to check active notes would be good, we don't have one, so I want to help you using the techniques that are available at the moment.

      The velocity trigger issue you describe I have solved in my own project using a global variable. I put a script at the top of the chain to record the true velocity before it is changed by other scripts, this can then be picked up by the velocity filter script.

      Another solution to the makeArtificial problem is to not use makeArtificial at all. Instead you generate brand new notes using Synth.playNote(), which solution to use depends on how your scripts interact with each other and which ones are active at a particular moment.

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

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @d.healey
        last edited by

        @d-healey

        A simple example might help:

        HiseSnippet 2144.3oc6Z80aabbD+NIc1lLVFIAoA4wKDEAj05OGobbrirhojnjKg0eHDksKPPfwIdKIWni2xd2R0v5Jff7b+Bj7TeneI5SMuVf9P+fzGx2f1Y18NdKIORdlV1IswGhc39mYle6LyNyN65Z9rFjf.luldlS62knoeSi5883s2ssM0SqZEM8aYPCNhwI0a3S6x01oeW6f.hilt9hOBmidlkzDe+3C2w101qAItKMsmxnMHGP6P4w8Vq7iott6a6PNk1QY12ob0FLucYtrd.dVzvRqqciysaQNxFm1BFZ5WaOGJm4WmayIAZ5KsCyoe81r+fmb9OkFPOykfMJpUGXjr68YtNHhwd01sM00oVz5NPSS2nVrVXQoV3CLNj5PGzer13cECXFSgp9PegoAuhpvyJ0vSSAcKIQG.BlSOWa9vHCMGgCPYdCgrpdbhW.k2W0b8SJbeOiZTdi1Ii2ER.ufg50MdCM9KarWyljF7Xvtjw9+t2rV5aLgci2z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Mq7h+xLq7Irdbnp8CsAGU7zpPM50gjgMH.R77HtA3AWW.SnIaaEcz45P49hF+G3KbvhXa8vAKFM3+2HiN1M7YOugrPOb+xMD8.5VOw+j3xXbH11rXT8cFFVqYoAmul97FMPS5pE0zRllRyAMaLGzbm4flOcNn4tyAMe1bPy8lJM3IV1tGm0QtcG5n1dh5r002yyF1sH1Yo8eEXcueK
        

        This is your mono script placed before my portamento script....

        as you will see when on alone the porta script will glide happily single notes or chords...but add in the mono script, which does some NoteOff work, and the porta is left thinking that it needs to deal with notes that no longer exist...

        HISE Development for hire.
        www.channelrobot.com

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

          I'll play around with this and see what I can come up with. Any reason you're using an array to store note IDs instead of a MIDIList?

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

          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @d.healey
            last edited by

            @d-healey yep laziness ☺

            HISE Development for hire.
            www.channelrobot.com

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

              I found a redundant if statement.

                if (Synth.isLegatoInterval())
                          {
                              local dif = LastNote - Message.getNoteNumber();
                              if (AllKeys.getValue() == 1 && Synth.isLegatoInterval() == false)
              

              The second isLegatoInterval() will never be false. This isn't part of the issue though.

              A quick fix to the error you're getting is to alter your port script's note off callback like so:

                                  if (Message.isArtificial())
                                      Synth.noteOffByEventId(tid);
              

              You'll get some nice new hanging note issues to fix when the mono script is disabled :)

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

              LindonL 1 Reply Last reply Reply Quote 0
              • LindonL
                Lindon @d.healey
                last edited by

                @d-healey said in Synth.isNote(eventID):

                if (Message.isArtificial())
                Synth.noteOffByEventId(tid);

                Thanks yeah the redundant if statement I know about - being lazy again...

                So this sorta works - in that it fixes the problem if I check in the porta script if mono is running and handle each case slightly differently.

                But this breaks all sorts of encapsulation guidelines I'd really like to keep to....

                HISE Development for hire.
                www.channelrobot.com

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

                  @Lindon so back to my first point/question(s)

                  any one know if this is do-able and would be willing to give it a shot?

                  HISE Development for hire.
                  www.channelrobot.com

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

                    @Lindon I think it's doable, but I think I'd need to rewrite the port script somewhat. Could you give me a breakdown of what the port script should do so I don't have to reverse engineer yours?

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

                    LindonL 1 Reply Last reply Reply Quote 0
                    • LindonL
                      Lindon @d.healey
                      last edited by

                      @d-healey yeah I mean give it a shot at adding in the C++ code to get us to

                      Synth.isNote(EventId);

                      HISE Development for hire.
                      www.channelrobot.com

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

                        @Lindon Oh I meant independent mono and poly scripts working in harmony was doable, I'm sure the isNote thing is doable too but not sure how to tackle it.

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

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

                          @d-healey - thanks.

                          @Christoph-Hart - is there anything else we'd need other than what i outlined in the OP?

                          HISE Development for hire.
                          www.channelrobot.com

                          1 Reply Last reply Reply Quote 0
                          • Christoph HartC
                            Christoph Hart
                            last edited by

                            Yes, you will need another method in EventIdHandler:

                                /** Checks whether the event ID points to an active artificial event. */
                                bool isArtificialEventId(uint16 eventId) const
                                {
                                    return !artificialEvents[eventId % HISE_EVENT_ID_ARRAY_SIZE].isEmpty();
                                }
                            

                            and call this instead of popNoteOnFromEventId(), because this method removes the event (hence the name pop...).

                            However this is a pretty shallow advice. I can't guarantee that there are no unwanted side effects, as the system of assigning artificial event IDs is pretty delicate (AFAIK you can't have multiple artificial notes with the same note number and channel for performance reasons)...

                            1 Reply Last reply Reply Quote 0
                            • Christoph HartC
                              Christoph Hart
                              last edited by

                              BTW, you can query if a note is already artificial and use that info in the second script:

                              HiseSnippet 794.3oc6VssaSCDDc2zXDIhhnB9.r5SIBnJtTtH3AZaRJJBRaDoTwaUasG2rp16ZYuNPTU+s36h+.XV63ZmV2aVphWXUjb14lOy3yryNJTZCQQxPBsw9yB.B8QFimITS5NgwEjA8HzGaLjEofPyTQaOKfEEANDJcoOoEPaTmjr98G2l4wD1PtHB4.I2F9B2mqxkNZyOy871g4.6y8KX8FaNvVJ5J8jwHdVxnCIfYeB6XXWl1rZFD5C56vUxvwJlBhPa1V5La7D4ODo1e.OhejGn2XQFiAJULo6DtmynrbMhPn0Gkm4Kkl4OyXH2get77JvSRTXl6QwZ.s1hPp9BPx5pfzNROGc.tB3Uq.7pmBuULFaGxCT4ZzX6oykliNqhvqVpVRseQMLciE1JtTXJE6JUvdhVsadZyFckhHoGrVPHWnZs5dByi.WYH7dyUMet4PLn3mf0NFT8mBB0.mVsa+gkaZhqLc9rSfsBUbWtMm40RqtjnxbQVzMGzlm07RH00sbn55dufULr2HXu.LwPnBkddPXJRufZMQubMycrkH1+HH7ElSYdwv4Fhe8Wjd071Quv9HEB0BFJECDb0dAv7VkLNPlDKx405hFkmWEkljNkXVtnKyoIcSwD9uuMnGSwPZNctLzt..+nnyPZOXJdlQJougQOH5DkL.O0nxcDquPCaVGg5V2QLFvxoy0SwZf+3tsxTyiJxwZmRAOM8gdcg2fTMAOfUJ.SdjICgzTX0Lh6YoO.uH3NEFt3xA5ZZs9Oe9eNeFmyHch8XpEG9nmxNWAVhWfKOP+1h3pYEmBeGlH0ozIRVkks2R3thwHtxdR43sVI3UOr6dFuymuurQeWWvVkC15F678pNL+N.kuJiUbwwCYpP9OITici8GiWwwFPjHDXiMJiVSynR22QuWWYFCBmjM+AWyUZo2SmqzJSIwmYGJOzNk1puAwCSjfXRjb4oF3s3v8lVjjFRzOiNq0g3iWr4Paaco3kH1K2m0qfOupB9rQE740Uvm2TAedaE74cWqO56TtUrR5m1lfBF0O4XDJsufgrrDFI4uPCl7HI
                              

                              So your Synth.isNote() function can be written in HiseScript like this:

                              // You don't need the event id, just make sure you never call this method 
                              // outside the `onNoteOn` / `onNoteOff` callbacks..
                              inline function isNote()
                              {
                                  return Message.isArtificial();
                              }
                              
                              1 Reply Last reply Reply Quote 0
                              • gorangroovesG
                                gorangrooves
                                last edited by

                                @Christoph-Hart I'd like to add my vote to @Lindon's request. It appears that my plugins would benefit from it too :)

                                Goran Rista
                                https://gorangrooves.com

                                Handy Drums and Handy Grooves
                                https://library.gorangrooves.com

                                1 Reply Last reply Reply Quote 0
                                • ?
                                  A Former User @d.healey
                                  last edited by

                                  @d-healey many ways yes!

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

                                  32

                                  Online

                                  1.7k

                                  Users

                                  11.8k

                                  Topics

                                  102.7k

                                  Posts