Manually KeyColour



  • I have already searched everything here and found nothing to color the KeyColour for individual keys MANUALLY different.
    For example:
    C1 red
    D1 yellow
    C3 - C5 green
    F5 blue



  • @MikeB https://docs.hise.audio/tutorials/recipes/ui/general.html#colour-the-keyboard

    Content.makeFrontInterface(500, 400);
    
    
    Engine.setKeyColour(12, 0X55FF0000);
    
    Engine.setKeyColour(14, 0X55FFFF3E);
    
    Engine.setKeyColour(41, 0X550000FF);
    
    for(i =24; i < 37; i++)
    {
    
        Engine.setKeyColour(i, 0X5500FF00);    
    }
    

    May be there is many more optimized method ( writing less code) yet it is another solution.
    KBC.jpg



  • Super - Thank you Tanja
    I need the colors for this key when pressed. But I found a way in your link.

    Attached Snippet -
    Keyrange change color when pressing key
    Keyrange change Colour permanent (your script)
    Ignore played notes outside keyrange

    SingleKey change Colour when key is pressed
    SingleKey change Colour permanent (your script)

    HiseSnippet 1634.3oc4XszaaaDDlz1rshopnoHnnGWDzCxINxT9krqaZ7KIGiDGqZ473VvZxkhKL0trKWYGgDCTf9Go+TxodoW5Ok7OvcVtjlT1xJJtHAEs7fs240N6LeyNy5VBtKINlKLLKcP+Hhg4WZ0tOSFrY.lxL1YKCyaZ0X68POhzGsIOj2SfL1neDNNl3YXZN41JwLKMkQx26dvF3PLykjSxv3YbpK4wztTYN0Vq8HZXXSrG4.Z2BRuvZ63xY5MxvbRKGiHr6Q3NjmfUhMgkg4m0viJ4h1RrjDaXN0Fbu9sC3mvzx+LZL8vPhZQMi1fgzjaxC8TdrhpwlAzPuVYG8XCCSqV4AhI0AhaYsK0idN87.xWmv.kqQw3g4Dix8pUz8bFe2yrf6Mk18toUaWAMRlyQ4a2vZGljH7wPJnnaok0Xhxet0lbPBlrZW7QjlBXw4ZTYIGmYPK53L8pksKaO6rwDIBGFhXbIAwYHmx1HetnBEcejypHJ5GQ0lqN7G28tSW190.W3qAqCkQpB5BXFclrBclTvSb0Snxf0CiBvUNmR.URlA4Tc5oWUYfx1mtZxuTt.XiC4Xgm.y5PP9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bc2aZ0hJcCFt+NwP7WnN8is+l9hixVM78APTtyNkUyW7w+4EEckuR6J2vpMbwexKASbjuMYM54PwJZaBiHTA0Zi3kf+039Rvnw9kf56JN.pmii3wCX31jtzCfKGiKRTUzIH+RRUdQ5aBv6gx5cOnIbHGpNswxdhD3x5c48XxAfGSN14jOfWjN0+peQ5mtKGlb7b22yilKk4isociBIMXGSBgdtI932Xk1tHi5f35c4LdT.mQcKlz2mHEzNcHhh99POPqKkP6lbJ2Zs8IgDbQ.72u1iAfGVn50bMiE0F+XwnxWemk1cQphQz+MtTex+edo99vCifgB2EC.UXDPKXHq1vcotjzQGTi6ZNg59P8ZG0Z8koLujEvTdmkxrlZsYJyZYL+jrGcwtB9Kc0CxqvxeQBE3byR9eBVxZW0ZTMijg6A8rbp5XzEtQ7kttpv88f3yv0YtqgNyeMzYgqgNKdMzYoqgN0uF5r7H0Q0LZ8dvv45RQfPqFIuIvzrACCH4DTuweCXRqavG



  • @MikeB
    You code needs some correction. The code you have written.. Not working here.. I guess because of function onNoteOff() and function onNoteOn() are wriiten in onInit section.

    Content.makeFrontInterface(600, 500);
    
    //set all note on 0
    for(i = 0; i < 127; i++)
    {
       Engine.setKeyColour(i, Colours.withAlpha(Colours.white, 0.));    
    };   
    
    //Keyboardrange from/to
    const var knbLow = 48
    const var knbHigh = 73 
    //single Notes
    const var blue = 40
    const var red = 41
    
    
    
    /*//Script - Set Keycolour always-----------------
    Engine.setKeyColour(12, 0X55FF0000);
    Engine.setKeyColour(14, 0X55FFFF3E);
    Engine.setKeyColour(41, 0X550000FF);
    
    for(i =24; i < 37; i++)
    {
    
       Engine.setKeyColour(i, 0X5500FF00);    
    } */ 
    
    
    
    function onNoteOn()
    {
       //n = NoteNumber
       local n = Message.getNoteNumber();
       
       if (n < knbLow || n > knbHigh)
       //ignore notes outside this range
           Message.ignoreEvent(true);
       
       else{
       //note inside range colour green    
           Engine.setKeyColour(n, 0x7700FF00);
       }
       //singlenote colour set
       if (n == hold)
           Engine.setKeyColour(blue, 0x9000ff00);
    
       if (n == stutter1)
           Engine.setKeyColour(red, 0x9000ffff);
    
    
             
    }
    
    
    
    
    function onNoteOff()
    {
       
       //n = NoteNumber
       local n = Message.getNoteNumber();
       //ignore notes outside this range
       if (n < knbLow || n > knbHigh)
       //ignor notes outside this range
           Message.ignoreEvent(true);
       
       else{
       //note inside range colour Reset       
           Engine.setKeyColour(n, Colours.withAlpha(Colours.white, 0.));
       }
       //singlenote colour reset
       if (n == blue)
           Engine.setKeyColour(hold, Colours.withAlpha(Colours.white, 0.));
    
       if (n == red)
           Engine.setKeyColour(stutter1, Colours.withAlpha(Colours.white, 0.));
    }
    
    Interface:! onNoteOff() - Line 19, column 28: API call with undefined parameter 0 {SW50ZXJmYWNlfG9uTm90ZU9mZigpfDUzN3wxOXwyOA==}
    Interface:! onNoteOff() - Line 16, column 28: API call with undefined parameter 0 {SW50ZXJmYWNlfG9uTm90ZU9mZigpfDQ0M3wxNnwyOA==}
    Interface:! onNoteOff() - Line 16, column 28: API call with undefined parameter 0 {SW50ZXJmYWNlfG9uTm90ZU9mZigpfDQ0M3wxNnwyOA==}
    Interface:! onNoteOff() - Line 19, column 28: API call with undefined parameter 0 {SW50ZXJmYWNlfG9uTm90ZU9mZigpfDUzN3wxOXwyOA==}
    
    


  • @MikeB

    HiseSnippet 1643.3oc4XszaaaDDlz1LshopnoHnnGWDzCxINRT9sqaZ7KIGiDG6Z473VvZxkhKL0trjqriPhAJP+izeJ4TuzK8mR9G3N6tjlTNxJxBHAEs7fs240N6Leyry58i4tjjDdrgYoC6EQLL+JqV8XhfMCvTlwNaYXdKqFauG5wjdnM4g7twHiM5EgSRHdFllStsTLyRSYn9d+C2.GhYtjbRFFOmScIOg1gJxot+ZOlFF1D6QNj1ofzyu1NtbldiLLmzxwHB6dLtM4oXoXSXYXdiFdTAOtk.KHIFlSsA2qWq.9oLs7OmlPOJjHWT2nEXHM4l7POoGKoZrY.Mza+ridhggo094AhI0AhaasK0idA87.x2nXf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5lzuxaQ7wcCEqGEQvwxwRA1xxXM2MBgQKAqc.D03.GmpKth5a4kcVZEmkpqE6Pdan3ZWtGoeiKGBDFJjwHgR+QS7YIjmSbAnTAGJeGAtMCwhVhdgW1X62HKQ8AL.TYrHeml8BFMXdEbfEgwlLNUFguH2576qEPf9e4Cd+a30xygyIyV+4u7HEmTLnFvYacArw3CG8DF.l60ENH8OUr7o.oLfpt9F+TNhIzZTzq3SE9jLp7n5t2xZepvMXv96DCveg5zO09a5COJa0v2G.Q4N6TVMe4m9WYTzU9ZsqbSqVPWb0CBUNx2oVidATrh1lvHwxfZ8g7fv+dTePXzH+fPcuhCg54jHdReFtEoC8Pn4XRQhxhtXxuppxKReS.dOPVu+gMgC4.0oEVzMVAWVuCuKSzG7XxQNmbMdX5T+q9goe9ZNL4n4tej2NWJyGaQ6DERZvNgDB24p7wu0J85hLp8iq2ky3QAbF0sXR+.hHl1tMItnuOvCz5BAbcSNkau1AjPBtH.9GV6I.vCGKuqYLiE0G8XwvxWeuk1cQxhQz+MZpO4+Oape.7NGXnvcw.PEFAzBFxpEzK0kjN5fbbWyIj8C0qcjq0MSYdpEvTdmmxrtbsYJy5YL+rrGcvtw7W4pGjWhk+REE3byT+qAKYsqbMptgZ3dPOK3QDFcfNhux0UFtuODeFrNyNF5L2Xny7igNKLF5r3XnyRigNKOTcjWFsdWX3bcoHPX+Fp2DXZ1fgAjrB0a7OXNebLJ
    


  • I know - I left it in the onInit for clarity.




Log in to reply
 

10
Online

1.3k
Users

4.2k
Topics

38.3k
Posts