HISE Logo Forum
    • Categories
    • Register
    • Login

    Fun with more/less regex

    Scheduled Pinned Locked Moved General Questions
    6 Posts 3 Posters 287 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.
    • LindonL
      Lindon
      last edited by

      OK so I'm using the facilities found in the blog post "Fun with Regex"

      • what I actually want to do is modify each file in my sample maps (all 300 of them) so the SampleStartMod = SampleLength --- and they are all a bit different - even in the same sample map..

      So a comment - the property numbers in the blog post are all off by one...

      and a question: so before I go make a little python script to get every file name in every sample map - and then import this array into my "modifying script" - so I can roll around each sample map doing this:

      mySampler.selectSounds(names[index]);

      to get each wav file in turn....

      is there a way to get the file names from the sampler for the currently loaded sample map?

      Somehting nice like

      mySampler.getAllFileNames()

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

        There are Sample.get() and Sample.getId() functions, I'm not 100% sure what they're for but they sound like they might be what you need.

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

        LindonL 1 Reply Last reply Reply Quote 0
        • LindonL
          Lindon @d.healey
          last edited by

          @d-healey said in Fun with more/less regex:

          There are Sample.get() and Sample.getId() functions, I'm not 100% sure what they're for but they sound like they might be what you need.

          yes, perhaps - but I have no idea how to populate "Sample"

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

            There is a better way of changing sample properties now than how it's described in the Fun with Regex blog entry (I might have to update it at some point). Basically you call Sampler.createSelection with the regex string and you get an array of Sample objects that you can iterate and change properties using get() and set()

            // s is a Sample object...
            for(s in Sampler.createSelection(".*"))
            {
                // Sample.get() returns a string so for a subtraction we need to convert it to an integer
                var l = parseInt(s.get(Sampler.SampleEnd)) - parseInt(s.get(Sampler.SampleStart));
                s.set(Sampler.SampleStartMod, l);
            }
            

            oh and getting the filename is as easy as

            s.get(Sampler.FileName)
            
            LindonL 1 Reply Last reply Reply Quote 1
            • LindonL
              Lindon @Lindon
              last edited by Lindon

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • LindonL
                Lindon @Christoph Hart
                last edited by

                @Christoph-Hart - yep works like a charm - thanks.

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

                55

                Online

                1.7k

                Users

                11.7k

                Topics

                101.8k

                Posts