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

    Posts

    Recent Best Controversial
    • 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
    • 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
    • RE: need some help with artificial note on events

      @d-healey
      Well, I had a feeling that cramming everything into one script and ignoring the module tree was not the intended approach.. 😅 I guess I have some work to do then.
      I only got into HISE because I want to realize an idea for a midi processor, so until now I haven’t touched anything other than the script editor and some graphics functions.. I’m not quite sure how I would use set attribute in my case, the interface will have to trigger a lot of smaller functions and change variables, can I somehow expose these as attributes in my script processor?

      posted in Scripting
      P
      prehm
    • RE: need some help with artificial note on events

      @d-healey
      Hey man,
      Thanks for your quick reply!
      I‘ll try that when I get home.
      The reason I wanted to use messages instead of synth.playnote is that I want to have the option to alter the detune value (btw thanks for uploading part 2 of the microtuning video, it was me who asked for that :))
      So if I understand correctly, I would have to create a child processor for my midi stuff?
      Sorry I realize it’s a very basic question but how would I access variables from the interface script from inside that child processor and vice versa? I‘m working on a midi fx plugin so my whole interface is tied to the logic part

      posted in Scripting
      P
      prehm
    • need some help with artificial note on events

      hey there,
      I've been reading as much as i could find about this topic but i can't seem to wrap my head around it.

      my general setup is this: user inputs a midi note -> my script does something -> the original note plus additional notes should be put out.

      as far as i understood, i can use Message.makeArtificial() to create a new event that can be manipulated savely. so thats what I do first. then my script for generating notes kicks in (which works fine). I have an object for each additional voice that stores some data, including the note that should be sent out and a Message holder object. all of these voice objects are stored in an array.

      i then iterate over the array, storing the original Message inside the respective Message Holder object with Message.makeArtificialOrLocal() (i need individual event IDs) and Message.store(), then changing the note to its new value from within that same object using setNoteNumber().
      Then I use Synth.addMessageFromHolder() to trigger the generated notes.

      thats all fine, however the noteOffs dont work. I tried using Synth.noteOffByEventId() and referring to the message Holders event ID with .getEventID(), but it doesnt work.
      I also tried using MessageHolder.setType to change the event to a noteOff and then Synth.addMessageFromHolder(), but nothing happens.

      Also using Synth.attachNote only seems to work for one additional Note.

      I can get all notes to stop when I use the same ID for all of them, however I need individual IDs because notes are not necessarily triggered all at once.

      any help would be very appreciated!

      cheers :)

      posted in Scripting
      P
      prehm
    • changing properties of lottie json object

      hey there,
      i'm looking for a good way to realize an idea for a UI object that needs some state dependent animations with gradients, masks and shadows.
      all this is new territory for me but as far as i understood, lottie animations are loaded as json objects so i wonder if there is a way to change the position and scaling of vector elements by overwriting their state inside the json from within HISE?
      would that be possible?
      chees :)

      posted in Scripting
      P
      prehm
    • RE: Mask does not scale properly on HiDPI or Retina display

      @aaronventure
      Cool, thanks for the hint.
      I am new to programming so I‘ll have to read into that..

      posted in Bug Reports
      P
      prehm
    • RE: Mask does not scale properly on HiDPI or Retina display

      @ustk
      That’s a bummer.
      What’s wrong with blur? Seemed fine the one time I tried it

      posted in Bug Reports
      P
      prehm
    • RE: Mask does not scale properly on HiDPI or Retina display

      does this mean masks are basically unusable?
      i really need this feature..

      posted in Bug Reports
      P
      prehm
    • combining paths

      hello there,
      maybe a noob question, but i am stuck here..

      i am creating a custom keyboard and I have all the key areas saved in an array.
      I want to be able to add a drop shadow that highlights a scale on the keyboard. my intention is to combine the areas of all rectangles that fit the scale to a single path object (or multiple if there is a gap), so that the shadow will enclose adjacent keys.

      I created a path with Content.createPath and tried iterating over the array that contains the areas using a loop and path.addRectangle, but the path data always only shows a single rectangle ( four values).

      any hints?

      cheers :)

      Edit:
      okay so i managed to draw that path (using g.drawpath) and it works fine, but when I add the same data to g.drawDropShadowFromPath i get an error: Point is not an array

      posted in Scripting
      P
      prehm
    • RE: noob question: UI component.set()

      @HISEnberg
      oh very cool thanks!
      so if i understand correctly, using obj.data allows me to define control data that couldn't be set using the UI json object? or is the data object also limited to specific properties?

      posted in Scripting
      P
      prehm