HISE Logo Forum
    • Categories
    • Register
    • Login
    1. HISE
    2. prehm
    P
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 29
    • Groups 0

    prehm

    @prehm

    1
    Reputation
    4
    Profile views
    29
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    prehm Unfollow Follow

    Best posts made by prehm

    • RE: need some help with artificial note on events

      @d-healey
      Thanks, your advice is much appreciated.
      So far everything works just fine and I was surprised to find that all the calculations that my script does for every note on take less than half a millisecond at a buffer size of 128, which is great. My first attempt in pure data was unusable in terms of latency..
      I’ve started using namespaces and external script files to keep everything nice and tidy, thanks to your video on the topic.
      There is a lot more stuff for me to learn but it’s very exciting to know that I have all the tools I need to make it real.
      Cheers!

      posted in Scripting
      P
      prehm

    Latest posts made by prehm

    • RE: how to get the areas of a floating tile keyboard into an array

      okay so if anybody ever runs into this problem, i am sure there is a better way but here is how i did it:

      the keyOffsets array was created by setting the key with to a size where one octave spans 100 pixels and then using the midi list approach from above to get percentage values for each left edge.

      since the keyWidth of the fltKeyboard is stored in a separate string that contains all the other properties that can be set from the property editor, i had to do some string juggeling to separate the first number that comes up (which is the key width, luckily) that parse that as a float. multiply that by 7 and there is one octave width in pixels, regardless of that key size is set. then i used a loop to add the consecutive percentage values up and here we go.

      probably convoluted, but it works :)

      const keyOffsets = [0.08, 0.06, 0.11, 0.04, 0.14, 0.07, 0.07, 0.09, 0.05, 0.12, 0.03, 0.14];
      
      var v = 0;
      var kbd = keyboard.get("Data");
      kbd = kbd.substring(kbd.indexOf(":")+2, kbd.indexOf(","));
      var octaveWidth = parseFloat(kbd) * 7;
      
      
      for (i=24; i<120; i++)
      {
      	keysLeft.setValue(i, v);
      	v += octaveWidth * keyOffsets[i%12];
      }
      
      posted in Scripting
      P
      prehm
    • RE: how to get the areas of a floating tile keyboard into an array

      @Chazrox
      Yes, but that width only applies to the white keys. When you look at the chromatic scale, the edges are not spaced evenly

      posted in Scripting
      P
      prehm
    • RE: how to get the areas of a floating tile keyboard into an array

      @d-healey
      I don’t intent to set anything functional from inside the LAF. My question was if there is any other way to get the key areas, other than using the obj.area inside the LAF. The midi list just serves

      posted in Scripting
      P
      prehm
    • RE: how to get the areas of a floating tile keyboard into an array

      @d-healey
      Just to be clear - I have my logic in place and working, what I need is a visual representation of the selected note range and a way for the user to change it, because up until now I did that manually inside the code. I could use combo boxes but I‘d prefer something more intuitive to use.. I think counting pixels the is way to go 💁‍♂️🫡

      posted in Scripting
      P
      prehm
    • RE: how to get the areas of a floating tile keyboard into an array

      i guess i will just go ahead and count the offsets manually for one octave.. seems tedious but hey 🤣

      posted in Scripting
      P
      prehm
    • RE: how to get the areas of a floating tile keyboard into an array

      @d-healey right, but black and white notes are not spaced evenly within one octave, and i would like the handles of my slider to always be positioned above a key (so that they jump to the next position, instead of a smooth drag). thats why i want the edges available as fixed points

      posted in Scripting
      P
      prehm
    • RE: how to get the areas of a floating tile keyboard into an array

      @d-healey limiting the range of notes that can get generated from the note that is played

      posted in Scripting
      P
      prehm
    • RE: how to get the areas of a floating tile keyboard into an array

      @d-healey yes that, but more importantly they set a range of available notes in my script

      posted in Scripting
      P
      prehm
    • RE: how to get the areas of a floating tile keyboard into an array

      @d-healey
      i want to have a slider above the fltKeyboard with handles on the left and right edges, which can be dragged and will lock into position to specify a range of keys

      posted in Scripting
      P
      prehm
    • how to get the areas of a floating tile keyboard into an array

      hey there,
      i would like to do the above.
      i thought i would get away with using a register function and storing the left and right edges of my keys in a midi list like so:

      const keysLeft = Engine.createMidiList();
      const keysRight = Engine.createMidiList();
      
      kbLAF.registerFunction("drawBlackNote", function(g, obj)
      {
          keysLeft.setValue(obj.noteNumber, obj.area[0]);
          keysRight.setValue(obj.noteNumber, obj.area[0]+obj.area[2]);
          
          var a = obj.area;
          for (i=0; i<3; i++)
          	a[i] -=1;
          	
          g.setColour(Colours.black);
          g.fillRoundedRectangle(obj.area, 2);
      });
      
      kbLAF.registerFunction("drawWhiteNote", function(g, obj)
      {
          keysLeft.setValue(obj.noteNumber, obj.area[0]);
          keysRight.setValue(obj.noteNumber, obj.area[0]+obj.area[2]);
          
          var a = obj.area;
          for (i=0; i<3; i++)
          	a[i] -=1;
          g.setColour(Colours.white);
          g.fillRect(a);
      });
      

      i want to use these in a different script panel.
      when i hit compile, the midi lists are filled properly, however it seems as if the register function is executed at the very end because using Console.print() to show one of the values immediately after the code above returns -1.

      is there a better way to access the key areas?

      cheers!

      posted in Scripting
      P
      prehm