HISE Logo Forum
    • Categories
    • Register
    • Login

    Create script variable declaration for Sampler

    Scheduled Pinned Locked Moved Bug Reports
    12 Posts 3 Posters 1.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey @ulrik
      last edited by

      @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 use getSampler. 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.

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      ulrikU 1 Reply Last reply Reply Quote 1
      • ulrikU
        ulrik @d.healey
        last edited by

        @d-healey Ok, I see. Is this about the Sampler only, or is it wide spread?

        Hise Develop branch
        MacOs 15.3.1, Xcode 16.2
        http://musikboden.se

        1 Reply Last reply Reply Quote 0
        • Christoph HartC
          Christoph Hart
          last edited by

          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");
          
          ulrikU d.healeyD 2 Replies Last reply Reply Quote 3
          • ulrikU
            ulrik @Christoph Hart
            last edited by

            @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?

            Hise Develop branch
            MacOs 15.3.1, Xcode 16.2
            http://musikboden.se

            1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik
              last edited by

              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.

              0_1526255478769_Screenshot 2018-05-14 kl. 01.40.07.png

              and here's the whole project:

              https://www.dropbox.com/s/4cmfbvzbsfhmcv0/Zero Sette B16.zip?dl=0

              cheers!

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @Christoph Hart
                last edited by

                @christoph-hart that asSampler thing is good to know

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                1 Reply Last reply Reply Quote 0
                • Christoph HartC
                  Christoph Hart
                  last edited by

                  @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...

                  ulrikU 1 Reply Last reply Reply Quote 1
                  • ulrikU
                    ulrik @Christoph Hart
                    last edited by

                    @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?

                    Hise Develop branch
                    MacOs 15.3.1, Xcode 16.2
                    http://musikboden.se

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @ulrik
                      last edited by

                      @ulrik You shouldn't be loading samples during playback. You either need more samplers or multiple groups.

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      ulrikU 1 Reply Last reply Reply Quote 1
                      • ulrikU
                        ulrik @d.healey
                        last edited by

                        @d-healey Ok, I'll fix it with more samplers, thank you!

                        Hise Develop branch
                        MacOs 15.3.1, Xcode 16.2
                        http://musikboden.se

                        ulrikU 1 Reply Last reply Reply Quote 0
                        • ulrikU
                          ulrik @ulrik
                          last edited by

                          @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 :)

                          Hise Develop branch
                          MacOs 15.3.1, Xcode 16.2
                          http://musikboden.se

                          1 Reply Last reply Reply Quote 1
                          • First post
                            Last post

                          18

                          Online

                          1.7k

                          Users

                          11.8k

                          Topics

                          103.2k

                          Posts