HISE Logo Forum
    • Categories
    • Register
    • Login

    How do I get and set pitch bend messages?

    Scheduled Pinned Locked Moved Scripting
    12 Posts 2 Posters 441 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 @VirtualVirgin
      last edited by

      @VirtualVirgin They'll show up in the on controller callback as CC128

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

      VirtualVirginV 1 Reply Last reply Reply Quote 0
      • VirtualVirginV
        VirtualVirgin @d.healey
        last edited by

        @d-healey said in How do I get and set pitch bend messages?:

        @VirtualVirgin They'll show up in the on controller callback as CC128

        Hi David :)

        When I try to do this:

        Synth.addController(Message.getChannel(), 128, Math.range(pbInput + pbChange, -8192, 8191), 0);
        

        I get this:

        Interface:! onNoteOn() - Line 25, column 22: CC number must be between 0 and 127
        
        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey
          last edited by

          What about Synth.sendController()?

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

          VirtualVirginV 1 Reply Last reply Reply Quote 0
          • VirtualVirginV
            VirtualVirgin @d.healey
            last edited by

            @d-healey said in How do I get and set pitch bend messages?:

            What about Synth.sendController()?

            So I tried Synth.sendController() and it is doing what I was afraid it would do:

            Given that there is no input parameter for "channel", it creates all of the pitch bend messages on channel 1.

            Here I am playing on channel 2, but the pitch bend remains on channel 1:
            Screenshot 2024-12-03 at 11.50.48 AM.png

            Can I change the channel of the pitch bend by script after generating it?

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

              @VirtualVirgin said in How do I get and set pitch bend messages?:

              Can I change the channel of the pitch bend by script after generating it?

              Not that I'm aware of.

              I've just been looking at the source code for sendController and addController and I don't think it would take much work to make addController support pitch bend and aftertouch, it's really just a copy/paste job by the look of it. If you fancy playing with some C++, both functions are in ScriptingApi.cpp

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

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

                Actually it looks like there is a problem with sendController too when used with pitch bend, the CC value must be positive.

                I'll fix it up (including addController) and make a pull request.

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

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

                  Ok here's the PR https://github.com/christophhart/HISE/pull/626

                  I've fixed pitch bend handling in sendController and added it to addController. I did the same for aftertouch and program change.

                  I cleaned up the code quite a bit too because it was very nested which I find difficult to follow. I also added/changed error messages as needed. Hopefully it all works for you.

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

                  1 Reply Last reply Reply Quote 1
                  • VirtualVirginV
                    VirtualVirgin @d.healey
                    last edited by VirtualVirgin

                    @d-healey said in How do I get and set pitch bend messages?:

                    Actually it looks like there is a problem with sendController too when used with pitch bend, the CC value must be positive.

                    I'll fix it up (including addController) and make a pull request.

                    So, when looking into the matter I think pitch bend values are expected to be always positive:

                    Screenshot 2024-12-03 at 4.02.15 PM.png

                    https://studiocode.dev/kb/MIDI/midi-pitch-bend/#:~:text=Pitch Wheel Change (aka%20pitch,and%20the%20largest%20is%2016383.

                    So I modified my code to put the default input to 8192 and use that as the axis.
                    Screenshot 2024-12-03 at 4.05.03 PM.png

                    Screenshot 2024-12-03 at 4.09.31 PM.png

                    "pbChange" here gets updated depending on the conditions, but default is 0.

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

                      @VirtualVirgin Ah ok, in that case I need to update the change I made, so it should be a min of 0 and a max of 16383?

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

                      VirtualVirginV 1 Reply Last reply Reply Quote 0
                      • VirtualVirginV
                        VirtualVirgin @d.healey
                        last edited by

                        @d-healey said in How do I get and set pitch bend messages?:

                        @VirtualVirgin Ah ok, in that case I need to update the change I made, so it should be a min of 0 and a max of 16383?

                        Yes, I checked a few different sources on the spec and they all seem to agree that the expected range is 0-16383.

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

                          @VirtualVirgin Cool, thanks for checking. I tested in HISE too and it's the same. I'm updating my PR now.

                          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

                          49

                          Online

                          1.7k

                          Users

                          11.7k

                          Topics

                          101.8k

                          Posts