HISE Logo Forum
    • Categories
    • Register
    • Login

    Mute/enable a sampler when a controller value is greater than or less than

    Scheduled Pinned Locked Moved General Questions
    26 Posts 2 Posters 700 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
      afinch
      last edited by

      Hey,

      I am trying to set up my project so that when a chose CC goes over a value of 64 one sampler is muted as another is enabled. How best should I script this using the MidiMuter? In principle I want this to happen for CC1 but how can I integrate this into a combo box where the user can select any CC and still have the same sampler muted or enabled when the value changes?

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

        You need to add another script processor.

        In the on controller callback you check the value of the incoming CC, if it's over 64 you enable/disable the MIDI muter scripts ignoreAllEvents button.

        For filtering which CC you can check the incoming CC number against the one selected by the user.

        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
          afinch @d.healey
          last edited by

          @d-healey

          So is it something like the below? What goes after the ifs to specify the value range you want for each?

          function onController()
          {	
          	if (Message.getControllerNumber() == 1)
          		{
          		if () 
          			{
          			mute.setAttribute(0, 1);
          			}
          		if () 
          			{	
          			mute.setAttribute(0, 0);
          			}
          		}
          }
          
          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @afinch
            last edited by

            @afinch I don't think you need a range, you just want to check if it's greater than > 64, don't you?

            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
              afinch @d.healey
              last edited by

              @d-healey Yes so just >64, how would I implement that?

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

                @afinch said in Mute/enable a sampler when a controller value is greater than or less than:

                @d-healey Yes so just >64, how would I implement that?

                if (cc > 64)
                    // do one thing
                else
                   // do something else
                

                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
                  afinch @d.healey
                  last edited by

                  @d-healey So would it be something like this? I have linked a slider to CC1 and don't see the 'Ignore all events button' toggling on and off.

                  function onController()
                  {	
                  	if (Message.getControllerNumber() == 1)
                  		{
                  		if (cc > 64) 
                  			{
                  			mute.setAttribute(0, 1);
                  			}
                  		else
                  			{	
                  			mute.setAttribute(0, 0);
                  			}
                  		}
                  }
                  
                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @afinch
                    last edited by

                    @afinch cc was just a placeholder, you need to use the actual incoming cc number.

                    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
                      afinch @d.healey
                      last edited by

                      @d-healey oh I see, I am a little confused as to how I specify CC1 there. Could you explain a bit further please?

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

                        @afinch

                        You don't need to specificy it at that point. You've already done it on the line before Message.getControllerNumber() == 1

                        What you need now is the CC value. You can use Message.getControllerValue()

                        You should avoid magic numbers too. Instead of mute.setAttribute(0, 1) you should use mute.setAttribute(mute.ignoreButton, true)

                        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
                          afinch @d.healey
                          last edited by

                          @d-healey Based on what you said this is what I got to but I still can't seem to be able to get it too work, am I missing something obvious?!

                          function onController()
                          {	
                          	if (Message.getControllerNumber() == 1)
                          		{
                          		if (Message.getControllerValue() > 64) 
                          			{
                          			mute.setAttribute(mute.ignoreButton, true);
                          			}
                          		else
                          			{	
                          			mute.setAttribute(mute.ignoreButton, false);
                          			}
                          		}
                          }
                          
                          d.healeyD 1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @afinch
                            last edited by

                            @afinch Looks good to me but without seeing the whole thing I can't say why it's not working. Can you post a snippet?

                            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
                              afinch @d.healey
                              last edited by

                              @d-healey basically trying to control the knob so it triggers the ignore button.

                              Here it is: HiseSnippet 1449.3oc4X80aaaCDmxNLs1sMasHOrWFfdXOj.zEX2llNfht3l+UXz5Dinzh8VAiDsMmkHEnnRhaVeaedF12f0uJ6aP+FrcjR1h10Iw0HsaXyOH363wi+3w638SpsT3SSRDRjSkiFDSQN2F6Mfq5scOBiiZtCxYIbKRhhJcyTs0fXRRBM.43T94ZENUV.Y98gM2hDR39zBUHzqELe5KYQLUg11MdAKLbOR.8HVjk0q2noufusHTjB3oLtFJl32mzktOQaVILxYwcCXJgzSQTzDjCdKQv.udhS4Y1+ZVB63PpVnNxCbTl5CNgJOgQOcOQXfF4Zc1+GscOVXP6gwhDD341EQlxYQlkwsXArQ5KhPesY.2hYXGibJMNjKOFjqeQPdJPxwBRKjAo6h87krXUwHZ7bKbSNbf0g.GE1PIyVjy6waK.C3p0hH8o6IAgQSXkMpU69tviUeRmTtuhI3tB99BE8.9JqV87pUp9tptSNTmNScL8xHEggT4TGVe5KurItBOM5Xp79tmPBSoiLD19iGSWb1ho9Y6ZKCE7lbl5fXZtbQRQ8obBfxCa5yhbDBlpLmDKkeR3ExBnRDCbxMvufKNtNx.9QY4u+MMPup4NDEYna.OBqRLUpX5MiyNzSfZlrC3J3cnI8UhXisQwBtd8cV5JWzyFsfM94FCJpwXMRTCzglEMFhhXAAgz1hDlNzaUL+GPMerG6sFje9x+1y+y29qaFYWuiPQjyr2WIoc5vNyTn1gEFkn.r0LBpeQN2C+pDpa.sCIMT4lzG7SHi2mFbjvX+or.UOnpygCtpGk0smZnD5iS6gBNQPZHQMdUn95n7Az6E6Tec9MG1iCrutZxRyEt3znZVoQWQRxLB26hayT98lNdKME7BoKetwa9Ec2AuamNTeUAXW.u2Oco2pcsCkuMCJ2C6ojTBj200iDEC2jXvSUbtT8qi9Qwyb+n1RZnfDLrrHyr22XKHwmJGW6u2vrTOKRjxGasxQ9gzXJQAG+Vy4lMN7vmKEowSNqOroIY4HIzODBE1Cb.mBwck8dbaoHIoCrcL9Jwdn1oxt5XUglCoPywjw0seZDb1y4zPcOVGGPET9pOqY9sHPY8Y1VaVkZGQLm2PsrQt9DxOXB4GNg75SH+nIj2XB4GWHmEPaQh0YFZRBSzc3FyFIAvAsIvV1JKdKV2QNOSy3WwXY5nXtAWVq1TZju3mKtEKLa8AuBpOklUdF2KW6Eftb5Fk9EGr60KWh6T87J2oZEVG2UZAqKzgYstTUgE6anMrxptO8ot0AqqT4b8iKz9Wq6PCl+itar9ptZSylPknTEcsDp5YJHo+XPXEiFVWtPR2JUoD766pj.2jmXr+c5mPUCMyGUlcmzg.yx1Kvi284fqD95hqzkwOZtX3LkNQ2xj82BBWYYbKh0gtwqAJeMwu1hcWoKhcW1okgn0RX6CvIH4gxc2U3iuBC7k7To980Y9ISwIew39Td1ZfeEuVRkgXziou1bW9IP+RPS1sE6jQ+an1w6c2RvEw8Dbl+3cmfZltcoRarO0MDTcAMGKzrbiCogTRhU776Z7RFmRji2z8SJV7o+JZS875avYv0UWV69eCNqk+eOm0KKzsTNiUWX0kp+keNeargikqlR7+TP8PQpBn5NjtIF5o6A7v8o1LSKoumMStlVVCHOJOvH7Wvu7AqOjFqdv5CGD4OzUvdK++l1VNkobMMNyqhEBDjCsSosdM2uHnLh3KEuwOqchFq2znAPI27cwpfaokcG8kFv3ZqUS+l8r236qKD995HzzmyCli47v4XNqOGy4Qywb1XNlyimi47CW5bzjVdVpRDkcIYwmKR+9qN2xVH6.2ptz9i2YVql7.5YCSFxt8vJYbWdf8mfYuzvvOxFsxIryqO8zIaoJgsj8G6YDe0hupTSn0sTkcW.pU6cypVb1cT0RYzeiKG79q

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

                                You need to get a reference to your muter in the script.

                                ed7b8de3-8682-4c05-b127-ca02188b5164-image.png

                                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
                                  afinch @d.healey
                                  last edited by

                                  @d-healey Sorry I meant to include that in the example. Even with that it still doesn't seem to be working.

                                  HiseSnippet 1408.3oc4X0raaaDDdojYRjRhaSfOzKEfHnGjARMjRbbJPfaX7eABIxVvzIn.8fwZxURaM4tDKW5ehQ.5g97z1Gg7pz2f7FzN6RJwULxJJBooos5.glYmY1uc9Ymgrqf6SRR3BjUsCNOlfrtgs24L4fMGfoLT6sPVKZ2AmHIBmLVabdLNIgDfrrp9TECqZKfz+d6i2.GhY9jBVHzK4TexyoQTYA2ttOiFFtCNfb.MxP5Uca6yYaxC4o.dpZ2DEi8OF2mrKVIVEaj0U1NfJ4BOIVRRPV1avCN2a.+TVl7ujlPOJjnHZg7.CkwduSHhSnjS2gGFnPthWw+agPaNfFFzcnuHAAVtagmoZlmYI6Nz.5H9EdnuTufSgFl9HqJiC4piA4VlPtoAjm.jrLfzBYP5V1d9BZrrXEEdttcaFDv5ggPgITxjEY8F6M4f.L4JQ3iI6H.hQJzXslMuqC7X4G0Kk4KoblCmsKWR1i0X45WTuV8WW2o7R85Mw0TaifGFRDSbYUzWLMEavRiNhHtqyI3vTxHAgi+zRCZcYoA9YmZCA4r1LpbuXB6xRDP4tJk+OGUfnRs2ewbuuWHMfHPTvIeU6mw3G0BoA7nL62bnK5Es2BKwCMCXQXWhIBIUc.r1hbBTmjETqYuEI4XIOVKaTLmo1eqq8d2zyFsgt+j64E0UTWn9M1i9pgHx8Od0u73H7Yl.7TZfbvHF+7O5NfP6OPZxA8tIfPpOOHMDKGudPcwP9BP.crjPUlFKgJO27hixEIKLaEISuFdVg6sr6Rk9ClLdqLA7BAw+twa9UN2zd6d8H9xBvtf8N+vTue4iNT95LnbaaOoffinr9d3nXnlVim514Ts9XzYHdl6LzUPB43.ijZUZr6Fof+RLN2e2UuUOIhmxFauxQ99jXBVBgeCctl696+TAOMtrVu8w5jkCDPmIvUXtvdLB32klmwME7jjdvwQaqDyk5lJ5q7UEb1m.soRFm2toQPrmwHgpq4rr.VuHgnh0T+NXofdloz5co4AXc7FZWpoaUh9dknueI5UKQ+fRzqUh9gEzYNzN3XUlgpcco6ou5rcOMXftX3HaH4Fz9iLdFGyD3QtYMTLlGXBcQuxmeM1qLqM1ucN2KAQ482q7aV1NyYyanJKQBsaENQoRhy5N5gAWoOQNlKpwcTKemkeT85WR69aV+hZ2rdMZOmFc.Ufg3TFoPhc0c1arry5q6zBjtVsKTOtT4eopgJH926r1pK6nDMSgZJfrRBQ9DITMbDPzPyg1mwEjMRkRN6tNRAL9vizx+Z0SnbhjYiZytQ5gAsLsB7300+W67Ly0DISnG000EIc.+UVR5UrU9twKUpNykJslZohwzXUtrowxBW5AiVz1LBVZnLTt4dO13Kr6QOySl5erpXIYBF4S1TQebd0gZCwnGUcg51rSfNo.mrKX1hzCmFJGxc7t5c3Ld7.Ni5OdeKnnoeehvD6S7.AkWPayBNK4tOIjfSL7mei6yoLBVLd63OHeQqO3WiZhwquxNCtNpxZm+aLMa0+2OM6zbcKlOKqCr6B4m4w4aXqm9xQMr7+TPcedpDFBd3fn1PScOXBceh4LqUT2ylQ2TQq.jGgEnI9S3W9hsFNfqZwVCWD4OzTvYK++51VVUIL0zd5WRKDFcNzLkNAdO.EjfgP+jfxHrufeneV6DEVullCfRl9aWUytih1YzWFv1t4JMQQPmyC88UEBeK3gmrN2aNz49ygNqNG57f4Pm0lCcd3bny2MUcTCs7jTIOJ6RxhOui5MasttIQV.2ntz7Cro2q1r.xYCSFxt8vHYbaVf4WZYmzvv2QFEyRx4cL4zxsTEvQRw6hk90mp9HNiFXs3q.0FZcKjY2Ef5zc6rpEqsGUsTE8W.sNG1VB

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

                                    @afinch I don't see anything different in that second snippet, what am I missing?

                                    By the way, if you use script tags when posting your snippet it will only take a single line and is easier to copy. 97862d49-6c9e-4c0b-8caf-199c36668c5f-image.png

                                    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
                                      afinch @d.healey
                                      last edited by

                                      @d-healey I thought I had added the reference in the muter script, and will do!

                                      A 1 Reply Last reply Reply Quote 0
                                      • A
                                        afinch @afinch
                                        last edited by

                                        @d-healey am I working in the correct script editor, should I be working in the sampler one?

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

                                          @afinch Yes it should be the script you've added in the sampler

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

                                          1 Reply Last reply Reply Quote 0
                                          • A
                                            afinch @afinch
                                            last edited by afinch

                                            @d-healey I am expecting the knob to cause 'Ignore all events' to toggle off.Screenshot (199).png

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

                                            61

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.7k

                                            Posts