HISE Logo Forum
    • Categories
    • Register
    • Login
    1. HISE
    2. Fergler
    F
    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 40
    • Groups 0

    Fergler

    @Fergler

    4
    Reputation
    10
    Profile views
    40
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    Fergler Unfollow Follow

    Best posts made by Fergler

    • RE: Hihat Full Choke Senario? Is That Possible in Hise??? Finaly Yes!

      Adding my code as well for anyone looking to do hihats from GM layout, but support e-kit that uses CC4 to open/close note 46 for tip and note 26 for edge:

      onInit function and declarations:

      // Create a midilist with 128 elements
      const var midiData = Engine.createMidiList();
      // This count will manage our position in the midilist
      var count = 0;
      
      const TipTranslations = [70, 69, 68, 67, 66];
      const ShoulderTranslations = [64, 63, 62, 61, 60];
      
      function getTranslatedNote(input, cc4Value) {
          var translatedNote = input;  
      
          var translation = (input == 46) ? TipTranslations : (input == 26) ? ShoulderTranslations : null;
      
          if (translation != null) {
              for (i = 0; i < cc4Ranges.length; i++) {
                  if (cc4Value >= cc4Ranges[i][0] && cc4Value <= cc4Ranges[i][1]) {
                      translatedNote = translation[i];
                      break;
                  }
              }
          }
      
          return translatedNote;
      }
      
      function onNoteOn()
      {
          var input = Message.getNoteNumber();
          var id = Message.getEventId();
          var weight;
          
          // Get the translated note number
          var newMsg = getTranslatedNote(input, cc4Value);
          
          // Send the modified note
          Message.setNoteNumber(newMsg);
          
          // Check if the note number is within the specified range or matches specific values
          if ((newMsg >= 60 && newMsg <= 70) || newMsg == 44 || newMsg == 73 || newMsg == 42)
          {
              // Assign weights based on note number
              switch(newMsg) {
                  case 70:
                  case 64:
                      weight = 5;
                      break;
                  case 69:
                  case 63:
                      weight = 4;
                      break;
                  case 68:
                  case 62:
                      weight = 3;
                      break;
                  case 67:
                  case 61:
                      weight = 2;
                      break;
                  case 60:
                  case 66:
                      weight = 1;
                      break;
                  case 44:
                  case 73:
                      weight = 1;
                      break;
                  default:
                      weight = 1;
              }
      
              // Calculate the indices for the midilist
              var index1 = count * 2;
              var index2 = index1 + 1;
      
              // Store event ID and weight in the midilist
              midiData.setValue(index1, id);
              midiData.setValue(index2, weight);
      
              // Increment and reset count as necessary
              count = (count + 1) % 64;
      
              // Loop through midilist weights
              for (var i = 1; i < 128; i += 2)
              {
                  var storedWeight = midiData.getValue(i);
                  if (storedWeight > weight)  // Checking weights at odd indices
                  {
                      var storedId = midiData.getValue(i - 1);  // Retrieve the event ID from the previous index
                      Synth.addVolumeFade(storedId, 150, -60);  // 150 ms fade to -60 dB
                      //Console.print("Killed notes: " + storedId);
      
                      // Set weight to 0 to mark as "killed" and skip in future checks
                      midiData.setValue(i, 0);
                  }
              }
          }
      }
      
      
      
      function onController()
      {
          var number = Message.getControllerNumber();
          var value = Message.getControllerValue();
          
          if (number == 4) 
          {
              cc4Value = value;
          }
      }
      

      This could be improved to change the fade time/amount depending on the weight difference (which I probably will to control open > less open vs open to full closed, and to generate new transition sounds (hihat rattling) when closing the pedal after a recent open hit.

      posted in Scripting
      F
      Fergler
    • RE: What filetypes and channel sizes are supported?

      @d-healey

      It’s achieved; I’m loading samples based on their tokens and creating a module structure. Right now I’m only loading one mic (OH_M) and there are 6 other mic positions to load later with multimic. I should probably investigate doing it manually and exporting the sample map to see how it is represented there, if it is.

      const
      var dataObj = Engine.loadFromJSON("../ArticulationData.json");
      
      include("UI.js");
      
      
      
      function createModule(type, name, parent) {
          if (type.toLowerCase() == "sampler") {
              var type = builder.SoundGenerators.StreamingSampler;
          } else {
              var type = builder.SoundGenerators.SynthChain;
          }
      
          var module = builder.create(type, name, parent, builder.ChainIndexes.Direct);
          return module;
      }
      
      
      function createSampleObj(fName, note1, note2, loVel, hiVel, RRGroup /*(j+1)*/ , Duplicate /*0*/ ) {
          var obj = {
              FileName: fName,
              Root: note1,
              LoKey: note1,
              HiKey: note1,
              LoVel: loVel,
              HiVel: hiVel,
              RRGroup: RRGroup,
              Duplicate: Duplicate
          };
      
          return obj
      }
      
      var builder = Synth.createBuilder();
      builder.clear();
      
      var sampleMap = [];
      var stopper = 0;
      for (group in dataObj) {
          
          stopper++;
          
          
          var groupSampler = createModule("Sampler", group, 0);
                  include("SetSamplerAttributes.js");
      
      
          sampleMap = [];
          for (hit in dataObj[group]) {
      	    
              var rrGroups = dataObj[group][hit].RRGroups;
              var rrSize = dataObj[group][hit].RRSize;
              var Layers = dataObj[group][hit].Layers;
              var note1 = dataObj[group][hit].Note1;
              var note2 = dataObj[group][hit].Note2;
      			
      		
      		var count = 0;	
              for (i = 0; i < rrGroups; i++) { // for each rrGroup
      			
      			
                  for (j = 0; j < rrSize && count < Layers; j++) {
      	            count++;
                  
                  	include("SampleSortConsolePrint.js");
      
                      var fName = "{PROJECT_FOLDER}" + group + "-" + hit + "-OH_M-" + count + ".wav";
                      
                      include("VelocityMath.js");
      
                      var obj = createSampleObj(fName, note1, note2, loVel, hiVel, (j+1), 0);
                      
                      sampleMap.push(obj);
      
                      if (count == Layers) { // only saves complete sample sets until overflow logic is complete
                      //Console.print("test");
                          Engine.dumpAsJSON(sampleMap, group + ".json");
                      }
                  }
                  Synth.getSampler(group).loadSampleMapFromJSON(sampleMap);
              }
          }
      
          if (stopper > 4) break // Let's take it slow
      }
      
      builder.flush();
      

      Working good!

      posted in General Questions
      F
      Fergler
    • RE: applyMask behaves differently at different UI scales

      Another interesting thing. Content.createScreenshot will take a screenshot but the results have different mask scaling than the UI, even when my zoom is at 100% and everything looks correct.

      posted in Bug Reports
      F
      Fergler

    Latest posts made by Fergler

    • Content.createScreenshot takes wrong zoom scale

      I have figured out (thanks to the Mask bug where the zoom scale breaks Masks in LAFs: https://forum.hise.audio/topic/9420/applymask-behaves-differently-at-different-ui-scales/14?_=1746122139523 ) that createScreenshot is working on a different zoom level than the actual interface. This includes display of masked objects but also Blur, which renders at a different amount. You can see the effect of this here:

      Double Blur issue.mov

      favicon

      Google Docs (drive.google.com)

      Middle segment is the blurring occurring on interface in real time, and then the last segment is the screenshot that I am loading in its place (to reduce lag) showing the Blur is very different. You would also see broken linear sliders if I hadn't already fixed that manually with a compensation.

      posted in Bug Reports
      F
      Fergler
    • RE: What do I do now - Compiling on Sonoma

      @d-healey Thanks, simultaneously I just found this thread:
      https://forum.hise.audio/topic/9830/attaching-text-json-files-to-the-compiled-binary/6

      I really assumed that I could load data like this but that's ok - I will do the suggestion in there of checking for a file and falling back to a default object if not found, at least for the resets/presets code. The main data I can definitely move to a .js no problem. The main data of my entire script including samplers came from a JSON file and I was tricked into thinking it was working fine because the samplers are created at compile with the correct data, and so I figure the UI was as well. No wonder absolutely nothing has been working correctly.

      posted in General Questions
      F
      Fergler
    • RE: What do I do now - Compiling on Sonoma

      @d-healey Ah ok. So huge critical misunderstanding about Engine.loadFromJSON then.

      I guess then all I need to do is add one more step to save the finished .push()'d string to as a const and use that. Not at the computer right now to test butI think that will clear things up.

      posted in General Questions
      F
      Fergler
    • RE: What do I do now - Compiling on Sonoma

      @d-healey "If the combo boxes are empty it implies your json isn't loaded correctly in the compiled plugin." I mean.. yeah? :D But I need a way to trace why this is.. the issue is really why is it fine in HISE but breaking in compile. I have no way to explore why this is happening except to try different iterations.

      As for local vs var, these are not within an inline function so I can't. Are you then suggesting I move all this into an inline function?

      For my understanding:

      When I declare the const of Engine.loadFromJSON(), I am writing this object into the compiled program, not passing a reference to a real file in the real time code - correct?

      posted in General Questions
      F
      Fergler
    • RE: What do I do now - Compiling on Sonoma

      So I removed 4/5ths of my UI as a test, and I did get a compile. Interesting though - I have two issues with what remains in AU vs what's in preview.

      1. Combo boxes do not have contents. Their contents should be coming from an array converted to a string with new lines.
      2. Some images I put on the GUI have incorrect X values when they use a global integer in their calculation.

      For 1, here is the code: Anything jump out to anyone?

      const resetJSON = Engine.loadFromJSON("../Reset.json");
      const presetsJSON = Engine.loadFromJSON("../Presets.json");
      
      const jsonObj = { "Reset": resetJSON, "Presets": presetsJSON };
      
      var resetChoices = [];
      var presetsChoices = [];
      
      for (choice in resetJSON) resetChoices.push(choice);
      for (choice in presetsJSON) presetsChoices.push(choice);
      
      resetChoices = resetChoices.join("\n");
      presetsChoices = presetsChoices.join("\n");
      
      const comboH = 22;
      
      const resetCombo = Content.addComboBox("Reset", 10, 4);
      Content.setPropertiesFromJSON("Reset", {
          "width": 60,
          "items": resetChoices,
          "height": comboH,
          "parentComponent": "Header",
          "bgColour": 0,
          "itemColour": defaultColour,
          "itemColour2": 0,
          "textColour": defaultColour,
      });
      
      const presetsCombo = Content.addComboBox("Presets", 76, 4);
      Content.setPropertiesFromJSON("Presets", {
          "width": 68,
          "items": presetsChoices,
          "height": comboH,
          "parentComponent": "Header",
          "bgColour": 0,
          "itemColour": defaultColour,
          "itemColour2": 0,
          "textColour": defaultColour,
      });
      
      inline function setValues(json, c) {
          for (k in json) {
              if (k.contains("FaderPack")) {
                  Content.getComponent(k).setAllValues(json[k]);
              } else {
                  Content.getComponent(k).setValue(json[k]);
              }
          }
          c.setValue(0);
      }
      
      inline function onSetControl(c, value) {
          if (value > 0) {
      	    local id = c.getId();
              local selection = c.getItemText();
          	local json = jsonObj[id][selection];
              setValues(json, c);
          }
      }
      Content.getComponent("Reset").setControlCallback(onSetControl);
      Content.getComponent("Presets").setControlCallback(onSetControl);
      
      posted in General Questions
      F
      Fergler
    • What do I do now - Compiling on Sonoma

      The docs say to use 13.1 or below of Xcode but it won't run on my computer.

      Using Xcode 15, my exported AU is instant crashing any DAW it's in, with EXC_BAD_ACCESS (SIGSEGV)

      I don't know where to go from here. Any ideas?

      posted in General Questions
      F
      Fergler
    • RE: applyMask behaves differently at different UI scales

      Another interesting thing. Content.createScreenshot will take a screenshot but the results have different mask scaling than the UI, even when my zoom is at 100% and everything looks correct.

      posted in Bug Reports
      F
      Fergler
    • RE: Can you add line number for error "You must specify the unique component name, not the object itself”?

      @d-healey

      I edited to fix completely tired misinformation etc in my post but yes I had a bunch of regs left over from misusing them and basically haven’t bothered since this is in module and UI builder code but yes I’ll change them.

      Taking a 5 month leave from working on this has not been great :D

      posted in Scripting
      F
      Fergler
    • RE: Can you add line number for error "You must specify the unique component name, not the object itself”?

      Parent is a string, I should have included my function call:

      Quickset.createPreset("Close Skins", "Close Skins", "QS Dropdown", 0, 1, [
      ["KickPunch", 0.5],
      ["SnarePunch", 1],
      ]);

      That’s where I’m getting so confused, I can’t find any objects that could be throwing this error. :/

      DHealey
      In this case it’s because otherwise I get "Can't reference inline function parameters in nested function body” with some other things going on next to it.

      Efficiency is not an issue in this part as it’s all develop only generation of the UI XML, this code won’t ship.

      posted in Scripting
      F
      Fergler
    • RE: SliderPack LAF

      Is there a way to get the the sliderpack index to influence the LAF when using drawLinearSlider? For example to compare index to an const array of names to print different text on each slider within the sliderpack

      posted in General Questions
      F
      Fergler