HISE Logo Forum
    • Categories
    • Register
    • Login

    Filter/display sampleMap names by _prefix

    Scheduled Pinned Locked Moved Scripting
    24 Posts 4 Posters 1.6k 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.
    • ten7kurT
      ten7kur @ustk
      last edited by ten7kur

      @ustk said in Filter/display sampleMap names by _prefix:

      @ten7kur You can either use String.replace(var substringToLookFor, var replacement) or String.substring(int startIndex, int endIndex) since the samplemap list is an array of strings

      So?....

      sampleMapList.replace(sampleMapList "BD_", sampleMapList " ");
      SamplemapList.set("items", sampleMapList.join("\n"));
      

      Im puzzled on the 'var's

      1 Reply Last reply Reply Quote 0
      • ustkU
        ustk
        last edited by

        @ten7kur said in Filter/display sampleMap names by _prefix:

        So?....

        I am not sure it will work if you directly edit the items in the samplemapList, the risk is that it won't be able to locate the samplemaps if the name doesn't correspond to the reality anymore...
        If you just want to display the formatted names, fill a second array "formattedSamplemaps" with the applied filter from the original samplemapList

        Can't help pressing F5 in the forum...

        ten7kurT 1 Reply Last reply Reply Quote 0
        • ten7kurT
          ten7kur @ustk
          last edited by

          @ustk said in Filter/display sampleMap names by _prefix:

          formattedSamplemaps

          I've done this but can't compile successfully:

          //! =================== [ Samplemap List ] ================== !
          const var SamplemapList = Content.addViewport("SamplemapList", 0, 0);
          
          
          const var Sampler = Synth.getSampler("Sampler");
          const var sampleMapList = Sampler.getSampleMapList();
          
          var formattedSamplemaps = [];
          
          //String.replace(var substringToLookFor, var replacement)
          sampleMapList.replace(sampleMapList "BD_", formattedSamplemaps " ");
          
          
          //
          SamplemapList.set("items", formattedSamplemaps.join("\n"));
          
          inline function onViewportControl(component, value)
          {
              Sampler.loadSampleMap(sampleMapList[value]);	
          };
          
          SamplemapList.setControlCallback(onViewportControl);
          
          
          

          Could you please show me an example?

          1 Reply Last reply Reply Quote 0
          • ustkU
            ustk
            last edited by

            Actually, it's a bit more subtle if you want to make operation in an array, you should do this in FOR loop that iterates each member of the array.
            I'll try to find the time to write something today

            Can't help pressing F5 in the forum...

            1 Reply Last reply Reply Quote 0
            • ustkU
              ustk
              last edited by

              @ten7kur That's you ;)

              //! =================== [ Samplemap List ] ================== !
              const var SamplemapList = Content.addViewport("SamplemapList", 0, 0);
              
              // Allow the viewport to list the items
              SamplemapList.set("useList", true);
              
              const var Sampler = Synth.getSampler("Sampler");
              const var sampleMapList = Sampler.getSampleMapList();
              
              
              // Populate the formatted list in a new array
              const var formattedSamplemaps = [];
              
              for (i = 0; i < sampleMapList.length; i++){
                  
                  var newName = sampleMapList[i];
                  newName = newName.replace("BD_", "");
                  
                  formattedSamplemaps.push(newName);
              }
              
              // Update the viewport
              SamplemapList.set("items", formattedSamplemaps.join("\n"));
              

              Can't help pressing F5 in the forum...

              ten7kurT 1 Reply Last reply Reply Quote 0
              • ten7kurT
                ten7kur @ustk
                last edited by

                @ustk
                hmm...doesnt seem to work....
                Although I can see/partly-understand the logic

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

                  I don't know the solution at present as I haven't looked too much at your code, but I will when I have some free time if somebody else doesn't help you solve it.

                  However I noticed some things

                  const var sampleMapListFILTER

                  sampleMapListFILT.indexOf(sampleMapList, "BD");

                  The second one should be FILTER not FILT.

                  In a later post I see this

                  const var SamplemapList = Content.addViewport("SamplemapList", 0, 0);

                  const var sampleMapList = Sampler.getSampleMapList();

                  Those names are going to cause confusion, luckily HISEscript is case sensitive so the code will work, but it's bad practice. For the first one try something like vpSampleMaps (vp = viewport).

                  Also stick to one format, sampleMapListFILTER is weird - why all caps at the end? and SamplemapList - why does it start with a capital when your other variable names don't?

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

                  ten7kurT 1 Reply Last reply Reply Quote 0
                  • ten7kurT
                    ten7kur @d.healey
                    last edited by ten7kur

                    @d-healey said in Filter/display sampleMap names by _prefix:

                    ar sampleMapListFILTE

                    Yes, I agree! :) 👍
                    Some of the code was commented out. I was playing with it before....

                    @ustk 's example looks like it should definitely work , it does ADD text, but does not remove BD_

                    ten7kurT 1 Reply Last reply Reply Quote 0
                    • ten7kurT
                      ten7kur @ten7kur
                      last edited by ten7kur

                      @ten7kur
                      No sorry, It does work! Brilliant!!!! Big big thanks!

                      How could I also escape directories?
                      I have sampleMaps inside folders inside my SampleMaps folder in my Project.

                      ustkU 1 Reply Last reply Reply Quote 0
                      • ustkU
                        ustk @ten7kur
                        last edited by

                        @ten7kur Strange, it effectively removes the "BD_" part here...
                        I am not sure it's a good idea to make subfolders for the samplemaps...

                        Can't help pressing F5 in the forum...

                        ten7kurT 1 Reply Last reply Reply Quote 0
                        • ten7kurT
                          ten7kur @ustk
                          last edited by ten7kur

                          @ustk
                          It does work!
                          But how could I remove the other sounds "SD_", "HH_" from display all together. Just display the BD_ filter.

                          OK. Fair enough on sampleMap subfolders

                          1 Reply Last reply Reply Quote 0
                          • ustkU
                            ustk
                            last edited by ustk

                            @ten7kur there are two ways:

                            • Replace newName = newName.replace("BD_", ""); with newName = newName.substring(3, 100); if you always have 3 characters to remove at the beginning.

                            • Or use this instead of the loop in my first example:

                            // String part you don't need
                            const var charsToRemove = ["BD_", "HH_", "SD_"];
                            
                            
                            for (i = 0; i < sampleMapList.length; i++){
                                
                                var newName = sampleMapList[i];
                                
                                for (j = 0; j < charsToRemove.length; j++){
                                    
                                    newName = newName.replace(charsToRemove[j], "");
                                }
                                
                                formattedSamplemaps.push(newName);
                            }
                            

                            The latter allows you to fill the "forbidden" array with any characters you want to remove

                            Can't help pressing F5 in the forum...

                            ten7kurT 1 Reply Last reply Reply Quote 1
                            • ten7kurT
                              ten7kur @ustk
                              last edited by

                              @ustk
                              👍 👍 👍
                              Wouldn't have figured it out my self! Not with my current Javascript knowhow...

                              ten7kurT 1 Reply Last reply Reply Quote 0
                              • ten7kurT
                                ten7kur @ten7kur
                                last edited by

                                @ten7kur

                                Looking at this further, the filtration of BD_, SD_,etc..works. However, once I click on an item in the list, it does not change it in the sampler. (The sampler name is correct)
                                Im using this code:

                                inline function onViewportControl(component, value)
                                {
                                    Sampler.loadSampleMap(formattedSamplemaps[value]);	
                                };
                                
                                SamplemapList.setControlCallback(onViewportControl);
                                
                                ten7kurT 1 Reply Last reply Reply Quote 0
                                • ten7kurT
                                  ten7kur @ten7kur
                                  last edited by

                                  @ten7kur

                                  How could I also hide specific sample maps. So only show "BD_", or only "SD_".
                                  How would I 'categorize' them?

                                  1 Reply Last reply Reply Quote 0
                                  • ustkU
                                    ustk
                                    last edited by

                                    @ten7kur If you think about it, you are trying to load a sample map with a wrong name...
                                    hint: DoesformattedSamplemaps contains the real .xml samplemap names? ;)

                                    For your second question, it will be a bit complicated...
                                    Ok, for loading a samplemap, you need to call its name
                                    But, here, for doing so, you are using a value and look at the table the real name that corresponds to this value in order to load the SM (hidden hint for question one ;) )

                                    In YOUR case (because there are different way to do it), you'll need to split the samplemapList list into several subSamplemapList depending on characters they contain in their name

                                    Then you can format these names to remove what you don't like into, let say, FormattedSubSamplemapList

                                    Then you can load them in different viewports
                                    The value of these viewports will correspond to the different subSamplemapLists you can use to load the right SM

                                    Can't help pressing F5 in the forum...

                                    ten7kurT 1 Reply Last reply Reply Quote 0
                                    • ten7kurT
                                      ten7kur @ustk
                                      last edited by ten7kur

                                      @ustk said in Filter/display sampleMap names by _prefix:

                                      n their

                                      Got ya on the sampleMap loading.!

                                      As for assigning categories,.... still a little puzzled.. 😕

                                      const var charsToRemove = ["BD_", "HH_", "SD_"];
                                      const var smCategories = ["BD_", "HH_", "SD_"];
                                      
                                      for (i = 0; i < sampleMapList.length; i++)
                                          {
                                          var newName = sampleMapList[i];
                                          var category = sampleMapList[i];
                                          
                                          for (j = 0; j < charsToRemove.length; j++)
                                              {
                                              newName = newName.replace(charsToRemove[j], "");
                                              category = category.substring(smCategories[j], "SD_");
                                              }
                                          formattedSamplemaps.push(newName);
                                          formattedSamplemaps.push(category);
                                          }
                                      

                                      🤔

                                      Wouldn't indexOf be of help here?
                                      So far I'm thinking ....

                                      for (i = 0; i < sampleMapList.length; i++)
                                          {
                                          var category = sampleMapList[i];
                                          
                                          for (j = 0; j == smCategories;)
                                              {
                                              category = category.indexOf(smCategories["SD_"], "snare");
                                              }
                                          formattedSamplemaps.push(category);
                                          } 
                                      
                                      

                                      Any help, very much appreciated!!🤞😀

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

                                        The String.split method is the missing piece:

                                        
                                        const var names = ["SN_One", "BD_One", "BD_Two", "SN_Two"];
                                        
                                        // this will hold the samplenames sorted by category
                                        var obj = {};
                                        
                                        for(n in names)
                                        {
                                            // This splits the string into a list using the given separator
                                            var sp = n.split("_");
                                        
                                            var category = sp[0];
                                            var sampleName = sp[1];
                                        
                                            // We can check if the category is already used
                                            if(isDefined(obj[category]))
                                                obj[category].push(sampleName); // append to the existing list
                                            else
                                                obj[category] = [sampleName]; // create a new list at the key
                                        }
                                        
                                        ten7kurT 1 Reply Last reply Reply Quote 1
                                        • ten7kurT
                                          ten7kur @Christoph Hart
                                          last edited by ten7kur

                                          @Christoph-Hart
                                          Thanks for your input. Really appreciate it!
                                          The code is working, but only partly. I don't quite understand what exactly is happening.

                                          At the moment the viewport only is displaying BD and second item xx1. [BD_xx1 was the last item in ''var names'' that I added before pressing compile].

                                          It seems like its listing the category. But I can't see the other categories.... Im somewhat confused...

                                          Im trying to show the categories in a different Viewport to pick from so I could see the sampleMaps[hopefully] but can't quite get it right to display. The category viewport shows items but the items all have the 'undefined' text.

                                          Full code:

                                          Content.makeFrontInterface(600, 500);
                                          
                                          //! =================== [ Samplemap List ] ================== !
                                          const var SamplemapList = Content.getComponent("SamplemapList");
                                          
                                          // Allow the viewport to list the items
                                          SamplemapList.set("useList", true);
                                          
                                          const var Sampler = Synth.getSampler("Sampler");
                                          const var sampleMapList = Sampler.getSampleMapList();
                                          
                                          const var names = ["SD_one", "SD_two", "SD_oi", "BD_one", "BD_Three", "BD_Four", "BDs_one", "BD_xx", "BD_xx1"];//, "SN_Two", "SN_Three", "HH_oneone"];
                                          
                                          // this will hold the samplenames sorted by category
                                          var obj = {};
                                          
                                          for(n in names)
                                          {
                                              // This splits the string into a list using the given separator
                                              var sp = n.split("_");
                                          
                                              var DRUM_category = sp[0];
                                              var DRUM_sampleName = sp[1];
                                          
                                              // We can check if the category is already used
                                              if(isDefined(obj[DRUM_category]))
                                                  obj[DRUM_category].push(sampleName); // append to the existing list
                                              else
                                                  obj[DRUM_category] = [sampleName]; // create a new list at the key
                                          }
                                          // Update the viewport
                                          SamplemapList.set("items", sp.join("\n"));
                                          
                                          // Load samplemap
                                          inline function onViewportControl(component, value)
                                          {
                                              Sampler.loadSampleMap(sampleMapList[value]);	
                                          };
                                          SamplemapList.setControlCallback(onViewportControl);
                                          //! =================== [ /Samplemap List ] ================== !
                                          
                                          
                                          const var cats = Content.getComponent("cats");
                                          // Allow the viewport to list the items
                                          cats.set("useList", true);
                                          // We can check if the category is already used
                                              if( (obj[DRUM_category]));
                                          
                                          // Update the viewport
                                          cats.set("items", obj[DRUM_category].join("\n"));
                                          
                                          HiseSnippet 3220.3oc6Zr1aaibjzNL2IcQWyc3.Z+RA1HTfHi5yVRNw2iff5XYmytW7CXojqstFtqEWIwKjbIHo7iKH.4GR6+g6mP+sb+B526GZmYWtbIodXEm3qosQAHl6r6L6ryL67hb+PdWVTDOzvrTmKBXFl2xp8E9wCZMf53ar8FFl+Bq1Tu.W1Nzfm3DEar9EAznHlsgo47eCtHyR2vP76e76Vm5R86xzfLLdF2oK6INdNwZn6u125359XpMqiiWlUeu01tK2uE2kODXn4spaDP69bZe1tTbYyYYXdyMsch4gsiowrHCyarN29h1C3m4KW+ybhbNwkgCZXzFHjD7i4t1HGiPMZMvw0de0AOxvvzZesXXdoX3yr1ww1IEtVbbawDDMFYkGlyMM1qQV1q9rydlYXuaHYuOwpc2PmfX8LHu8QVa6GyB6QAUPV1RtVi49m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mTwig4G8Z8h+OO8k1SBV6hreyjwrywugRq8EsfOx3LG63AoK3u3s1.F95FRg7imtVf6v9N96SCAwQLKb2DohhBhBn.KTq02n74m2vHorKPNYZBDf55z22SbFtokKqWLJBROVe3r7YHj4zPyeZJrW4OLu5OU7vXb7ZIb6JVPcCxNCUdFeJGeeyY5yeXBL9qdzZIbpk4.XrhKsL+kFuUx2vb9L9Z0eXsWKeXouMBiZN2X3W7CD4Zlem0XvWSeStuYUVck+voCl4Ob5bERoV1eesrkPof9iqkq3I8dMl5lTS9gqUnnI8QoPES5IRKWReFGoVI8TpBkzPzUIogkqDIomjQJRRu52opP51fW2i+VGHu3s3mYeQyQ9.09fY6CTCH29TP.jYkq6zOcqjPzVyYJPUvXY934Mt1pO6mgagWu9ame1XWiqoBBMmOa4fYuRjVKnl2G6ARUEnBxmsVZIfJP+l0xV92URVzX1kEugUL9ecwIm++6iSdkp08cQ87DJT9mUVcFJg0xbNLDaZQrVXzQUYrVl+K3mtNVYryjJYkSNKUaaNWRs1ZS5WyBsei4x2Wv8+KVvs47F+a4jjGWA
                                          

                                          Thanks for any/all help!!

                                          1 Reply Last reply Reply Quote 0
                                          • ten7kurT
                                            ten7kur
                                            last edited by

                                            Hi all!
                                            I need help!! I can't manage to get the categories working. theres something I'm not doing right..Could someone please have a look over this code and see where its going wrong?

                                            problem 1.
                                            The sampleMaps List is not taking effect of the categorisation.
                                            It should for "BD_Ludwig_Jazz1.xml" take "BD_" and put it inside its own "drm_category" and "Ludwig" in its own "drm_sampleName" and display only sampleMap:"Jazz1" but its not working...
                                            What am I missing?
                                            @ustk ? @Christoph-Hart ?

                                            problem 2. The categories them selves (CAT1, CAT2) are not displaying correct.
                                            I can only ever see 1 items in the CAT1, CAT2 viewports.
                                            Why could this be?

                                            Pardon my Javascript skills,
                                            Thanks!

                                            // =================== [ Samplemap List ] ================== //
                                            const var SamplemapList = Content.getComponent("SamplemapList");
                                            const var SamplemapList_CAT1 = Content.getComponent("SamplemapList_CAT1");
                                            const var SamplemapList_CAT2 = Content.getComponent("SamplemapList_CAT2");
                                            
                                            // Allow the viewport to list the items
                                            SamplemapList.set("useList", true);
                                            SamplemapList_CAT1.set("useList", true);
                                            SamplemapList_CAT2.set("useList", true);
                                            
                                            
                                            const var Sampler = Synth.getSampler("Sampler");
                                            const var sampleMapList = Sampler.getSampleMapList();
                                            
                                            // Populate the formatted list in a new array
                                            const var formattedSamplemaps = [];
                                            
                                            
                                            // Remove string from sampleMap name
                                            const var charsToRemove = ["BD_", "HH_", "SD_"];
                                            
                                            for (i = 0; i < sampleMapList.length; i++)
                                                {
                                                var newName = sampleMapList[i];
                                                
                                                for (j = 0; j < charsToRemove.length; j++)
                                                    {
                                                    newName = newName.replace(charsToRemove[j], "");
                                                    }
                                                formattedSamplemaps.push(newName);
                                                }
                                                
                                                
                                            // put under category
                                            const var names = ["BD_Ludwig", "BD_Xyz1", "SD_TamaSLP", "SD_Ludwig"];
                                                   
                                            for (i = 0; i < sampleMapList.length; i++)
                                                {	
                                                var newCatSplit = sampleMapList[i];
                                                
                                                for (j = 0; j < names.length; j++)
                                                    {
                                                    // this will hold the samplenames sorted by category
                                                    var obj = {};
                                            
                                                    for(n in names)
                                                        {
                                                        // This splits the string into a list using the given separator
                                                        var sp = n.split("_");
                                            
                                                        var drm_category = sp[0];
                                                        var drm_sampleName = sp[1];
                                            
                                                        // We can check if the category is already used
                                                        if(isDefined(obj[drm_category]))
                                                            obj[drm_category].push(drm_sampleName); // append to the existing list
                                                        else
                                                            obj[drm_category] = [drm_sampleName]; // create a new list at the key
                                                
                                                            
                                                        newCatSplit = newCatSplit.replace(names[j], "");
                                                        }
                                                    formattedSamplemaps.push(newCatSplit);
                                                    }
                                            	//sampleMapList[i].set("visible", false);
                                                }
                                            		
                                                
                                            // Update the viewport
                                            SamplemapList.set("items", formattedSamplemaps.join("\n"));
                                            
                                            
                                            // Load sampleMap
                                            inline function onSamplemapListControl(component, value)
                                            {
                                                Sampler.loadSampleMap(sampleMapList[value]);	
                                            };
                                            Content.getComponent("SamplemapList").setControlCallback(onSamplemapListControl);
                                            // =================== [ /Samplemap List ] ================== //
                                            
                                            
                                            
                                            
                                            
                                            // ============== [ Samplemap List Categories ] ================== //
                                            
                                            // Drum Type; BD, SD, HH, etc
                                             inline function onSamplemapList_CAT1Control(component, value)
                                            {
                                            	SamplemapList_CAT1.set("items", [drm_category].join("\n"));
                                            	SamplemapList_CAT2.set("items", [drm_sampleName].join("\n"));	
                                            };
                                            Content.getComponent("SamplemapList_CAT1").setControlCallback(onSamplemapList_CAT1Control);
                                            
                                            
                                            // Drum sub-Type; 
                                            // BD: Ludwig, Xyz1,     // SD: TamaSLP, Xyz,     // HH: Xyz123,   etc;
                                            inline function onSamplemapList_CAT2Control(component, value)
                                            {	//.set("visible", false);
                                                //SamplemapList_CAT2.set("items", sp.join("\n"));
                                                //SamplemapList.set("items", sp.join("\n"));
                                            };
                                            Content.getComponent("SamplemapList_CAT2").setControlCallback(onSamplemapList_CAT2Control);
                                            // ============== [ /Samplemap List Categories ] ==================
                                            
                                            
                                            HiseSnippet 3469.3oc6arsbaabEPxvIj0L2ZdnuzY1poyTpIJRjTVJI1Moz5hCcpjsFQEmLiphlkDKIgMHVTbQRzY7L4SoeB8o9b9R52P+CZO6MfEf2fjsbcaDch.2ama6YO2VvCBncIggz.CyRGMxmXXdGq1i7hFr8.rimwi1wvrrUm.54gjfML1ZjONLjXaXZt3WyF2rzsL3e9W+osvtXutjztLLdJ0oKYOmgNQo8dPy+riq6Cw1jibFpM6617QcodaScow.srnUMCeb2mi6SdLlMsErLLu8t1NQzf1Q3HRng4s1hZOp8.54dh4+TmPmNtDVi5FsA.I59gTWaFEy50X6ANt1Gn34PCCSqCRk.KJj.er09N1NI8mJI9.9.nzUnKOLWXVjWccxqVwIOSMx6VBx6CsZ2MvwOJcDFs8qrdjWDInGF1BzIKwbMV3eVwZaJLCunUGheN4gAPijUTcyZ0VAsQsZKe+JkqTds0Pe43ePGiZiG56RFh8Q64D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x.T.lyqYxEounB0aNJsw5MO2wNZPRG0dYyAD1kGkNkurYD4hn2XuhJXWm9dC4L0ssbI8hXxj4ympWaEMFsoNiZjiQ88GiQWUxnuddkWlMeT9R8ZvjxTM+qZL0O0RRwkrNfe8XgFYYx+V+7L4Oga56F22w6.b.n9FQBdrTKVAAdJtFK3cKK4lRK541iJq2ngp02fewKpq2PMxorFqWlu8yPvS5EF2IWyFkS9CO5sxasS3oPq5hX4ZTd+snWTFjWv+IeHlmhTvA1n5Ya0Q07H9EfVOayFkk0WmSqn53bs6TVxry3Qio+THMl9iFS9gTVMwGxaGPSFN2uN1RZTtHeGVVQdp1oJXiranW11sZcJWGXFOkpGE7aBx5R0L4ZXT5ayuioMPmB0yDFRoLWjdl5PMJTO5Ck+vxD5Z7uL1j5LotF6KFx6hE7pYZJdy7xay+x7l9cg96kWFClYMPZ7CSv.YNRQXPD7i2dmWMxpgFY8y+PyYPV+bmBSVuqzL8qi7PMWTKF7zeAqWK+BNecjdk4BSfdYu9kWyzaQyM6Z5G+5qVE2tx+Bk8K7uP4LEXSMsetodo0T892alonZo3ZB0SSM361LWwzRYkbURKcfjxnkxiiUCszgTEPKsmzpmk1WlRmINTNVwyRm8aUUN6Cs1J0wCK7kwdO4emh8dxCv6.LHAzl4VN8SvknGc04DoNmxz9YpabsU3t2.GCudM3tXwHWiqoJEZtndcB0OSjTjvTZehLjp7fpd93lI0FT00uuodcAuRxh5EWV7JVJw+myQ4h+h2Q4UpHnuMtOOkJn9FkTKPsMsLWf4iMo5lV7n5k02zx7eCeRKvov4orDmhAKRYXMWPVD1TU5KYEXekoxapD6+OVIVyEM9O..GUX2C
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            44

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.2k

                                            Posts