LAF + Sampler Functions
-
@d-healey Yes, but the sampler-specific areas (loop / sample start) aren't available for customisation yet.
-
@d-healey Looks like you're right.
the "Thumbnail Range" is the Sample/Loop Start & End slider. Looks like it just makes the Loop Range a bit darker in the AudioWavForm.
Something I noticed was when using "Thumbnail Range" and printing the parameters, the "textColour" parameter is actually the "itemColour" in property editor.
Also, after printing the parameters, I found a color parameter called "rangeColour" which makes the Sample range go completely white and the loop range to go completely blue. Maybe this is the way to edit them separately?
-
@Christoph-Hart Ahhhh, got it. I was able to change the color of the Range of Start/Loop but thats about as far as I was able to get.
-
@trillbilly I haven't got my head around it yet but I have a feeling it was my thread where you got this script and if it was I remember it has a few issues, not least that every sample length is different and will need to be parsed each time it's loaded etc etc. I'm not sure there's an effective solution right now available but I would be DELIGHTED to be proved wrong! :)
@Lindon I seem to remember you might have been working on something related to this?
-
@DanH Yes, I believe it was that thread.
Detecting the Sample End is something I also posted about for this. @d-healey had pointed me to a thread about Regex that he said may be of some help.
https://forum.hise.audio/topic/64/fun-with-regex
Also, using the knobs makes the AudioWavform View a bit jumpy. Hard to get a precise location unless you drag the Sample Start/End points. This doesnt work for Loop Start/End points though.
It does a decent job for what I can figure out.
-
This post is deleted! -
@DanH said in LAF + Sampler Functions:
@trillbilly I haven't got my head around it yet but I have a feeling it was my thread where you got this script and if it was I remember it has a few issues, not least that every sample length is different and will need to be parsed each time it's loaded etc etc. I'm not sure there's an effective solution right now available but I would be DELIGHTED to be proved wrong! :)
@Lindon I seem to remember you might have been working on something related to this?
well Im not so sure how useful it is but ...
essentially this:
..which wants to set the sample length for each sample in the loaded map...heres the code I use...with a little description:
postLoadZones = yourSampler.createSelection(".*"); // this creates an array of all the zones (wav files) in the sampler // for all zones.... for (zi = 0 ; zi < postLoadZones.length; zi++) { //Console.print(" ========= zone:" + zi + " start is:" + segmentData[lsi].SampleStart + " end is:" + segmentData[lsi].SampleEnd); postLoadZones[zi].set(theSamplers[postTargetSampler].SampleStart,YourStartValue); // that sets the start postLoadZones[zi].set(theSamplers[postTargetSampler].SampleEnd,YourEndValue); // that sets the end }
-
@trillbilly I remember now that you couldn't reliably save the presets using the current preset system. When you reload a sample map it reloads the start and end points of everything to what was saved in the sample map as opposed to what you saved in a preset via the ui.
-
@DanH Ahhhh, that does pose a bigger issue then. Ive been stuck creating some MIDI Packs for my site. I've got a few hours now, I'll mess with it now.
-
@DanH Couldn't you reload the values after changing sample map?
-
-
@DanH I've only saved a few demo presets but as of right now it all seems to be working as expected. I know you said "reliably", how often did it fail for you?
EDIT: Scratch that, I see what you're saying. It saves them but does not load them correctly all the time, at least on my end.
-
@d-healey Yeah I'm thinking of trying to do it in the preset handler post callback.
-
@trillbilly said in LAF + Sampler Functions:
@Lindon Awesome! Im going to try this out now.
Have you had an issue with what @DanH said regarding the Start/End times saving to what is set in the samplemap rather than the UI?
nope - i want to save the start end values the user selects...
-
@trillbilly said in LAF + Sampler Functions:
@DanH I've only saved a few demo presets but as of right now it all seems to be working as expected. I know you said "reliably", how often did it fail for you?
EDIT: Scratch that, I see what you're saying. It saves them but does not load them correctly all the time, at least on my end.
so this I think is probably the problem I ran into - it basically a timing issue - the sample map is not loaded instantly - so you are probably trying to set the start end values for zones not even loaded yet...and yes @DanH I ended up doing a o lot of this stuff in preset handler post callback
-
@Lindon Ahhh, that makes sense. Because if I click the same preset multiple times, the start/end values will eventually get to where they need to be.
So doing it in the Preset Handler Post Callback, Im having some newb issues.
Here is the code from documentation
UserPresetHandler.setPostCallback(var presetPostCallback)
Im not understanding something because I get "Unknown function 'setPostCallback'" error. Here is my jumble.
const var samplestart = [Content.getComponent("SampleStart1"), Content.getComponent("SampleStart2"), Content.getComponent("SampleStart3"), Content.getComponent("SampleStart4")]; UserPresetHandler.setPostCallback(samplestart, presetPostCallback);
Am I not calling for the variable correctly? Or the right variable? These are the knobs on my UI controlling Sample Start times.
-
@trillbilly You need to create a user preset handler first.
const uph = Engine.createUserPresetHandler()
then you can call the function on that objectuph.setPostCallback(function() { });
UserPresetHandler.setPostCallback(samplestart, presetPostCallback);
If you take a look at the documentation again you'll see the setPostCallback function only takes one parameter, you've tried passing in two which won't work.
-
@d-healey Ok, I get it to compile. But then when I use the function (in this case the sample start time) it then spits out the same "Uknown function 'setPostCallback" error.
const var samplestart = [Content.getComponent("SampleStart1"), Content.getComponent("SampleStart2"), Content.getComponent("SampleStart3"), Content.getComponent("SampleStart4")]; const uph = Engine.createUserPresetHandler(); uph.setPostCallback(function() { UserPresetHandler.setPostCallback(samplestart); });
-
@trillbilly It's late here so I'll give you an answer in the morning, but reread your code and look up each function you're using in the documentation in the meantime.
-
@Lindon Thanks :) Can I ask what you did in the post callback? I'm simply grabbing the values of the loop start/end knobs and then loading those values back into those knobs. It works sometimes and not others, leading me to suspect timing issues (poss related to sample loading time?!)