Forum
    • Categories
    • Register
    • Login

    Piano Pedal Behavior

    Scheduled Pinned Locked Moved Scripting
    9 Posts 4 Posters 1.1k 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.
    • nouslouN
      nouslou
      last edited by

      Hi everyone! Have a samplers in my piano project which have pedal down and up samples. I use midimuters and my script looks like (I put it into my pedal up and down samplers):

      function onController()
      {
      
      	if (Synth.isSustainPedalDown() == true) {
      		muteup.setAttribute(0, 1);
      	}
      	if (Synth.isSustainPedalDown() == false) {	
      		muteup.setAttribute(0, 1);
      		Synth.playNote(0, 100);	
      	}
      	
      }
      

      Pedal up and down samples are working just fine with my sustain pedal. But the problem is now this script reacts to all others midi controller knobs :) For example I can touch my Pitch Bend - and while I use it - pedal down and up samples are sounds too etc. How can I change this script to react only on sustain pedal? Thank you!

      1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey
        last edited by

        Add an if statement to check if the cc number is 64

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        nouslouN 1 Reply Last reply Reply Quote 1
        • nouslouN
          nouslou @David Healey
          last edited by

          @d-healey should it looks like this?

          if (CCNumber == 64)
          {
                  if "my code"
          }
          
          ustkU David HealeyD 2 Replies Last reply Reply Quote 0
          • ustkU
            ustk @nouslou
            last edited by ustk

            @nouslou Yes

            and just for better coding style,

            This:

            if (Synth.isSustainPedalDown() == true) {
            	// blabla
            }
            if (Synth.isSustainPedalDown() == false) {	
            	// blabla
            }
            

            is equal to this:

            if (Synth.isSustainPedalDown())
            {
            
            }
            else
            {
            
            }
            

            In fact, it's not even equal because in your case both statements or evaluated when it is necessary to do it only once

            Hise made me an F5 dude, any other app just suffers...

            1 Reply Last reply Reply Quote 1
            • David HealeyD
              David Healey @nouslou
              last edited by

              @nouslou Yup

              Free HISE Bootcamp Full Course for beginners.
              YouTube Channel - Public HISE tutorials
              My Patreon - HISE tutorials

              nouslouN 1 Reply Last reply Reply Quote 1
              • nouslouN
                nouslou @David Healey
                last edited by

                @d-healey Somehow it doesn't work:

                Screen Shot 2022-01-27 at 5.28.09 PM.png

                I mean if I write

                if (CCNumber == 64)
                

                Even pedal samples stop to work. Am I blind somewhere? :)

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

                  @nouslou

                  if (CCNumber == 64)
                  

                  Where is CCNumber coming from?

                  to "read" a CCNumber you need to use:

                  Message.getControllerNumber()
                  

                  -- its in the API documentation, you may also need:

                  Message.getControllerValue()
                  

                  at some point....

                  so your code should read

                  if (Message.getControllerNumber() == 64)
                  
                  

                  HISE Development for hire.
                  www.channelrobot.com

                  nouslouN 2 Replies Last reply Reply Quote 1
                  • nouslouN
                    nouslou @Lindon
                    last edited by

                    @lindon now I got it!

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

                      @lindon @d-healey @ustk Guys, you are all brilliant! Thank you very much as always!

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

                      14

                      Online

                      2.1k

                      Users

                      13.2k

                      Topics

                      114.4k

                      Posts