HISE Logo Forum
    • Categories
    • Register
    • Login

    Automatic limit keys on keyboard (floatTile)

    Scheduled Pinned Locked Moved General Questions
    10 Posts 4 Posters 386 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.
    • Gabriel StroziG
      Gabriel Strozi
      last edited by

      Hello HISE Community!
      I want to make my keyboard looks like that below, showing the notes outside the sampler range with black shadow:

      f7277839-2d84-481d-8917-b3f02cddeeaa-image.png

      I managed to use panels to do that, like this:
      96e27cde-4e06-4105-9f4f-d70a1d348336-image.png

      But it is not efficient at all. There are any way to make it easily?

      Thanks in advance!

      Brazilian composer, music producer and mechanical engineer. Working in a steel idiophonic instruments sampler.

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

        @Gabriel-Strozi There are functions to set the color of individual keys, check the api docs

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

        1 Reply Last reply Reply Quote 0
        • Gabriel StroziG
          Gabriel Strozi
          last edited by

          The problem is that I don't even know what API is 馃槩

          Could you give me more info about this way to go, please? How do I use those functions? Where can I find those functions?

          I'm learning a lot of new concepts of programming with this project. I really appreciate if you could give more info!

          Thanks!

          Brazilian composer, music producer and mechanical engineer. Working in a steel idiophonic instruments sampler.

          1 Reply Last reply Reply Quote 0
          • Gabriel StroziG
            Gabriel Strozi
            last edited by

            Would it be the Engine.setKeyColour() ?

            Brazilian composer, music producer and mechanical engineer. Working in a steel idiophonic instruments sampler.

            1 Reply Last reply Reply Quote 0
            • Gabriel StroziG
              Gabriel Strozi
              last edited by

              I managed Engine.setKeyColour() to work by clicking a button.

              I'm thinking of creating a loop to check what key have samples loaded, using Sampler.isNoteNumberMapped(). You think it is a good way?

              Brazilian composer, music producer and mechanical engineer. Working in a steel idiophonic instruments sampler.

              1 Reply Last reply Reply Quote 0
              • Gabriel StroziG
                Gabriel Strozi
                last edited by

                I found the way!
                On load sample map function I called:

                 for (i = 0; i < 128; i++)
                        {
                            Console.print(i);
                            var x = Instrumento.isNoteNumberMapped(i);
                            if (x == 1)
                            {
                                Engine.setKeyColour(i, 0x00000000);
                            }
                            else
                                Engine.setKeyColour(i, 0x90000000);
                        }
                

                I'm really happy that I figured out by myself how to do that, of course you some footprints you gave me @d-healey !

                Thanks you so much!

                Brazilian composer, music producer and mechanical engineer. Working in a steel idiophonic instruments sampler.

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

                  @Gabriel-Strozi just to give a hint on scripting basics (but I strongly suggest you watch @d-healey videos)

                  This

                  for (i = 0; i < 128; i++)
                  {
                      var x = Instrumento.isNoteNumberMapped(i);
                  
                      if (x == 1)
                      {
                          Engine.setKeyColour(i, 0x00000000);
                      }
                      else
                          Engine.setKeyColour(i, 0x90000000);
                  }
                  

                  Since the variable xis boolean, can be replaced directly

                  for (i = 0; i < 128; i++)
                  {
                      if  (Instrumento.isNoteNumberMapped(i))
                          Engine.setKeyColour(i, 0x00000000);
                      else
                          Engine.setKeyColour(i, 0x90000000);
                  }
                  

                  You could also have set the colour with a ternary operator:

                  for (i = 0; i < 128; i++)
                  {
                      var colour = Instrumento.isNoteNumberMapped(i) ? 0x00000000 : 0x90000000; 
                      Engine.setKeyColour(i, colour);
                  }
                  

                  And the whole thing can be replaced:

                  for (i = 0; i < 128; i++)
                  {
                      Engine.setKeyColour(i, Instrumento.isNoteNumberMapped(i) ? 0x00000000 : 0x90000000);
                  }
                  

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

                  Gabriel StroziG 1 Reply Last reply Reply Quote 4
                  • Gabriel StroziG
                    Gabriel Strozi @ustk
                    last edited by

                    @ustk Wowwwww! Just blowed my mind! hahaha
                    Thank so much for the hints! It makes much more clean and sustainable code!
                    I'll replace a lot of lines that I wrote with this kind of scripting structure.

                    And yes, I'm watching all the @d-healey videos on replay hahah

                    Brazilian composer, music producer and mechanical engineer. Working in a steel idiophonic instruments sampler.

                    1 Reply Last reply Reply Quote 1
                    • D
                      DearieSamson
                      last edited by

                      I also tried on my music player.

                      D 1 Reply Last reply Reply Quote 0
                      • D
                        DearieSamson @DearieSamson
                        last edited by

                        @DearieSamson said in Automatic limit keys on keyboard (floatTile):

                        I also tried on my music player.

                        El vaig instal路lar al meu ordinador com a to de trucada mp3 a klingeltone-kostenlos.de

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

                        49

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        101.8k

                        Posts