HISE Logo Forum
    • Categories
    • Register
    • Login

    Scriptnode: Granulator

    Scheduled Pinned Locked Moved General Questions
    63 Posts 12 Posters 5.1k 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.
    • Christoph HartC
      Christoph Hart @DanH
      last edited by Christoph Hart

      WTF? When a spam robot starts to post working answers to a super specific problem you know the uprising isn't far.

      DanHD ? 2 Replies Last reply Reply Quote 7
      • DanHD
        DanH @Christoph Hart
        last edited by

        @Christoph-Hart any chance of an actual answer to the question though?! :face_with_tears_of_joy:

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

        Matt_SFM 1 Reply Last reply Reply Quote 1
        • Matt_SFM
          Matt_SF @DanH
          last edited by

          @DanH isn't it simply :

          af.loadFile("{PROJECT_FOLDER}MySampleMap.xml");
          

          ?
          https://docs.hise.audio/working-with-hise/project-management/projects-folders/sample-maps.html

          Develop branch
          Win10 & VS17 / Ventura & Xcode 14. 3

          DanHD 2 Replies Last reply Reply Quote 0
          • DanHD
            DanH @Matt_SF
            last edited by

            @Matt_SF I hadn't tried it - I thought it was a different kind of wildcard :man_facepalming:

            Thanks, will give it a go now :)

            DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
            https://dhplugins.com/ | https://dcbreaks.com/
            London, UK

            1 Reply Last reply Reply Quote 0
            • DanHD
              DanH @Matt_SF
              last edited by

              @Matt_SF Do you have any idea how I use this to select the sample map within the Granulator?

              DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
              https://dhplugins.com/ | https://dcbreaks.com/
              London, UK

              Matt_SFM 1 Reply Last reply Reply Quote 0
              • Matt_SFM
                Matt_SF @DanH
                last edited by Matt_SF

                @DanH I didn't try it but I guess this should work (thanks Christoph!) :

                const var g = Synth.getAudioSampleProcessor("ScriptGranulator");
                
                const var sMapSlot = g.getAudioFile(0);
                
                sMapSlot.loadFile("{PROJECT_FOLDER}MySampleMap.xml");
                

                Don't forget to setup your granulator node so it uses an external slot :

                5f462d2b-7e86-44a7-97e6-c93c619e5410-image.png

                For the loading of audio files, you can also take a look here, the process is similar :
                Changing Impulses in Scriptnode.

                Develop branch
                Win10 & VS17 / Ventura & Xcode 14. 3

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

                  Nononono, the {PROJECT_FOLDER} wildcard only works if you use it to load a sample map into a sampler. For audio files slots it's different:

                  You can basically load three things into an AudioFile slot and it tries to figure out what you throw at it based on the wildcard (or other things).

                  • a single audio file. This is where you can use the {PROJECT_FOLDER} wildcard to reference the embedded audio files (or the project's AudioFiles folder).
                  • a SFZ file. Then you need an absolute path with the file extension .sfz
                  • a samplemap. Then you need the wildcard {XYZ::SampleMap} - like, literally: XYZ::SampleMap) :)

                  The XYZ in this wildcard means a 3-dimensional mapping (Notenumber, velocity and RRGroup) and is used in the HISE codebase whenever an audio file loads a sampleset with multiple samples.

                  DanHD Matt_SFM ? 4 Replies Last reply Reply Quote 4
                  • DanHD
                    DanH @Christoph Hart
                    last edited by

                    @Christoph-Hart haha, I just figured you had written a generic example πŸ˜‚.

                    DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                    https://dhplugins.com/ | https://dcbreaks.com/
                    London, UK

                    1 Reply Last reply Reply Quote 0
                    • Matt_SFM
                      Matt_SF @Christoph Hart
                      last edited by

                      @Christoph-Hart OK thanks for the clarification! I referred to the [documentation] (https://docs.hise.audio/working-with-hise/project-management/projects-folders/sample-maps.html) but it is indeed for the usage in a sampler πŸ‘

                      Develop branch
                      Win10 & VS17 / Ventura & Xcode 14. 3

                      1 Reply Last reply Reply Quote 0
                      • ?
                        A Former User @Christoph Hart
                        last edited by

                        @Christoph-Hart Rather than a sample player, would you like to add a time stretch node with incoming audio process?

                        1 Reply Last reply Reply Quote 0
                        • DanHD
                          DanH @Christoph Hart
                          last edited by

                          @Christoph-Hart ok so how do I load this into the actual granulator?

                          I tried this (cobbled together via the convolution thread) but I assume it's meant for audio files rather than sample maps... I get an 'object' loaded into the single sample window as opposed to anything in the sample map one. Do I need '.xml' at the end of the loadFile string by the way? I assumed not...

                          const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1");
                          
                          const var af = Engine.createAndRegisterAudioFile(0);
                          
                          af.loadFile("{XYZ::SampleMap}AAB303-PROTON");
                          
                          inline function onComboBox1Control(component, value)
                          {
                          	g1.setFile(af);
                          };
                          
                          Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
                          

                          Screenshot 2022-06-15 at 22.06.13.png
                          Thanks! :)

                          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                          https://dhplugins.com/ | https://dcbreaks.com/
                          London, UK

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

                            @DanH well, you pass in the object reference to g1, but I'm amazed that it actually worked and displays the object pointer :)

                            You need something like this in the control callback:

                            af.loadFile("{XYZ::SampleMap}" + component.getItemText());
                            
                            DanHD 1 Reply Last reply Reply Quote 0
                            • DanHD
                              DanH @Christoph Hart
                              last edited by

                              @Christoph-Hart thanks :) Getting closer.

                              This loads the correct map into the Granulator Sample Map box on compile, and plays the correct map (combobox still shows 'no choices', I haven't populated it with anything).

                              const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1");
                              
                              inline function onGRANBOX1Control(component, value)
                              {
                              	g1.setFile("{XYZ::SampleMap}AAB303-PROTON" + component.getItemText());
                              };
                              
                              Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
                              

                              This does not work (using the Engine.createAndRegister method...)

                              I get the error: '+' is not allowed on the Object type

                              const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1");
                              const var af = Engine.createAndRegisterAudioFile(0);
                              
                              af.loadFile("{XYZ::SampleMap}AAB303-PROTON.xml");
                              
                              inline function onGRANBOX1Control(component, value)
                              {
                              	g1.setFile(af + component.getItemText());
                              };
                              
                              Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
                              

                              So then I tried the below, which populates the combo box with my sampleMaps, and loads the correct names into the Granulator's Single Sample window, but doesn't load the sample map into the Granulator.

                              const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1");
                              var sampleMaps = Sampler.getSampleMapList();
                              
                              GRANBOX1.set("items", "");
                              GRANBOX1.set("items", sampleMaps.join("\n"));
                              
                              inline function onGRANBOX1Control(component, value)
                              {
                              	g1.setFile((sampleMaps[value-1]));
                              };
                              
                              Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
                              

                              Am I on the wrong path?! Feels like I need a way to combine the {XYZ} string with the sampleMap array...

                              DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                              https://dhplugins.com/ | https://dcbreaks.com/
                              London, UK

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

                                Stop passing the af object into the method!!! :)

                                const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1");
                                const var af = Engine.createAndRegisterAudioFile(0);
                                
                                inline function onGRANBOX1Control(component, value)
                                {
                                	af.loadFile("{XYZ::SampleMap}" + component.getItemText());
                                };
                                
                                Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
                                
                                DanHD 1 Reply Last reply Reply Quote 0
                                • DanHD
                                  DanH @Christoph Hart
                                  last edited by DanH

                                  @Christoph-Hart I tried that first but it doesn't do anything. But I have managed to get it to work... Thanks so much for the help! :)

                                  inline function onGRANBOX1Control(component, value)
                                  {
                                  	g1.setFile("{XYZ::SampleMap}" + component.getItemText());
                                  };
                                  
                                  Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
                                  

                                  EDIT - It's a bit crashy when switching maps in the combo box... Perhaps my method isn't right after all πŸ˜† The maps do change, but it crashes randomly

                                  EDIT 2: Some maps definitely make it crash actually... Any idea if there any some parameters in the sample maps that don't play nice with the Granulator? They're pretty basic maps. Looping on some, no rr's.

                                  DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                  https://dhplugins.com/ | https://dcbreaks.com/
                                  London, UK

                                  DanHD 2 Replies Last reply Reply Quote 0
                                  • DanHD
                                    DanH @DanH
                                    last edited by DanH

                                    @Christoph-Hart so there were 6 maps that crashed HISE every time with the Granulator. This was the commit from yesterday.

                                    Just tried commit from today and those maps are largely ok but others are now crashing which weren't before πŸ˜†

                                    Is my method correct or is it responsible for the crashing do you think?

                                    DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                    https://dhplugins.com/ | https://dcbreaks.com/
                                    London, UK

                                    DanHD 1 Reply Last reply Reply Quote 0
                                    • DanHD
                                      DanH @DanH
                                      last edited by DanH

                                      @Christoph-Hart One other thing, does the Granulator let through the original signal? I have it in an fx chain and I can't get rid of the original signal coming from the sampler / synth.

                                      Actually possibly it's the midi chain container?

                                      EDIT - Wasn't using Math.clear properly

                                      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                      https://dhplugins.com/ | https://dcbreaks.com/
                                      London, UK

                                      1 Reply Last reply Reply Quote 0
                                      • DanHD
                                        DanH @DanH
                                        last edited by

                                        @DanH said in Scriptnode: Granulator:

                                        @Christoph-Hart I tried that first but it doesn't do anything.

                                        I take it back, it does do something and the crashing has gone :)

                                        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                        https://dhplugins.com/ | https://dcbreaks.com/
                                        London, UK

                                        1 Reply Last reply Reply Quote 0
                                        • ?
                                          A Former User @Christoph Hart
                                          last edited by A Former User

                                          @Christoph-Hart pretty impressive! The spambots answer I mean…

                                          DanHD 1 Reply Last reply Reply Quote 0
                                          • DanHD
                                            DanH @A Former User
                                            last edited by DanH

                                            So I've got the Granulator working nicely in my project. I've just been playing with voice modes and the granulator seems to flip between notes when playing a chord - I've no idea what to expect really so I'm just asking if this is expected behaviour. I'd also like to use glide - would that be possible too?!

                                            DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                            https://dhplugins.com/ | https://dcbreaks.com/
                                            London, UK

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

                                            51

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.1k

                                            Posts