Impossible to loop short sample !
-
ok thanks for this;)
-
Did this fix ever get merged?
-
Nope and now it starts to get embarrassing...
-
maybe @Cyberdyne387 could provide his fix from the referenced forum thread? I didn't see a github repo in the list of forks. I wondered if maybe its a simple enough fix to copy paste and describe the changes in the issues list or on this thread?
-
@macromachines
First of all, apologies for taking so long to read this: truth be told, I’ve been pretty swamped with other matters.
It’s important to note that I may not have the modified code in its entirety anymore due to trying to keep my HISE source code updated every so often, and even if I do, I never did find a C++ way to address the sample-end-too-short issue. I’m willing to share my edit for the loop-end-too-early issue, however, and I may still have a JavaScript that adjusted the preload size so that the loop would play at all regardless.
UPDATE: found the fixed C++ file. It should hopefully compile fine with the latest source code.
https://www.dropbox.com/s/ksj4v2mctlm183a/StreamingSamplerSound.cpp?dl=0
To specify what exactly I changed when it comes to this issue, Christoph wrote a conditional statement in the setPreloadSize function for the circumstance of if the entire length of the sample is too short for the internalPreloadSize, but looping is enabled. What I changed is I added an additional conditional statement checking to see if the loop end point is also smaller than the internalPreloadSize.
As for whether the loop plays at all under a given preloadSize, sadly, loops and loading the entire sample seem to not get along well at this time, so my final change was specifying that entireSampleLoaded be false if the preloadSize is larger than the loop end point. In addition, I also specified the loopChanged function to force-reload the preload buffer in the high chance that you wish to change the loop but not the preload buffer size at a given time.
Hopefully this helps people out.
-
@cyberdyne387 - thanks for the code. I have diffed it with the current state and it can be merged without problems. However I'd like to test these things a little bit before committing in the codebase - changing this code is like open heart surgery, so every line counts :)
-
@christoph-hart Not a problem when it comes to testing the code extensively before committing. I did realize I made a minor mistake in my fix, anyway: the force-reloading of the preload buffer I had only run when the looping is set to enabled, meaning it will play the duration of the sample as a loop even if the last loop change you did was disabling the loop. Fixed on my end now, with the same link.
-
Alright, I've pushed a fix to this problem.
I ended up rewriting the fix for myself, but at the end I did almost the same things as you :)
Thanks again for the input!
-
Just tested your version of the edits for myself, only to need to revert back to my version of StreamingSamplerSound. Both copies of the file work fine when there's no sample start offset, but it appears the one you committed causes the loop to play silence for the duration of the sample start offset
-
Just install this update Working Perfect, Thanks a lot.....
-
I'm also having problems looping short samples. Files with loop settings like the following seem to overcharge HISE (develop branch from roughly Feb 2023):
<sample {other params here} LoopStart="633" LoopEnd="1033"/> <sample {other params here} LoopStart="321" LoopEnd="721"/> <sample {other params here} LoopStart="669" LoopEnd="1093"/> <sample {other params here} LoopStart="339" LoopEnd="763"/>
But hey, why not just duplicate one or two cycles in theses files? Very simple solution :smiling_face:
-
@Frankbeat so if you think about it there's always going to be a problem for HISE with looping very short samples spread cross the keyboard range - as you move further up the keyboard away from the root note - the sample needs to be shortened(even further) to repitch - until we get to the "that aint ever gonna work" position... so yes duplicating your short loop multiple times (say 10 or 20) will help a fair bit...
-
@Lindon Oh, I'm sorry I didn't mention it: This was tested with no pitch tracking applied. Each sample just played back on its root note. But of course, you're correct. I never pitch track a sample more than 2 semitones up or down.