HISE Logo Forum
    • Categories
    • Register
    • Login

    CC filter

    Scheduled Pinned Locked Moved General Questions
    17 Posts 2 Posters 813 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.
    • gorangroovesG
      gorangrooves
      last edited by

      Hey guys,
      I am trying to mute midi input on a sampler for a particular range of CC.

      For example, I want a sampler to respond to midi and play notes when CC64 is between the values of 21-40, but to mute all midi events when CC is below and above that range.
      Effectively the controller allows or disallows midi input.

      Does anyone have a little script that can share with me, please? 😀

      P.S. I am aware of the table I could create in the gain section to lower the volume based on CC input, but it is not quite achieving desired results.

      Thank you.

      Goran Rista
      https://gorangrooves.com

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

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

        @gorangrooves I wouldn't use CC64 since this is usually linked to sustain pedal and most sustain pedals act as on/off switches.

        Anyway, all you need to do is save the value of CC64 (or any CC you like) in on controller. You need to store the value in a variable you've declared in on init. Then in on note you just check the value of your variable and ignore the note if it's outside the range you want to use.

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

        gorangroovesG 1 Reply Last reply Reply Quote 0
        • gorangroovesG
          gorangrooves @d.healey
          last edited by

          @d-healey Thank you. The reason I am using CC64 is because it is for a hi-hat controller and CC64 is used by default by drum modules.

          Any chance you could share a HISE snippet of what you described? 😛 As much as I perfectly understand the concept, I have no idea on how to actually code it to work.😕

          Goran Rista
          https://gorangrooves.com

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

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

            I'm sure you could have figured this out. One thing I find helpful when trying to work out how to make a script do what I want is to write it out in English (or your language of choice), then all I have to do is replace the English with the scripting language - this works for any scripting language.

            This example is pretty straightforward because it only has two sentences.

            I want to save the value of CC64 whenever it changes.
            If the value of CC64 that I have saved is in a certain range I want to ignore incoming notes.

            Now I just need to convert it into a script.
            I want to save the value of CC64 whenever it changes.
            From this line I know I'm going to need a variable. So I'll put one in on init and I'll call it ccvalue. I know that when CC64 is changed the on controller callback will trigger. So I'll put a bit of code in that callback to set the value of my variable.

            If the value of CC64 that I have saved is in a certain range I want to ignore incoming notes.
            This line tells me that I need to check the value of my variable in on note (since that's where incoming notes are detected). And since I started that sentence with the word if it's likely that I'm going to need an if statement ;) I also used the word ignore so maybe Message.ignore() will come in handy.

            I haven't tested this and I've left setting up the exact CC value range to you, but it should do what you need.

            reg ccValue = 0;
            
            function onNoteOn()
            {
            	if (ccValue > 50)
                {
                    Message.ignoreEvent(true);
                }
            }
            function onNoteOff()
            {
            	
            }
            function onController()
            {
                if (Message.getControllerNumber() == 64)
                {
                    ccValue = Message.getControllerValue();
                }
            }
            function onTimer()
            {
            	
            }
            function onControl(number, value)
            {
            	
            }
            
            
            

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

            gorangroovesG 1 Reply Last reply Reply Quote 1
            • gorangroovesG
              gorangrooves @d.healey
              last edited by

              @d-healey Thank you so much! 🙏 I really appreciate you teaching me. I am learning bits, but it is going to take some time for sure.
              I'll play with this code, analyze it and see if I can become a few bits smarter :)
              Thank you !!!

              Goran Rista
              https://gorangrooves.com

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

              1 Reply Last reply Reply Quote 1
              • gorangroovesG
                gorangrooves
                last edited by

                @d-healey Happy to report that the script works great! Further, I managed to edit Christoph's script for hi-hat choking and combine with this one to achieve choking controlled by CC. Wonderful stuff! 😁

                Thank you so much, once again!

                Goran Rista
                https://gorangrooves.com

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

                1 Reply Last reply Reply Quote 0
                • gorangroovesG
                  gorangrooves
                  last edited by

                  @d-healey So, I am trying to get the last piece of the hi-hat puzzle sorted. I want to have a note (that I specify) set the controller value to 0 when played. I thought I had the right code, but I am getting "Ilegal operation in audio thread: String creation" error.

                  This is the code:

                  function onNoteOn()
                  {
                      local number = Message.getNoteNumber() + 1;
                      
                      if(number == trigger.getValue() || number == trigger2.getValue())
                      {
                          setControllerValue(0);
                      }
                  }
                  
                   setControllerValue(0);
                  

                  is the line of code causing the error. Am I not using it correctly? Should I use something else or am I missing something?

                  Goran Rista
                  https://gorangrooves.com

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

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

                    @gorangrooves said in CC filter:

                    setControllerValue(0);

                    Is that a function you defined?

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

                    gorangroovesG 1 Reply Last reply Reply Quote 0
                    • gorangroovesG
                      gorangrooves
                      last edited by

                      @d-healey No. I was looking up Api commands.

                      Goran Rista
                      https://gorangrooves.com

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

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

                        @d-healey In your script you defined ccValue to be Message.getControllerValue();
                        Should I be referring to ccValue instead of setControllerValue and if so, how do I force the ccValue to be 0?

                        Goran Rista
                        https://gorangrooves.com

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

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

                          @gorangrooves Ah I see.

                          e4a75e4f-d891-493b-8cbb-7ee69883d0c4-image.png

                          When you look up a function in the API browser you will see it listed under the class name. In this case Message or MessageHolder. That means the function can only be used on instances of those classes.

                          To put it another way, you need to write it like this

                          Message.setControllerValue(0)

                          However this won't work in on note callback because in on note Message refers to a MIDI note message. This function will only work in the on controller callback.

                          This is why I created a variable ccvalue and set its value in the on controller callback. You should be able to use Synth.sendController() in the on note callback, I think.

                          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 @gorangrooves
                            last edited by

                            how do I force the ccValue to be 0?

                            ccValue = 0;

                            The value is only set in on controller when CC64 changes, so as long is it hasn't changed you can set it to whatever value you like.

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

                            gorangroovesG 1 Reply Last reply Reply Quote 0
                            • gorangroovesG
                              gorangrooves @d.healey
                              last edited by

                              @d-healey Thank you. I am running in circles here, no closer to solving it :)

                              How do I get it to set the controller to 0 as soon as a particular note is pressed?

                              I used

                              Synth.sendController(64,0);
                              

                              And it sets the controller to 0, but only after I press a note twice. It doesn't do it right away. What am I missing here?...

                              Goran Rista
                              https://gorangrooves.com

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

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

                                @gorangrooves I'd need to see the rest of the code. Make a minimal example that demonstrates the issue

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

                                gorangroovesG 1 Reply Last reply Reply Quote 0
                                • gorangroovesG
                                  gorangrooves @d.healey
                                  last edited by

                                  @d-healey I am trying to do that by opening 2 HISE samplers VST's and copying from to the other, but it is not working. How do you do it?

                                  Goran Rista
                                  https://gorangrooves.com

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

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

                                    @gorangrooves I always work in the standalone version unless I'm testing something in a DAW.

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

                                    gorangroovesG 1 Reply Last reply Reply Quote 0
                                    • gorangroovesG
                                      gorangrooves @d.healey
                                      last edited by

                                      @d-healey Managed to get it copied and simplified. Here is the link to the 13MB project (includes basic samples):

                                      Error 404 (Not Found)!!1

                                      favicon

                                      (drive.google.com)

                                      There are only samples on A0, 2 types: tight close and 100% open. Use the CC64 to switch between them. The first one sounds on the bottom 20 cc values and the second one is at the top 27 cc values.

                                      When the cc64 is somewhere between 100-127 and open hat is sounding, it should be able to be muted by pressing either F#1 or G#1. Currently, either needs to be pressed twice for the choke to take effect. We want to achieve that with a single press.

                                      I hope I managed to explain it clearly enough. Thank you so much for taking a look at it!

                                      Goran Rista
                                      https://gorangrooves.com

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

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

                                      44

                                      Online

                                      1.7k

                                      Users

                                      11.7k

                                      Topics

                                      101.9k

                                      Posts