Problem rendering samples with modified start times
-
@blezzbeats You can use global variables, but you should avoid them at all costs because they make things messy.
Generally scripts should be independent of each other. Treat scripts like the way you treat HISE's built in modules, if you want to connect things on the UI script to the module you use either parameter/processor ID, or you use the
setAttribute()
command.I posted a video on patreon last Saturday about articulation switching where I demonstrate this.
-
@d-healey Thanks!
-
I think I found the problem in case anyone else runs into it. If you create a timer with Engine.createTimerObject(), it will be straight-up ignored when you render it in your DAW. The regular onTimer function does work though. I used a timer to trigger another timer so I guess I'm outta luck.
-
@blezzbeats Oh yes that's true. Timer objects are non-realtime, but the synth timer is. If you want two timers then use two scripts/midi processors.
-
@d-healey Do you know how I can trigger the timer of the second script from the first one?
-
@blezzbeats Maybe, tell me what you are trying to achieve and I'll see what I can suggest.
-
@d-healey The sample is divided into 16 even pieces. One timer controls when it should switch over to the next piece (next 16th), according to the host BPM, by changing the Constant modulator of the SampleStartMod of the sampler. Each time that one triggers, it triggers another timer which takes a calculation on how much to stretch the sample based on host BPM, sample rate, sample length, grain size, currently played pitch etc. and machineguns the same Constant modulator.
I had everything working pretty much, now after backtracking and rewriting everything I just need to figure out how to trigger that second timer from the first one. It may work having them run parallel?
-
The way things are twisted together it would be much easier if there's a way to have the timer of script 1 trigger the timer of script 2 though, to avoid duplicates of like 50 variables.
-
@blezzbeats Well you could just put a knob in the second script and in that knob's callback you start your timer, then from the first script you change the value of the knob in the second script.
-
@d-healey Genius!