HISE Logo Forum
    • Categories
    • Register
    • Login

    Truncate a sample via scripting

    Scheduled Pinned Locked Moved General Questions
    6 Posts 2 Posters 314 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.
    • B
      blezzbeats
      last edited by

      Is it possible to truncate a sample from the set start end end points of a samplemap via scripting?

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @blezzbeats
        last edited by Lindon

        @blezzbeats said in Truncate a sample via scripting:

        Is it possible to truncate a sample from the set start end end points of a samplemap via scripting?

        ok so I think you need to look at set and get for the Sampler, and apply it to each zone you want

        
        // get the zones...
        myZones = mySampler.createSelection(".*");  // <-- you get an array of zones
        
        // an example get
        myStart = myZones[aZoneNumber].get(mySampler.SampleStart);
        
        //an example set
        myZones[aZoneNumber].set(mySampler.SampleStart, aStartValue);
        myZones[aZoneNumber].set(mySampler.SampleEnd, anEndValue);
        

        HISE Development for hire.
        www.channelrobot.com

        B 1 Reply Last reply Reply Quote 0
        • B
          blezzbeats @Lindon
          last edited by

          @Lindon Thanks, that does work fine for updating the start and end points but what I'm really looking for is if I'm able to take a sample and destructively truncate it.

          So I'm guessing after this step - either remove anything before and after the start/end or copy the active range and make a new sample by passing an array of samples with only that limited range to base64 and back to a new sample map.

          The reason is I want to be able to use the AudioWaveform and select a smaller range from a longer sample, and have it display exactly that range so it covers the whole component if that makes sense.

          LindonL 1 Reply Last reply Reply Quote 0
          • B
            blezzbeats
            last edited by

            Having a look at this for an alternative solution:
            https://forum.hise.audio/topic/5912/horizontal-zoom-for-waveform?_=1676286666131

            1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @blezzbeats
              last edited by

              @blezzbeats said in Truncate a sample via scripting:

              @Lindon Thanks, that does work fine for updating the start and end points but what I'm really looking for is if I'm able to take a sample and destructively truncate it.

              So I'm guessing after this step - either remove anything before and after the start/end or copy the active range and make a new sample by passing an array of samples with only that limited range to base64 and back to a new sample map.

              The reason is I want to be able to use the AudioWaveform and select a smaller range from a longer sample, and have it display exactly that range so it covers the whole component if that makes sense.

              well a couple of observations:

              It seems you want HISE to offer you a set of Audio editor-like functions - I cant see that ever happening.

              But clearly you could redrawn your own waveform (for a custom made AudioWaveform) and scale as required.

              HISE Development for hire.
              www.channelrobot.com

              B 1 Reply Last reply Reply Quote 0
              • B
                blezzbeats @Lindon
                last edited by

                @Lindon No and yes lol, the main objective is to crop the view to cover the start/end point selection and I thought that would be the simplest way if possible, because what else is it gonna display. But this looks like a good start, just gotta figure out how to calculate the zoom level and position based on that and update it automatically on changing start/end points with the AudioWaveform.

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

                52

                Online

                1.7k

                Users

                11.7k

                Topics

                102.1k

                Posts