HISE Logo Forum
    • Categories
    • Register
    • Login

    AudioLoopPlayer load

    Scheduled Pinned Locked Moved General Questions
    51 Posts 6 Posters 2.7k 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 @MikeB
      last edited by

      @MikeB I try to design around the features that are available then I don't hit limits so often, of course sometimes I want new things, then I nag Christoph :)

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

      1 Reply Last reply Reply Quote 0
      • MikeBM
        MikeB @d.healey
        last edited by MikeB

        @d-healey

        Can you write the lines I need in this example
        So that I can get an idea of it and understand it.
        That would be nice

        reg myList = Engine.loadAudioFilesIntoPool();
        //Console.print(trace(myList));
        
        const ss = myList.substring(s.indexOf("}") + 1, s.indexOf("/"));
        
        Knob 1 - Select Folder 
        Synth.getAudioSampleProcessor("Audio Loop Player_S1").setFile
        
        Knob 2 - Select Sample
        Synth.getAudioSampleProcessor("Audio Loop Player_S1").setFile
        
        

        "One hour of trial and error can save 10 minutes of reading the manual."
        "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
        HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

        1 Reply Last reply Reply Quote 0
        • musictopM
          musictop @MikeB
          last edited by

          @MikeB I often find my self in very simmilar situations, and not only in working with HISE :)
          In my case i found out that leaving projects aside for a while helps me understand them better and often rethink the initial ideas and find solutions. Also i work on at least 7 or 8 other projects in paralel and sometimes problems/solutions relate between them.

          But, i doubt i would have gotten anywhere without the help from community here in HISE forum. Especialy since i know almost nothing in regards to scripting and i can therefore easely relate to your problems and frustration.

          my website: https://musictop69.wixsite.com/ilirbajri
          https://musictop69.wixsite.com/creatools
          https://musictop69.wixsite.com/orchestools

          1 Reply Last reply Reply Quote 1
          • DanHD
            DanH @MikeB
            last edited by

            @MikeB Take a break Mike 😆

            DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
            https://dhplugins.com/ | https://dcbreaks.com/
            London, UK

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

              Here's a simple version that splits the audio files list into two arrays, one for folders, and one for files.

              const audioFiles = Engine.loadAudioFilesIntoPool();
              const folders = [];
              const files = [];
              
              inline function splitAudioFilesList()
              {
              	for (x in audioFiles)
              	{
              		local folder = x.substring(x.indexOf("}") + 1, x.indexOf("/"));
              	
              		if (folders.indexOf(folder) == -1) // Prevents duplicate folder names
              			folders.push(folder);
              		
              		files.push(x.substring(x.indexOf("/") + 1, x.length));
              	}
              }
              
              splitAudioFilesList();
              
              Console.print(trace(folders));
              Console.print(trace(files));
              

              And here's another way (my preferred choice) which organises the samples into one array per folder. All of the arrays are stored in a single object so you can access them with sorted.folderName[index].

              const audioFiles = Engine.loadAudioFilesIntoPool();
              const sorted = {};
              
              inline function sortAudioFilesList()
              {
              	for (x in audioFiles)
              	{
              		local folder = x.substring(x.indexOf("}") + 1, x.indexOf("/"));
              		local file = x.substring(x.indexOf("/") + 1, x.length);
              		
              		if (!isDefined(sorted[folder]))
              			sorted[folder] = [];
              					
              		sorted[folder].push(file);
              	}
              }
              
              sortAudioFilesList();
              
              Console.print(trace(sorted));
              

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

              MikeBM 2 Replies Last reply Reply Quote 3
              • MikeBM
                MikeB @d.healey
                last edited by

                @d-healey
                Then, thanks to you, I have made a small step forward today. And the day was not completely in vain.
                Thank you very much David. 👍 👍 👍

                I will deal with this tomorrow

                "One hour of trial and error can save 10 minutes of reading the manual."
                "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

                1 Reply Last reply Reply Quote 2
                • MikeBM
                  MikeB @d.healey
                  last edited by

                  @d-healey
                  New day - new misfortune

                  Just kidding :-)

                  I have now implemented your scriptsnippet.
                  It works in principle - but unfortunately the samples are not
                  from the respective folder are loaded but always the first samples in the order.
                  So the bass samples appear in the Kick folder.
                  The bass samples appear in the HiHat folder.

                  The array folders goes from 0-8
                  The array files goes from 0 -490
                  But in each folder there are only 55 samples

                  With your 2nd method I don't know how to distribute them to the two knobs. The first one selects the folder and the second one selects the samples in the folder.

                  const audioFiles = Engine.loadAudioFilesIntoPool();
                  const folders = [];
                  const files = [];
                  var InstrumentID_S1;
                  var VariationID_S1;
                  
                  inline function splitAudioFilesList()
                  {
                  	for (x in audioFiles)
                  	{
                  		local folder = x.substring(x.indexOf("}") + 1, x.indexOf("/"));	
                  		if (folders.indexOf(folder) == -1) // Prevents duplicate folder names
                  			folders.push(folder);		
                  		files.push(x.substring(x.indexOf("/") + 1, x.length));
                  	}
                  }
                  
                  splitAudioFilesList();
                  
                  Console.print(trace(folders));
                  //Console.print(trace(files));
                  
                  
                  //Knob-KitSelector----------------------------------------------------------------------
                  inline function onKitSelector_Knob_S1Control(component, value){
                  	InstrumentID_S1 = parseInt(value); //Knobvalue 1-55
                  	Console.print("{PROJECT_FOLDER}"+folders[InstrumentID_S1]+"/"+files[VariationID_S1]);
                  };
                  Content.getComponent("KitSelector_Knob_S1").setControlCallback(onKitSelector_Knob_S1Control);
                  //End --------------------------------------------------------------------------------------
                  
                  //Knob-SampleSelector-----------------------------------------------------------------
                  inline function onSampleSelector_Knob_S1Control(component, value){
                  	VariationID_S1 = parseInt(value-1); //Knobvalue 1-55		
                  	Console.print("Variation_S1" + "{PROJECT_FOLDER}"+folders[InstrumentID_S1]+"/"+files[VariationID_S1]);
                  };
                  Content.getComponent("SampleSelector_Knob_S1").setControlCallback(onSampleSelector_Knob_S1Control);
                  //End ---------------------------------------------------------------------------------------------------   
                  
                  
                  

                  "One hour of trial and error can save 10 minutes of reading the manual."
                  "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                  HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                    Here's a hybrid approach, a mix between my previous two versions. This one sorts the file paths into a 2D array. The first index is the folder, the second index is the file name.

                    So you can access them directly with the knob values.

                    sorted[knob value 1][knob value 2];

                    const audioFiles = Engine.loadAudioFilesIntoPool();
                    const folders = [];
                    const sorted = [];
                    
                    inline function sortAudioFilesList()
                    {
                    	for (x in audioFiles)
                    	{
                    		local folder = x.substring(x.indexOf("}") + 1, x.indexOf("/"));
                    		local file = x.substring(x.indexOf("/") + 1, x.length);
                    		
                    		if (folders.indexOf(folder) == -1)
                    		{
                    			folders.push(folder);
                    			sorted.push([]);
                    		}
                    					
                    		sorted[folders.indexOf(folder)].push(file);
                    	}
                    }
                    
                    sortAudioFilesList();
                    
                    Console.print(trace(sorted));
                    

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

                    MikeBM 1 Reply Last reply Reply Quote 0
                    • MikeBM
                      MikeB @d.healey
                      last edited by MikeB

                      @d-healey

                      Unfortunately, absolutely nothing - nothing happens at all.

                      
                      const audioFiles = Engine.loadAudioFilesIntoPool();
                      const folders = [];
                      const sorted = [];
                      
                      var InstrumentID_S1;
                      var VariationID_S1;
                      
                      inline function sortAudioFilesList()
                      {
                      	for (x in audioFiles)
                      	{
                      		local folder = x.substring(x.indexOf("}") + 1, x.indexOf("/"));
                      		local file = x.substring(x.indexOf("/") + 1, x.length);
                      		
                      		if (folders.indexOf(folder) == -1)
                      		{
                      			folders.push(folder);
                      			sorted.push([]);
                      		}
                      					
                      		sorted[folders.indexOf(folder)].push(file);
                      	}
                      }
                      
                      sortAudioFilesList();
                      //Console.print(trace(sorted));
                      
                      //Knob-KitSelector----------------------------------------------------------------------------------------------------------------------
                      inline function onKitSelector_Knob_S1Control(component, value)
                      {
                      	InstrumentID_S1 = parseInt(value); //Knobvalue 1-9
                      	Console.print(sorted[InstrumentID_S1][VariationID_S1]);
                      };
                      Content.getComponent("KitSelector_Knob_S1").setControlCallback(onKitSelector_Knob_S1Control);
                      
                      //Knob-SampleSelector----------------------------------------------------------------------------------------------------------------------
                      inline function onSampleSelector_Knob_S1Control(component, value)
                      {
                      	VariationID_S1 = parseInt(value-1); //Knobvalue 1-55
                              Console.print(sorted[InstrumentID_S1][VariationID_S1]);
                      };
                      Content.getComponent("SampleSelector_Knob_S1").setControlCallback(onSampleSelector_Knob_S1Control);
                      
                      

                      "One hour of trial and error can save 10 minutes of reading the manual."
                      "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                      HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                        @MikeB

                        You have this in your onKitSelector_knob_S1Control callback Console.print(sorted[InstrumentID_S1][VariationID_S1]);

                        VariationID_S1 doesn't exist in that callback (unless it's a scriptwide variable, but I'm not seeing it in your code).

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

                        MikeBM 1 Reply Last reply Reply Quote 0
                        • MikeBM
                          MikeB @d.healey
                          last edited by

                          @d-healey
                          they were commented out - of course you can't work like that :-)

                          Now I see in Console.print:

                          Interface: 41_EctoplasmKick_747.wav
                          Interface: 41_EctoplasmKick_747.wav
                          Interface: 45_SundayPerc_01_737.wav
                          Interface: 45_SundayPerc_01_737.wav
                          Interface: 47_ProvTom_809.wav
                          Interface: 47_ProvTom_809.wav

                          2x the sample - no folder

                          correct would be:
                          02-Kick/41_EctoplasmKick_747.wav

                          Maybe I should make a snippet - or?

                          "One hour of trial and error can save 10 minutes of reading the manual."
                          "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                          HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                            @MikeB You get the folder name from the folders array.

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

                            MikeBM 1 Reply Last reply Reply Quote 0
                            • MikeBM
                              MikeB @d.healey
                              last edited by

                              @d-healey
                              Sorry but here is a snippet - it doesn't work

                              HiseSnippet 1293.3ocyW0saiSDEdba8BwKfXk.o8xQ4pD0lzDX6xJUUQZSSPk9WTSYEqpJUSrmzLpimwxdbaiVEIdM16PhWDdK3EfG.dCfyX6Da25VZhDBFkKxb9a9N+M9L87k1zf.oOxnzoi8nHiOwr+XgZT6QDl.s2tHiWZ1hdoDuOS0mxo1JoOdaeexXzNi8HAATGjgwxemVZiRqfhV+42tCgSD1zTRHzakLa5ALWlJkZuV6y37tDG5oL2LR+pV6YKEskbYHfrkMaf7H1WQtjdDQK1RlHim0wgAXouhnnAfL6HcF2ej7FQr7ukEvFvo5MMQ8ACESF0dDi6zapWGfPFqzKMFrbbL3KLOj4vlQOMV74QLvoZjMFXrTdHsRNH07gfTWI2QafG.dFYf2Jwv6El8s8YdpTNZr8by8DJp+PBD1yBqXYQKc5GY1VBRHT0cIWQ65CaloQkW2nwZ3MZzn5lVVPnOPgul3mMoew9B4fK52DuEdpYtjpZKc8jBXSkxEHaYvZoFqOw0iSex1qXwKmBPRnCS1kwoAfM5HtjIn04Rhy1ynCtmrmTxqLCGC0AaesBmc9TZP.TQcRHYoQ5d.Y+PW.F6sKblaFQ7sDeFQwjhDZVLAGNR7vPgslbjcRO6CXApJUsduUogPGSkawLQFDW0pDvoDWZS3IfB.vs0CBG.GMSbYkaqyDNzaOdXkxSJWEuJt4Z3LzVubUvolYAvlOr9qmpOmJtTMJRS3GaHtRRDYlzw6qh2ZKbsl.LivYooR4EFLZpHZiTJN3ES+ryinMQSOx9wLO6ANhySrFfcsdSrlXYUTLbSq0WGJQBjbZcOv2TUT95R1XqqCCf.cgf7.oZD9JnNI.qFQ0gUt7FHVfcC0kKddTHMRTQLoBGbMLrdeuSN966z9zK5d7A614jIQsi9B3dl0iq.0+s9MjqszGitJrVlJ8Z+mrtWomTTP2mtsxGJ9sm1SsFzFxCoQEk2oDGJd7H9ATnioRrPahi81nc3F0diEjQymFJe2XW4UmlqOeUnpa0j7+cNqyOKeqjtpYxlVywsJ0CzxD4csIb9.3aCUdrPPbIRTtK+sJ+uI8U7kcOZFLeP7dIPn4MeJrYsM1.xg3j0+XpLey6bkzdnqtKNu8n9tN0YYkIRcjTQOVDeyJbiA9trFNrPdIliS8Kjsd7C+GSwJhP2AT+rI.sfv2jy+Q+m+z9nucbbKifPbUvTG6QS1mNVflWrWOkaCzLmMKoTeLK0HWq.wRIc+oNPI4UX9ikRDGDUEM8wmkL8QeNCJLPL.ieoYA8dnnHUxLc+xG9vxsPOAS8RyhKGxYMzu+qa1B8C6sKQQziHkfVvC7n9JlNOXrK8ZXdy3AlJYtKM3JkzKxcRJSQFlyoCc6rATa8tVims429oVtjTdHr1QmcHOa9cUvVlFqZfPi0+4O.Sl09+79sbyOrM59iHBCpJcB4DU9oW0iomv.ptyMlndTPQ.SMNqkmiQZaT3HsMKp35IB2WX1iorGULdWp.7pqV+WFuIOP3SM6LbHjzRA6Jlc+wE80.yATNQFpfIZNj.C4oKSNJzsO7FIaJfDgfxCzULKoafi22PuWGY5CC7Ds4ufUByl58FILaNkITrY6KuvNtWU+DjONhBfIQzquJYdndOdVOooYi5MPtvKitv1VGJp0DgJVmuZAz4qW.cd0BnyFKfNudAz4aV.cdyipi9QoaGpjtwsI.gdchtazvnif.UYQUjn+1Uy+3n
                              

                              "One hour of trial and error can save 10 minutes of reading the manual."
                              "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                              HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                                @MikeB said in AudioLoopPlayer load:

                                it doesn't work

                                It does exactly what you've told it to do.

                                Array elements are accessed by their index. So if you want the string in the folders array at index 0 you need to write folders[0]. Replace 0 with the knob's value.

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

                                MikeBM 1 Reply Last reply Reply Quote 1
                                • MikeBM
                                  MikeB @d.healey
                                  last edited by MikeB

                                  @d-healey

                                  It works fantastic

                                  Here is the complete working snippet for all those who want to load kits or instruments and samples into the AudioLoopPlayer.
                                  From David (the complex part) and from MikeB (the simple stuff)

                                  for example:
                                  {PROJECT_FOLDER}05-Cymbal/JitterCymbal.wav

                                  The whole thing looks for which folders are in the AudioPool and which samples are in them. And gives you the possibility with 2 Knobs
                                  a. to select the folder and
                                  b. the sample.

                                  Bildschirmfoto 2021-09-23 um 15.47.29.png

                                  HiseSnippet 1797.3oc4X0saaaCEVJIpsVscXcqCnWRXLf4fz3X2lzVrff5zDmgrlzXDmFLfrf.FIZahHSpIQmePQvta2tWgd2dM1ivdT1av1gT+QknjZ600VrI3KLO7vy4iG9wCOjsB3NjvPdfgYocNymXXdGq1mwD8VoGlxLVeUCyuv5kTQahGwQvCVNH.elwKNyGGFRbMLMm76j5YVZJC02e97Wf8vLGRlHCic4TGxFz9TQlzVMdI0yaMrKYGZeMsmuw5Nb1JbO9..SSZUyvG6bDtK4UXoZSXYXdiltT.JsEXAIzvbpWvcOqcO9IrH82kFROziHaT2nMXnHwqw8bkHV9eiU5Q8bakL2CMLLsZkEIlLJRbeqMotzT4YQjOW0AJaD5wCyItN3UeLgmoF7lJBd2ypsS.0Wj0iDa21ZclfDzACKA5vJRWiI9rRVqvAMXhp8wGQVK.ZjNhJOoVsGhVnVsoWz1FVFBEniwAnkG3R4av49s7vmQBpiVBo3HU6RDJnpZUorROjTQTrlkACkYGMdzAujwO7f1RSk.Gow3884LnQkxEnadi0F222iLz1qX0KmMQwRvuF0iDB1nIqKkQp5wwtKmJGBS7VbtWkTbzQtnE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RTKq7OCY+RNj87QDYyqgLecJhePihPWDddegta8NP2BZn62aqSs1HFcqC2VlDP9oAPxQHqIBGPPGSwe667dSHYOvsiRlBYP92L0g71fy5OvSPk0J.IClv3x2+EtEN2cfGVj+p4x2iHtC3.fb2AVdOWFf3yz2zMB2WuVg2WudQ4eGR3dOqVTgSuhw6DEfWYB8+kwa7qebWqlc5.LvLvNk0Z+v39TGiGT9xDnjVpDI5UNtu0keqgq4Uo9ig8Uo7G5WkBpsyAV1H5TI0Z4NvsIOBtlntqjvrICCwBWcway4BYY.5uJV7QJBbf.LeNsIGCoqyaA49qzGFScZhkoTt5bln+5A9VYNcAMYtIMMmbrdup7ayzzufGuZpOBus16+8p+ySsL4vA22wy+UJAisoRpRS1wDOXiQ7a0tJoCFRblHM+thM4LteONi5jmXIBnc6RBzwdgSnkEBfbmI49M1FNkBGRzKpYCHkMN3h6MFgXQ8gOVbcqWOvJBtH4VYz+MNRXx+edjv17ABHk5lXfnJSrAkL1FxD6P.jvXDuPYxrIjU4D0tVRxs1DlqpweAewcVW11Lty5Ic9AwG8wNA7CbhtEkjKeKkDXdyTIwKYsorMJ81RVV0pVCRr6ROvwQFtmstgQwi4QiwXd7XLl4GiwrvXLlmLFi4oiwXd10NF4gQKOPv6GsUDDzpo5VqlloGnaNoweiCcCZf
                                  

                                  Cost David a smile and me 3 days of life :-)
                                  Thanks David

                                  "One hour of trial and error can save 10 minutes of reading the manual."
                                  "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                                  HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                                  24

                                  Online

                                  1.7k

                                  Users

                                  11.8k

                                  Topics

                                  103.1k

                                  Posts