Get length / duration of sample in samples



  • Hey all, I've been searching for an API call to get the length of each sample within a sampler, but have yet to find one. There are so many other properties options available (see this post), but I can't seem to find a function for getting the total duration in samples.

    I discovered this in the core HISE code getSampleLength() but it might serve a different purpose.

    Essentially, I need a way to set the sample ends to a percentage of the total length of each sample. Any suggestions? Thanks!



  • SampleEnd - SampleStart?



  • @Christoph-Hart Will that work if you've previously set the sample start or end to a range that isn't the sample's full length? I'm thinking you'd need to make sure they always started at the min/max you would ever need and then keep track of any changes you make after.



  • @Lunacy-Audio

    I discovered this in the core HISE code getSampleLength() but it might serve a different purpose.

    That function is for audio processors, not for individual samples. Samples use properties with the .get command but sample length isn't an available property so it would need to be implemented.



  • Ah yes, that makes sense. Thanks guys.

    @Christoph-Hart Yes that would do it, but would yield inaccurate results in the case that the user changes the sample start first.

    @d-healey Agreed. Sounds like I'll need to track all the sample lengths in an array the instant a sample map is loaded using the method @Christoph-Hart mentioned above.

    Appreciate the responses!


Log in to reply
 

12
Online

647
Users

2.6k
Topics

21.4k
Posts