Set sample length via script
-
Hi all,
I am trying to set the sample end value via script but I am getting a function not found message when using the below code:.
Sampler1.set(Sampler1.SampleEnd, 150000);I have also tried
Sampler1.setAttribute(Sampler.SampleEnd, 150000);
as well as
Sampler1.set(Sampler.SampleEnd, 150000);Both of those compiled without errors but didn't change the sample end value. What am I missing?
Thanks in advance
-
@rzrsharpeprod Sample end is a property of the sample not the sampler
-
@d-healey said in Set sample length via script:
@rzrsharpeprod Sample end is a property of the sample not the sampler
Ah ok. I just tried changing Sampler1 references to Sample but no joy.
I have looked around the forum before I posted as I always try and solve things myself if I can as it is more useful in the long run. I found this post but it didn't seem to help/work
https://forum.hise.audio/topic/2516/get-length-duration-of-sample-in-samples/7?_=1698256601632What do I need to change to set the sample length/end please?
I'm clearly being thick and having a moment but I can't seem to get it to work and I am definitely doing something wrong. -
-
@d-healey said in Set sample length via script:
@rzrsharpeprod https://forum.hise.audio/topic/64/fun-with-regex
I went through that thread before I posted as it is referenced in the the one I posted above but I can't get it to work which is why I am back.
The regex thread seems to suggest using
setSampleSoundsProperty (14,180000);
would work with 14 being the sample end index
whereas in the one I linked it looks like just
set(Sampler1.SampleEnd, 180000);
would workI have tried both and variants of both but can't get it to change the sample end/length
I am basically just trying to trim the sample length when it is in reverse mode so that it doesn't take so long for the main part of the sound to kick in.
I can of course just do it in a separate sample map and use that for the reverse one but I'd rather learn how to do it via code as that is more useful going forwards.
If you can point me in the right direction of what I am doing wrong that would be much appreciated as I can't figure it out.
-
@rzrsharpeprod said in Set sample length via script:
I can of course just do it in a separate sample map and use that for the reverse one but I'd rather learn how to do it via code as that is more useful going forwards.
For this I would definitely use two sample maps. Unless you only have a very few samples to deal with.
-
@d-healey said in Set sample length via script:
@rzrsharpeprod said in Set sample length via script:
I can of course just do it in a separate sample map and use that for the reverse one but I'd rather learn how to do it via code as that is more useful going forwards.
For this I would definitely use two sample maps. Unless you only have a very few samples to deal with.
It's only about 100 samples so not too many. It can be handled/trimmed in the sample map easily as it will just be a simple find replace for the end point.
I will use that approach to get around the issue as it's simple enough.
I would still like to know how to do it via script at some point though for my own knowledge going forward (I like to know things) but also so I can implement it in future if required.
Thanks for your assistance on this
-
@rzrsharpeprod said in Set sample length via script:
It can be handled/trimmed in the sample map easily as it will just be a simple find replace for the end point.
You know HISE has an autotrimmer?
-
@d-healey said in Set sample length via script:
@rzrsharpeprod said in Set sample length via script:
It can be handled/trimmed in the sample map easily as it will just be a simple find replace for the end point.
You know HISE has an autotrimmer?
Would that work in this case though as I need to keep the samples the original length for the presets that play forwards. The tail in the samples means that they come to a natural stop/fade out nicely.
But for the reverse preset that same tail means that it takes a long time for the main body of the sound to kick in so I just want to trim them while the sampler is in reverse mode which is just the 1 preset.
Or did you mean for the reverse samplemap? That would work for that definitely.
Even though there are 100 samples, there are only 2 end points across them so the simple find and replace in notepad++ will probably be just as quick if not quicker on this occasion.Is it possible to do it via script or was I chasing an impossible task from the offset? I am just curious as it feels like it is possible but I couldn't get it to change the sample end value
-
@rzrsharpeprod said in Set sample length via script:
Or did you mean for the reverse samplemap? That would work for that definitely.
Yes this. One sample map forward, one reversed. Auto trim the reversed one, two minutes of work.
Is it possible to do it via script or was I chasing an impossible task from the offset?
Yes it's possible, but it seems like more effort than it's worth.