HISE Logo Forum
    • Categories
    • Register
    • Login

    How do i remove numbers and underscore

    Scheduled Pinned Locked Moved Scripting
    16 Posts 4 Posters 684 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

      for (name in sampleMapNames)
      	displayNames.push(name.substring(name.indexOf("_") + 1, name.length));
      

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

      CyberGenC 1 Reply Last reply Reply Quote 0
      • ThinkTankT
        ThinkTank @d.healey
        last edited by

        @d-healey

        I was just about to mention it, thanks a ton for the help.
        You are spot on with ChatGPT, im trying to make it my mentor, but it gets a ton of stuff wrong still :anxious_face_with_sweat:

        Without problems that test the limits of your abilities, you can not expand them.

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

          @ThinkTank said in How do i remove numbers and underscore:

          im trying to make it my mentor,

          It's the other way around, you have to mentor ChatGPT, it doesn't know when it makes a mistake.

          Just posted the solution above your response.

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

          ThinkTankT 2 Replies Last reply Reply Quote 0
          • ThinkTankT
            ThinkTank @d.healey
            last edited by

            @d-healey

            Thanks a bunch, that's true haha. I'm giving ChatGPT a lot of scolding with these scripts.

            Without problems that test the limits of your abilities, you can not expand them.

            1 Reply Last reply Reply Quote 0
            • ThinkTankT
              ThinkTank @d.healey
              last edited by

              @d-healey

              It never really worked, not sure why. But now im just hiding them with panels 😂

              Without problems that test the limits of your abilities, you can not expand them.

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

                @ThinkTank said in How do i remove numbers and underscore:

                not sure why.

                Try and figure it out. Solving these problems is how you get more proficient at scripting. If you sidestep it now you won't have a solution the next time it happens.

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

                ThinkTankT 1 Reply Last reply Reply Quote 0
                • ThinkTankT
                  ThinkTank @d.healey
                  last edited by

                  @d-healey

                  True, and i also forgot i can not hide the name when i click the combobox and it drops down 😧
                  The struggle is real.

                  Without problems that test the limits of your abilities, you can not expand them.

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

                    @ThinkTank said in How do i remove numbers and underscore:

                    The struggle is real.

                    Every is hard before it is easy. But it doesn't take much practice for things to start getting easier and there is lots of documentation and help available.

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

                    DanHD 1 Reply Last reply Reply Quote 0
                    • DanHD
                      DanH @d.healey
                      last edited by DanH

                      @d-healey @ThinkTank I haven't used ChatGBT for HISE at all but I can imagine it creates mutant script that kind of works until it causes problems further down the line that you have no idea how to solve.

                      I'd say ask the forum first for help, as you will benefit from the experienced coders like @d-healey and your code will have a much better chance of working 😆

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

                      ThinkTankT 1 Reply Last reply Reply Quote 0
                      • ThinkTankT
                        ThinkTank @DanH
                        last edited by

                        @DanH

                        Absolutely correct!
                        Its a mess to work with, i have to do the research for it and come up with solutions about 90% of the time.

                        However i now got it working.

                        If anyone else has this problem, here is the code:

                        // Layer A
                        const var pianos = Content.getComponent("pianos");
                        
                        const var sampleMapNames = Sampler.getSampleMapList(); // Assuming this is the correct function name
                        
                        // Remove numerical prefixes from sample map names
                        const var displayNames = [];
                        for (name in sampleMapNames)
                            displayNames.push(name.substring(name.indexOf("_") + 1, name.length));
                        
                        // Sort Array
                        displayNames.sort();
                        
                        pianos.set("items", displayNames.join("\n"));
                        
                        inline function onpianosControl(component, value)
                        {
                          
                            Sampler1.asSampler().loadSampleMap(sampleMapNames[value - 1]);
                        }
                        
                        pianos.setControlCallback(onpianosControl);
                        

                        Without problems that test the limits of your abilities, you can not expand them.

                        1 Reply Last reply Reply Quote 0
                        • CyberGenC
                          CyberGen @d.healey
                          last edited by

                          @d-healey Sorry for the old topic revival but how about in this case, I need to remove the wildcard {PROJECT_FOLDER} and the ".wav" extension from some audio files. I can do one or the other but don't know how to do both at the same time. Here is what I have so far:

                          	const var Convolutions = Engine.loadAudioFilesIntoPool();
                          
                          	const var IRs = [];
                          	
                          
                          for (Convolution in Convolutions)
                          {
                          	IRs.push(Convolution.replace("{PROJECT_FOLDER}"));
                          
                          }
                          
                          d.healeyD 1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @CyberGen
                            last edited by d.healey

                            @CyberGen

                            You can chain it.

                            IRs.push(Convolution.replace("{PROJECT_FOLDER}").replace("next thing to replace"));

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

                            CyberGenC 1 Reply Last reply Reply Quote 1
                            • CyberGenC
                              CyberGen @d.healey
                              last edited by

                              @d-healey worked like a charm... Thank you!

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

                              18

                              Online

                              1.7k

                              Users

                              11.9k

                              Topics

                              103.3k

                              Posts