HISE Logo Forum
    • Categories
    • Register
    • Login

    Midi Script Processor Help

    Scheduled Pinned Locked Moved General Questions
    6 Posts 3 Posters 274 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.
    • DanHD
      DanH
      last edited by

      I'd like my c3 and c4 octaves to play the c2 octave (if that makes sense, so you get the same notes in those 3 octaves).

      Is there an easier way than writing out multiple if statements like the below?

      function onNoteOn()
      {
      	if (Message.getNoteNumber() == 60)
      	 {
      		 Message.setNoteNumber(48);
      	 }
      }
      

      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
      https://dhplugins.com/ | https://dcbreaks.com/
      London, UK

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

        @danh

        Is there an easier way than writing out multiple if statements like the below?

        There's always an easier way than multiple if statements - a switch statement :p But in this case I don't think you need to do that.

        Why not just put something like

        local n = Message.getNoteNumber();
        
        if (n >= 60)
        {
           Message.setNoteNumber(n - 24);
        }
        

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

        1 Reply Last reply Reply Quote 1
        • ustkU
          ustk @DanH
          last edited by ustk

          @danh Something like this might be a good begining

          function onNoteOn()
          {
          	if (Message.getNoteNumber() >= 60)
          	{
          		if (Message.getNoteNumber() < 72)
          			Message.setNoteNumber(Message.getNoteNumber()-12);
          		else
          			Message.setNoteNumber(Message.getNoteNumber()-24);
          	}
          }
          

          As @d-healey said, instead of multiple if, a function that recognizes the octave and applies a down factor would be much better

          Can't help pressing F5 in the forum...

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

            @ustk Are you crazy... this is Dan, don't give him examples without curly braces, he's not ready for that! :p

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

            ustkU 1 Reply Last reply Reply Quote 2
            • ustkU
              ustk @d.healey
              last edited by

              @d-healey 🤣 poor Dan!

              Can't help pressing F5 in the forum...

              DanHD 1 Reply Last reply Reply Quote 0
              • DanHD
                DanH @ustk
                last edited by

                @ustk @d-healey thanks both {}

                DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                https://dhplugins.com/ | https://dcbreaks.com/
                London, UK

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

                33

                Online

                1.8k

                Users

                12.0k

                Topics

                104.1k

                Posts