HISE Logo Forum
    • Categories
    • Register
    • Login

    ACCESS AUDIO FILES SUB FOLDER:

    Scheduled Pinned Locked Moved Solved Scripting
    16 Posts 2 Posters 143 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 @Chazrox
      last edited by d.healey

      @Chazrox

      const audioFiles = Engine.loadAudioFilesIntoPool(); // This returns an array
      myComboBox.set("items", audioFiles.join("\n")); // Add all the items to the combo box
      

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

      ChazroxC 1 Reply Last reply Reply Quote 0
      • ChazroxC
        Chazrox @d.healey
        last edited by

        @d-healey I should be more specific. I only want it to pull from 'Subber' folder.

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

          @Chazrox Loop over the audioFiles array and only add the items you want to the combo box. You can use .contains() and .substring() to get only the text you want.

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

          ChazroxC 1 Reply Last reply Reply Quote 0
          • ChazroxC
            Chazrox @d.healey
            last edited by Chazrox

            @d-healey am I doing this right?
            its loading the combobox properly but loading the audio from 'Audio Files' instead of 'Subber' folder.

            const var cmbSubs = Content.getComponent("cmbSubs");
            const var subs = Engine.loadAudioFilesIntoPool();
            
            cmbSubs.set("items","");
            	
            for (x in subs)
            		if (x.contains("SUB_"))
            		cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/"));
            		
            

            Correct Files:
            Screenshot 2025-04-22 at 7.52.10 AM.png

            Wrong Files:
            Screenshot 2025-04-22 at 7.52.14 AM.png

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

              @Chazrox Use {} with your for loops and if statements.

              Show me the code that does the loading.

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

              ChazroxC 1 Reply Last reply Reply Quote 0
              • ChazroxC
                Chazrox @d.healey
                last edited by Chazrox

                @d-healey

                const var cmbSubs = Content.getComponent("cmbSubs");
                const var subs = Engine.loadAudioFilesIntoPool();
                const var audioKickSub = Synth.getAudioSampleProcessor("Kick Sub");
                
                inline function oncmbSubsControl(component, value)
                {
                	if (value > 0)
                	audioKickSub.setFile(subs[value-1]);
                
                };
                
                Content.getComponent("cmbSubs").setControlCallback(oncmbSubsControl);
                
                cmbSubs.set("items","");
                	
                for (x in subs)
                		if (x.contains("SUB_"))
                		{
                			cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/").replace("SUB_"));
                						
                		}
                		
                

                its "subs" thats messing it up isnt it? Its pulling from the entire array and value 1 from that list right?
                That just crossed my mind.

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

                  @Chazrox

                  Like this

                  for (x in subs)
                  {
                      if (x.contains("SUB_"))
                      {
                  		cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/").replace("SUB_"));			
                      }
                  }
                  

                  @Chazrox said in ACCESS AUDIO FILES SUB FOLDER::

                  its "subs" thats messing it up isnt it? Its pulling from the entire array and value 1 from that list right?
                  That just crossed my mind.

                  Yeah I think you're right. So when you loop over the array of audio files and pull out the values for your combo box, you also need to put those audio files (the sub ones) into a separate array.

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

                  ChazroxC 1 Reply Last reply Reply Quote 0
                  • ChazroxC
                    Chazrox @d.healey
                    last edited by

                    @d-healey can you help me with the loop? I cant figure that one out rn. I've never done a loop inside of a loop before.

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

                      @Chazrox said in ACCESS AUDIO FILES SUB FOLDER::

                      I've never done a loop inside of a loop before.

                      You don't need to.

                      for (x in audioFiles)
                      {
                          if (x.contains("SUB_"))
                          {
                      		cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/").replace("SUB_"));			
                              subArray.push(x);
                          }
                      }
                      

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

                      ChazroxC 2 Replies Last reply Reply Quote 1
                      • ChazroxC
                        Chazrox @d.healey
                        last edited by

                        @d-healey Working! Thank you!

                        const var cmbSubs = Content.getComponent("cmbSubs");
                        const var subs = Engine.loadAudioFilesIntoPool();
                        const var audioKickSub = Synth.getAudioSampleProcessor("Kick Sub");
                        
                        cmbSubs.set("items","");
                        	
                        const var subArray = [];
                        	
                        for (x in subs)
                        {
                            if (x.contains("SUB_"))
                            {
                        		cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/").replace("SUB_"));			
                                subArray.push(x);
                            }
                        }
                        
                        inline function oncmbSubsControl(component, value)
                        {
                        	if (value > 0)
                        	audioKickSub.setFile(subArray[value-1]);
                        };
                        
                        Content.getComponent("cmbSubs").setControlCallback(oncmbSubsControl);
                        
                        
                        d.healeyD 1 Reply Last reply Reply Quote 1
                        • ChazroxC
                          Chazrox @d.healey
                          last edited by

                          @d-healey Thank you for your time sir! Grateful! 🙏

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

                            @Chazrox I'd rename your subs array to audioFiles since that's what it contains. And you can rename subArray to subs

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

                            ChazroxC 1 Reply Last reply Reply Quote 0
                            • ChazroxC
                              Chazrox @d.healey
                              last edited by

                              @d-healey makes sense. Thank you!

                              I've also learned today that filenames can play a big help in sorting through lists like these. Prefixes!

                              1 Reply Last reply Reply Quote 1
                              • ChazroxC Chazrox marked this topic as a question
                              • ChazroxC Chazrox has marked this topic as solved
                              • First post
                                Last post

                              7

                              Online

                              1.7k

                              Users

                              11.8k

                              Topics

                              102.3k

                              Posts