HISE Logo Forum
    • Categories
    • Register
    • Login

    Factory Preset Creator

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    45 Posts 3 Posters 10.0k 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.
    • d.healeyD
      d.healey
      last edited by d.healey

      I've finally finished the first version of my factory preset handler. This script should probably be the first script in the project and loaded into the master container, but it might work in other places too. The idea is it will save the state of all of your project's samplers, midi processors, effects, and modulators, and then reload them when a preset is selected from the preset browser. You can enter the name of the Bank and Category you want to store the preset it and also enter the name of the preset - the Bank and Category must already have been created in the standard preset browser before you enter them in the script (maybe we can get the script to provide a list of the available banks and categories, Christoph?).

      /**
       * Title: Factory Preset Creator v1.0.1.js
       * Author: David Healey
       * Date: 02/07/2017
       * Modified: 19/07/2017
       * License: GPLv3 - https://www.gnu.org/licenses/gpl-3.0.en.html
      */
      
      //INIT
      Content.setHeight(100);
      
      // Create a storage panel, hide it, and save it in the preset
      const var storagePanel = Content.addPanel("storagePanel", 0, 0);
      storagePanel.set("visible", false);
      storagePanel.set("saveInPreset", true);
      
      // Create object that will hold the preset values all modules.
      global userPresetData = {};
      
      // Set the global storage as widget value for the hidden panel.
      // Important: this will not clone the object but share a reference!
      storagePanel.setValue(userPresetData);
      
      const var samplerIds = Synth.getIdList("Sampler");
      const var effectIds = Synth.getIdList("Effect");
      const var modulatorIds = Synth.getIdList("Modulator");
      const var midiProcessorIds = Synth.getIdList("Script Processor");
      
      const var samplers = [];
      const var effects = [];
      const var modulators = [];
      const var midiProcessors = [];
      
      for (s in samplerIds)
      {
      	samplers.push(Synth.getChildSynth(s));
      }
      
      for (e in effectIds)
      {
      	effects.push(Synth.getEffect(e));
      }
      
      for (m in modulatorIds)
      {
      	modulators.push(Synth.getModulator(m));
      }
      
      for (i = 1; i < midiProcessorIds.length; i++) //Skips first processor which should be this script
      {
      	midiProcessors.push(Synth.getMidiProcessor(midiProcessorIds[i]));
      }
      
      //GUI
      const var headings = [Content.addLabel("Label1", 0, 5), Content.addLabel("Label2", 150, 5), Content.addLabel("Label3", 300, 5)];
      const var inputs = [Content.addLabel("Bank", 0, 25), Content.addLabel("Category", 150, 25), Content.addLabel("Name", 300, 25)];
      for (i = 0; i < 3; i++)
      {
      	headings[i].set("textColour", 4278190080);
      	headings[i].set("saveInPreset", false);
      	headings[i].set("editable", false);
      
      	inputs[i].set("bgColour", 4285953654);
      	inputs[i].set("textColour", 4278190080);
      	inputs[i].set("editable", true);
      }
      headings[0].setValue("Bank");
      headings[1].setValue("Category");
      headings[2].setValue("Name");
      
      const var save = Content.addButton("Save", 450, 10);
      save.set("saveInPreset", false);
      
      //FUNCTIONS
      function savePreset()
      {
      	for (i = 0; i < samplers.length; i++)
      	{
      		if (userPresetData.samplers == void) userPresetData.samplers = [];
      		userPresetData.samplers[i] = samplers[i].exportState();
      	}
      
      	for (i = 0; i < effects.length; i++)
      	{
      		if (userPresetData.effects == void) userPresetData.effects = [];
      		userPresetData.effects[i] = effects[i].exportState();
      	}
      
      	for (i = 0; i < modulators.length; i++)
      	{
      		if (userPresetData.modulators == void) userPresetData.modulators = [];
      		userPresetData.modulators[i] = modulators[i].exportState();
      	}
      
      	for (i = 0; i < midiProcessors.length; i++)
      	{
      		if (userPresetData.midiProcessors == void) userPresetData.midiProcessors = [];
      		userPresetData.midiProcessors[i] = midiProcessors[i].exportState();
      	}
      
      	Content.storeAllControlsAsPreset(inputs[0].getValue() + "/" + inputs[1].getValue() + "/" + inputs[2].getValue() + ".preset");
      }
      
      function restorePreset()
      {
      	userPresetData = storagePanel.getValue(); //Restore from panel
      
      	if (userPresetData.samplers.length > 0)
      	{
      		for (i = 0; i < samplers.length; i++)
      		{
      			samplers[i].restoreState(userPresetData.samplers[i]);
      		}
      	}
      
      	if (userPresetData.effects.length > 0)
      	{
      		for (i = 0; i < effects.length; i++)
      		{
      			effects[i].restoreState(userPresetData.effects[i]);
      		}
      	}
      
      	if (userPresetData.modulators.length > 0)
      	{
      		for (i = 0; i < modulators.length; i++)
      		{
      			modulators[i].restoreState(userPresetData.modulators[i]);
      		}
      	}
      
      	if (userPresetData.midiProcessors.length > 0)
      	{
      		for (i = 0; i < midiProcessors.length; i++)
      		{
      			midiProcessors[i].restoreState(userPresetData.midiProcessors[i]);
      		}
      	}
      }
      
      //CALLBACKS
      function onNoteOn()
      {
      	
      }
      function onNoteOff()
      {
      	
      }
      function onController()
      {
      	
      }
      function onTimer()
      {
      	
      }
      function onControl(number, value)
      {
      	switch(number)
      	{
      		case storagePanel:
      			restorePreset();
      		break;
      
      		case save:
      			savePreset();
      			save.setValue(0);
      		break;
      	}
      }
      
      HiseSnippet 3088.3oc6ZktbiabDFb2kNqnOJ6TtRkehnJUEsq1kDf2RabxxSQJdHHBRpCWa4LDX.HHwEAFPHRW6uyqSdDxiTdCRlA.jD7RGthcb4X8ic0zGy708Lc2C5QbVFBPaaCKpHeZ2YlPpHeVT9Y5ngkFBTzopWlJxKixYAsgHphyLA11PQpHQd9YDtQN3ETd+7u9qEAp.cA3JRTT8MTDfMUzTPqnx89FJppUAhvtJZgjN86qKXnWxP0vAijmGkgxDHLFHCaCHh8rnTSUft1TQXhlJYbqwrClWHN4mhwW7Syx2JmVEL1sp+XIOAnDbrrf5n9X0ohDMx+F+SjnUDUPFV7H.BhmynEMDmwOzvU2eo6qXqLPERFvRwiwjO455HnkDP.FRzpFphDGB42oJMTQUjagC0lBOybqbuO22890QaoHprj9J27W5wfdkFgc2Qd15P9EqAY18A4G.dQBAuW3CuuJJufkhIZEGB19cQw1Md4m4eRnFPWTEtNB8Ui5Y+ouLZhW+5XzultqBREdJcUeMo8UklnKzhdJabl3rwGYSjrfCZng0ozkASUDoqAApvYD5kwF6ozLISvjKQRF1bDZsLDUjTfhmRydRX5MwG1zswheFWyooneK8PDxz9zDIbcciKq6D2vRNgpuP1IjMUeaJLBf5wGhzTi85DwhkHQ8106FqjAdeVGEWCLFV0BOX499QY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qUSfDtJFkeeezHUddAwygoQd9L+LL93YuEjaoHvYfcl33HRRmnu6mFi9mh0PCHXY7cBAuDB189ROJXqT26uLrCh1hLllM7GHS5M62IHPhbeK9Hwt0H4SViTOYMR+j0HySVirOYMx8j0H+8nA41IEbPFZ94won9O.0A13HC
      

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

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        Nice work. It must be quite difficult considering the moving target type of the preset system these days :)

        However I still disagree with you on what's a user preset - in my definition it's just a collection of frontend interface values (and this is what the in built preset system of HISE offers). With your script a user preset becomes much more powerful because it can change the entire structure of a HISE preset, which might lead to unwanted side effects (maybe even a bit like the dead lock issues Hasan was struggling the last days).

        BTW, not sure what the labels are doing, but I started to merge the layout system with the frontend interface system so you can add a FloatingTile widget to a script which can be populated by almost any component (preset browser, virtual keyboard, settings dialogue). This example shows how to embed the actual preset browser directly in the interface:

        Content.setHeight(400);
        
        const var FloatingTile = Content.addFloatingTile("FloatingTile", 20, 20);
        // [JSON FloatingTile]
        Content.setPropertiesFromJSON("FloatingTile", {
          "width": 694,
          "height": 366
        });
        // [/JSON FloatingTile]
        
        const var presetBrowserData = {
          "Type": "PresetBrowser",
          "StyleData": {
          	"highlightColour": "0xFFFF0000",
          	"backgroundColour": "0xFF333333"
          }
        };
        
        FloatingTile.setContentData(presetBrowserData);
        

        This system is currently completely undocumented and highly experimental (and I expect that there will be some breaking changes until it gets to a stable point), but this will be the way to go for building interfaces with HISE in the future.

        1 Reply Last reply Reply Quote 1
        • d.healeyD
          d.healey
          last edited by d.healey

          Well I agree with you fully that user presets should be for the user to save their front end values, I feel though that we need a system for developers to create different setups of their instruments that go beyond what the user preset system is intended for.

          Other than hacking the preset system I can't see a way to allow the user to switch instruments from a single VSTi. With instruments than only require sample maps to be swapped it's not such a big deal but when working on a varied collection of instruments, where modulators, effects, scripts, etc. also change from instrument to instrument, incorporating all the various parameter settings into the front end script isn't practical. With Kontakt I'd just create a separate NKI for each instrument but using the preset browser seems so much better than providing lots of individual VSTis.

          So I think this little preset hack is the simplest way and can be easily dropped in to any project to allow a developer to create a detailed variation of their instrument that is easy for the user to load.

          The labels are for entering the Bank, Category, and Name of the preset. So if I want to save a piccolo preset I might enter "Woodwind", "Flutes", "Piccolo". The only problem I found was that the Bank and Category had to have already been created as the save preset function doesn't create the folder structure.

          The new floating tile system seems very interesting. Does its introduction mean you'll be removing the standard header with the preset browser? And the default on-screen keyboard?

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

          1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart
            last edited by

            I admit this might be useful in certain scenarios. But be prepared for some hiccups as there are a lot of things happening when creating modules and its impossible to predict all combinations.

            I think adding / removing or changing states of modulators and effects should come without problems, but as soon as you change a sound generator, it will trigger a global recompile of all scripts and this might cause some very nasty issues with multithreading.

            Can't you use the preset browser instead of the labels? The preset browser just assumes a two level folder hierarchy for Banks and Categories and would be perfectly capable to do these things without having to write script code for this. I am offering these functions for user preset handling on the script side:

            • load next / previous user preset
            • save user preset (with a given name)
            • open the preset browser
            • get the name of the currently loaded preset.

            The floating tile system will indeed replace both the virtual keyboard as well as the top bar (in fact it already has, because I removed these components from the compiled interface a few days ago).

            However everything that can be found there can be put into a floating tile, so if you've fallen in love with the top bar - which would be a little bit awkward :), you can still recreate it, but customise it better.

            The reason for this decision was that almost everybody wants to fully customise the whole appearance of the plugin's interface. I'd rather provide a collection of ready made C++ components that can be shuffled together using the JSON data from the HISE layout.

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

              Oh I just got what you mean about using the preset browser instead, that makes so much more sense :)

              When you mention changing sound generators does that mean restoring their state or adding/removing them from the instrument? I'm thinking I might just be able to live with swapping out the sample maps and not worry about saving their state - although might be an issue if two presets need a different number of RR groups.

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

              1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart
                last edited by

                RR Groups should actually be saved within the SampleMap - if that is not the case, it's a bug and will be fixed :)

                1 Reply Last reply Reply Quote 1
                • d.healeyD
                  d.healey
                  last edited by

                  Aha that should make things easier

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

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

                    It's just occurred to me why I'm not using the built in preset browser, that will only work with the front end script so won't work with this script. I've just been trying to implement this script in a project and already I've run into a problem with it not restoring MIDI processors. One element that will likely vary between different sample sets for many instruments is the playable key range and the key-switch range and I'm currently adding that functionality with a separate script that keeps everything nice and modular but to do it with the built in preset system I'd lose the modularity. I'm again thinking it will just be easier to use a separate VSTi for each instrument although as we both know that won't be as convenient for the user.

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

                    1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart
                      last edited by Christoph Hart

                      Why not wrap it in a namespace and offer this in an external file that can be used from the frontend interface directly?

                      And changing the key colours dynamically when swapping sample maps should be no problem (just store the data in an array that correlates to the sample map list).

                      And if you want to change attributes of a MIDI processor, you could also directly set its attributes instead of restoring the whole thing.

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

                        The namespace idea is good. The problem with storing the attributes of the MIDI processors is there are a lot of MIDI processors in some of my instruments, if there was a way to iterate through all of the attributes of each MIDI processor then that would be practical as it could then easily be automated in a loop but currently I'd have to do it manually for each processor and it would vary between projects.

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

                        1 Reply Last reply Reply Quote 0
                        • Christoph HartC
                          Christoph Hart
                          last edited by

                          Well, you can just create arrays with values that have the same length as the MIDI processor has attributes and go crazy with for loops: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J8+tx5xxkdzmmbIi65bo4+QBY4UJUSgBuIhSqdbZZUu.hGliHfS9BU4gEJNxj+i8PK.1GDisSAv+9m9zet0hC1ZRv+0VKb4vCUSt6nz5A+655gmYdKpGLJuHp6r.0E.0c86SEQZ2SJhlagSs6mENKL3tE.usk0eWVUGzfCyKJvQTrqGYmhoJfDjBEeGHCfgDwU46jbIZExnzVgLK6vZAo6STOgHbGTNeqTBegS+6Z9l1XYC0W66icEYjsl5d+7ssKxkfJ+DKRPnWbnC74V+JzC8QQC6Aso6hAlPovGHJ6qthLSNYtgbtLxzCS8LF2zcpRS4bkTkliUhF53xYuyMIgT155Cik.bhF+G.TW8P4bcywYhRdOD5K6cttx.w2BLubDcVZDVKMhtKMhmszHVeoQ77kFwKlCBYSv6DIXCSJKPn+C..59Q1
                          
                          1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey
                            last edited by

                            Thanks for the code example. I think though that this still requires that I know in advance how many attributes each script processor has and I need to keep track of these manually. If we could do a for loop type thing to iterate over an arbitrary number of attributes then a few lines of code could handle any number of scripts with any number of attributes and the values of the attributes could be saved automatically into the user preset. Maybe I'm looking at this the wrong way though, I'll play around some more with your script example.

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

                            1 Reply Last reply Reply Quote 0
                            • Christoph HartC
                              Christoph Hart
                              last edited by

                              You need to know the number of attributes anyway when you create the preset data, or am I missing the point?

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

                                Yes currently I would need to know the number of attributes, but if we had a function that could give us the number of attributes for a script then I could do something like this.

                                for (s in scripts)
                                {
                                	for (i = 0; i < s.numAttributes; i++)
                                	{
                                		presetData[i] = s.getAttribute(i);
                                	}
                                }
                                

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

                                1 Reply Last reply Reply Quote 0
                                • Christoph HartC
                                  Christoph Hart
                                  last edited by

                                  Ah yes, that makes sense (I thought you're creating those by hand, but for this approach, you'll need a getNumAttributes() method). I'll add this tomorrow.

                                  1 Reply Last reply Reply Quote 1
                                  • d.healeyD
                                    d.healey
                                    last edited by

                                    Thanks Christoph, should be very useful :)

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

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

                                      Could this getNumAttributes() function also work for other modules such as effects, modulators, and envelopes too?

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

                                      1 Reply Last reply Reply Quote 0
                                      • Christoph HartC
                                        Christoph Hart
                                        last edited by

                                        Yes of course...

                                        1 Reply Last reply Reply Quote 1
                                        • Christoph HartC
                                          Christoph Hart
                                          last edited by

                                          Alright, the changes are pushed to the repository.

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

                                            Excellent, building now!

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

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

                                            47

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.9k

                                            Posts