Truncate a sample via scripting
-
Is it possible to truncate a sample from the set start end end points of a samplemap via scripting?
-
@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);
-
@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.
-
Having a look at this for an alternative solution:
https://forum.hise.audio/topic/5912/horizontal-zoom-for-waveform?_=1676286666131 -
@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.
-
@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.