Modulating Loop Start/End in real-time (a-la Sample Start)
-
Hello everyone,
following a conversation with @Lindon on VI-Control, I'll post here a problem in which I stumbled.
I have a waveform displaying the current sample, and I'd like to have loop start/end handles that I can freely drag in real time WITHOUT having the sample killed once I release the mouse. In other words, same behaviour as using a slider to control the Sample Start modulator.
I know there are no inbuilt modulators for Loop Start/End, so the best I came up with is thisvar sampler = Sampler1.asSampler(); var allSamples = sampler.createSelection(".*"); WaveformOverlay.setMouseCallback(function(event) { var s = allSamples[0]; var sampleLength = s.get(Sampler.SampleEnd); s.set(Sampler.SampleStart, 0); if (this.data.dragging == "ls") { this.data.loopStart = Math.max(this.data.offset, Math.min(normalizedX, this.data.loopEnd)); s.set(Sampler.LoopStart, parseInt(this.data.loopStart*sampleLength)); Console.print("New loop start: " + parseInt(this.data.loopStart*sampleLength)); } if (this.data.dragging == "le") { this.data.loopEnd = Math.max(this.data.loopStart, normalizedX); s.set(Sampler.LoopEnd, parseInt(this.data.loopEnd*sampleLength)); Console.print("New loop end: " + parseInt(this.data.loopEnd*sampleLength)); } }I see the loop start/end values being correctly set in the Sample Editor, but again, once I drop the controls on the UI the sample, as expected, is killed.
Any workaround besides touching the source code?
-
@Giuseppe If you load the entire sample into ram does it still mute the audio engine when adjusting the loop points?
-
@David-Healey I set SampleStartMod and LoopEnd to the entire sample length in Sample Editor. Does this equal to loading the sample entirely in the RAM? In this case, yes, it still drops the audio when the loop controls are released.
-
@Giuseppe Yes that should load the entire sample into RAM. You can also set the sampler's preload size to -1.
-
@Giuseppe Okay so the alternate approach is to use a hybrid of granular sampling....
As you know its possible to move the start point of any played sample, and you know the loop start point and the loop end point........
So start a note at the loop start point and make it play until the loop end point, then start another note from the loop start point and repeat.....
At this point it is possible for you to change the start and end point of the "loop" to anything you want, at any point in the process....and theres no killing of the currently playing note....
In fact you dont even need to use the loop start point and end point - these can be any position you choose....using the interface with some LAF for the sliders...
-
@Lindon
Thanks Lindon, I'll try this (I guess I need to operate in onNoteOn).
@David-Healey Ok, tried also to set PreLoad size to -1 but the voice killing still happens.