Create script variable declaration for Sampler
-
@ulrik There is a weird thing with HISE, for some operations on a sampler you have to have use
getChildSynth
and for others you need to usegetSampler
. As you found out to load a sample map you need to use getSampler but if you want to toggle the sampler's bypass button, for example, you need to use getChildSynth. -
@d-healey Ok, I see. Is this about the Sampler only, or is it wide spread?
-
The problem is that there is a misalignment between the C++ architecture and the relation between the script objects: in the C++ world, a Sampler is derived from a Synth, therefore you can call basic synth functions (set the volume, pan, etc) as well as specific sampler functions (load sample maps). However, the script representation doesn't have that relation, so you can't implicitly call the synth functions from a "Sampler-type" reference.
It's unfortunately not so easy to solve, because there is also multiple inheritance (a Sampler is also a TableProcessor, so if you want to change the crossfade table, you need to get a reference using
Synth.getTableProcessor("Sampler")
.Now for the special case of samplers, there is a handy helper function in the child synth modules called
asSampler()
which returns a sampler-type reference, so you can do stuff like this:var s = Synth.getChildSynth("Sampler"); s2.asSampler().loadSampleMap("MySampleMap");
-
@christoph-hart Ok, I think I understand a little bit of what you're saying :) (I'm not a coder but on my way...)
Anyway, it's good to know these little special things for the future, thanks a lot!Btw, loading sample maps, I'm working on a accordion plug, and the left side, the Stradella system, is constructed of bass buttons and chord buttons, a normal accordion usually have 4 different chords.
I have built the Stradella part of the accordion, using only 1 sampler with 4 sample maps, and calling each map for each kind of chord, however I would like to keep the loaded "bass notes" while switching maps, is that possible?
If not, it's no big deal, I will split the Stradella in to 2 samplers.
So the question is, is it possible to load a map, lets say the high registers, and keep the low registers of the without interrupting midi to the low registers?
or loading only rr groups 3 & 4 while keeping 1 & 2? -
I moved the "Stradella bass" part to a new sampler and set it up, however I have som problems with this project, and that is no big surprise if you look at the code :)
The biggest problem is that if I load a sample map to sampler 1 while I'm playing on Sampler 2, the notes will be cut off, for instance it's common to have long bass notes and while holding them change chord type, as soon as I change chord type (loading a new sample map in another Sampler) the notes will be cut off, as if Sampler 2 receives note off messages or something, even though I don't load the maps with key switches yet, but I intend to make later.
here you see how I load the maps for the moment.and here's the whole project:
https://www.dropbox.com/s/4cmfbvzbsfhmcv0/Zero Sette B16.zip?dl=0
cheers!
-
@christoph-hart that
asSampler
thing is good to know -
@ulrik said in Create script variable declaration for Sampler:
So the question is, is it possible to load a map, lets say the high registers, and keep the low registers of the without interrupting midi to the low registers?
or loading only rr groups 3 & 4 while keeping 1 & 2?Nope, one samplemap per sampler is the rule. In your case, just add more samplers...
-
@christoph-hart said in Create script variable declaration for Sampler:
Nope, one samplemap per sampler is the rule. In your case, just add more samplers...
Ok, thank you, I suspected that was the case :)
Using 2 sampler give me a problem though, as I described above, when loading a sample map to Sampler 1 cuts the sound of Sampler 2, is it possible to avoid that?
-
@ulrik You shouldn't be loading samples during playback. You either need more samplers or multiple groups.
-
@d-healey Ok, I'll fix it with more samplers, thank you!
-
@ulrik said in Create script variable declaration for Sampler:
@d-healey Ok, I'll fix it with more samplers, thank you!
or even better, with split one incoming note and trigger 3 instead :) the Synth.playNote() you tought me :)