Samplemap Categories ?



  • I read somewhere here on forum about being able to load samplemaps from categorized folders, is there an example of this somewhere around here ?

    Just want to experiment with loading kicks, snares, hats, etc to specific samplers from a combobox.

    For example, Combobox1 would only show the contents of the "kicks" samplemap folder, and Combobox2 would only show the contents of the "snares" samplemap folder.
    Thanks for any input !

    Dalart



  • I found the forum post I was referring to here: https://forum.hise.audio/topic/1146/viewport/22

    Looks like this was a @Christoph-Hart creation and will have to wait for him to have the time to chime in.



  • Has anyone figured this out yet ?

    I'd like to be able to filter samplemaps per combobox basically.

    Example: ComboBox1 only show samplemaps that contain the word "Kick".
    ComboBox2 only show samplemaps that contain the word "Snare".

    I currently do not have any folders or sorting going on, just standard setup in the samplemaps folder.

    Thank you for any answers !!



  • You can filter strings using regex or indexOf. So just loop through all the sample map names and pick out the ones that have the text you're interested in.

    For example

    for (i = 0; i < sampleMapNames; i++)
    {
        if (sampleMapNames[i].indexOf("kick") != -1)
            Console.print("This is a kick sample map);
    }
    


  • Thank you David, I shall tinker around with this.



  • Ok it has been awhile since I asked for help on this question and I appreciate the answer I received.

    After bouncing around on projects for a few months I have gotten back to this position again and can't figure out how to implement this for loop and use it with the code for a combo box below.

    My mind is not connecting the dots on this one (extreme n00b here), so Im asking for help again.

    I went back to this thread where @d-healey created a code for me using a for loop method but I was uncertain how to apply the same technique for a combo box.

    Thanks in advance for anyone who has time to help !

    for (i = 0; i < sampleMapNames; i++)
    {
        if (sampleMapNames[i].indexOf("kick") != -1)
            Console.print("This is a kick sample map");
    }
    
    const var Sampler = Synth.getSampler("Sampler");
    const var sampleMapList = Sampler.getSampleMapList();
    ComboBox.set("items", sampleMapList.join("\n"));
    inline function onComboBoxControl(component, value)
    {
    Sampler.loadSampleMap(sampleMapList[value-1]);	
    };
    
    ComboBox.setControlCallback(onComboBoxControl);
    


  • @Dalart said in Samplemap Categories ?:

    Ok it has been awhile since I asked for help on this question and I appreciate the answer I received.

    After bouncing around on projects for a few months I have gotten back to this position again and can't figure out how to implement this for loop and use it with the code for a combo box below.

    My mind is not connecting the dots on this one (extreme n00b here), so Im asking for help again.

    I went back to this thread where @d-healey created a code for me using a for loop method but I was uncertain how to apply the same technique for a combo box.

    Thanks in advance for anyone who has time to help !

    for (i = 0; i < sampleMapNames; i++)
    {
        if (sampleMapNames[i].indexOf("kick") != -1)
            Console.print("This is a kick sample map");
    }
    
    const var Sampler = Synth.getSampler("Sampler");
    const var sampleMapList = Sampler.getSampleMapList();
    ComboBox.set("items", sampleMapList.join("\n"));
    inline function onComboBoxControl(component, value)
    {
    Sampler.loadSampleMap(sampleMapList[value-1]);	
    };
    
    ComboBox.setControlCallback(onComboBoxControl);
    

    so just change this;

    var myPreferedList = [];
    for (i = 0; i < sampleMapNames; i++) {
        if (sampleMapNames[i].indexOf("kick") != -1)
             myPreferedList.push(sampleMapNames[i]);
            //Console.print("This is a kick sample map");
    }
    

    to get an array of names and then put that in your combobox:

    ComboBox.set("items", myPreferedList.join("\n"));



  • Im not sure I understand how:

    var myPreferedList = [];
    

    would get the contents of:

    const var sampleMapList = Sampler.getSampleMapList();
    


  • @Dalart -- this was just a modification of your example of how to look through an array of names for the ones you want then put them into another array.

    So can you work out how to apply this approach to SampleMapList?



  • @Lindon Havent had a chance to figure it out yet. Had a heart attack a week ago, will see if I can figure it out today.



  • @Dalart said in Samplemap Categories ?:

    Had a heart attack a week ago

    🤕 hope you're feeling better



  • Take it steady @Dalart.
    Hope you're recovering mate!


Log in to reply
 

8
Online

702
Users

2.8k
Topics

23.7k
Posts