HISE Logo Forum
    • Categories
    • Register
    • Login

    addEffect to a Synth through scripting

    Scheduled Pinned Locked Moved General Questions
    13 Posts 5 Posters 422 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.
    • ulrikU
      ulrik @gorangrooves
      last edited by

      @gorangrooves I think the "String type" should be "SimpleGain" no space in-between, and the "index" should be number, in this case (FX) it should be 2

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

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

        @gorangrooves the child synth, doesn't seem to have that function, only the synth

        Skärmavbild 2023-09-19 kl. 23.07.12.png

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

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

          @ulrik thank you.

          hmmm so I can't really go this route, right? There doesn't seem to be a way to specify to which synth I want to add the FX.

          Goran Rista
          https://gorangrooves.com

          Handy Drums and Handy Grooves
          https://library.gorangrooves.com

          d.healeyD ulrikU 2 Replies Last reply Reply Quote 0
          • d.healeyD
            d.healey @gorangrooves
            last edited by

            @gorangrooves If the order of the effects is the same for each project just do it in one project, open the xml and copy the fx tree to the other projects.

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

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

              @gorangrooves I guess not, I couldn't find any way to do it via scripting.
              It's possible to add modulators to a child synth via scripting, I don't know why it not could be implemented for effects as well, maybe it involves a lot of complexity that I know nothing off?

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

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

                Alright guys, another installment of "why the hell is this feature not documented better?": Use the Builder class to programmatically build your module tree. I'm using this in a project with lots of duplications and the entire module tree is created with this class so whenever I need to make a change to one of the 12 modules, I'll just change a line of code and recompile.

                Be aware that this is a development tool and should not be used in a product to create a dynamic module tree - there are all kinds of stability issues, especially when clearing the module tree and rebuilding it from scratch, so as long as you expect it to crash whenever you call this method, you're in the right mindset :)

                // This class is a helper tool to programmatically build up the module tree
                const var b = Synth.createBuilder();
                
                // Create a sine wave generator.
                const var s = b.create("SineSynth", "Sine", 0, b.ChainIndexes.Direct);
                
                // If the generator already exists, use this function instead of the create function
                //const var s = b.getExisting("COWBELL");
                
                // Add the simple gain, pass in the reference for the sine synth and the magic number for the FX chain
                const var g = b.create("SimpleGain", "MyGain", s, b.ChainIndexes.FX);
                
                // This needs to be called at the end so it sends a rebuild message to the UI
                b.flush();
                
                ulrikU gorangroovesG Dan KorneffD 4 Replies Last reply Reply Quote 2
                • ulrikU
                  ulrik @Christoph Hart
                  last edited by

                  @Christoph-Hart there's a lot in your back pocket I assume? 🤔

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

                  1 Reply Last reply Reply Quote 0
                  • gorangroovesG
                    gorangrooves @Christoph Hart
                    last edited by

                    @Christoph-Hart Thank you! That's all very new to me.

                    I can make sense of it all except for one thing.

                    What's the "ChainIndexes"?

                    Goran Rista
                    https://gorangrooves.com

                    Handy Drums and Handy Grooves
                    https://library.gorangrooves.com

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

                      @gorangrooves a collection of magic numbers that let you specify in which chain you want to add the modules. For FX it‘s pointless but if you add modulators you can define whether they should be added to gain or pitch modulation.

                      1 Reply Last reply Reply Quote 0
                      • Dan KorneffD
                        Dan Korneff @Christoph Hart
                        last edited by

                        @Christoph-Hart Is there a way to create samplers? I'm trying ModulatorSampler, but no work.

                        void ModulatorSynthChainFactoryType::fillTypeNameList()
                        {
                            ADD_NAME_TO_TYPELIST(ModulatorSampler);
                            ADD_NAME_TO_TYPELIST(SineSynth);
                            ADD_NAME_TO_TYPELIST(ModulatorSynthChain);
                            ADD_NAME_TO_TYPELIST(GlobalModulatorContainer);
                        	ADD_NAME_TO_TYPELIST(WaveSynth);
                        	ADD_NAME_TO_TYPELIST(NoiseSynth);
                        	ADD_NAME_TO_TYPELIST(WavetableSynth);
                        	ADD_NAME_TO_TYPELIST(AudioLooper);
                        	ADD_NAME_TO_TYPELIST(ModulatorSynthGroup);
                        	ADD_NAME_TO_TYPELIST(JavascriptSynthesiser);
                        	ADD_NAME_TO_TYPELIST(MacroModulationSource);
                        	ADD_NAME_TO_TYPELIST(SendContainer);
                        	ADD_NAME_TO_TYPELIST(SilentSynth);
                        }
                        

                        Dan Korneff - Producer / Mixer / Audio Nerd

                        Dan KorneffD 1 Reply Last reply Reply Quote 0
                        • Dan KorneffD
                          Dan Korneff @Dan Korneff
                          last edited by

                          Found it:

                          SET_PROCESSOR_NAME("StreamingSampler", "Sampler", "The main sampler class of HISE.");
                          

                          Dan Korneff - Producer / Mixer / Audio Nerd

                          1 Reply Last reply Reply Quote 0
                          • Dan KorneffD
                            Dan Korneff @Christoph Hart
                            last edited by

                            @Christoph-Hart This is sick! Building redundant processes is a breeze now.

                            // This class is a helper tool to programmatically build up the module tree
                            const var b = Synth.createBuilder();
                            
                            inline function createDrumSampler(samplerName, samplerNumber) {
                                local sampler = b.create("StreamingSampler", samplerName + "_" + samplerNumber, 0, b.ChainIndexes.Direct);
                                local directGain = b.create("SimpleGain", samplerName + "_" + samplerNumber + "_Direct", sampler, b.ChainIndexes.FX);
                                local monoGain = b.create("SimpleGain", samplerName + "_" + samplerNumber + "_Mono", sampler, b.ChainIndexes.FX);
                                local ohGain = b.create("SimpleGain", samplerName + "_" + samplerNumber + "_OH", sampler, b.ChainIndexes.FX);
                                local roomGain = b.create("SimpleGain", samplerName + "_" + samplerNumber + "_Room", sampler, b.ChainIndexes.FX);
                                
                                return {
                                    sampler: sampler,
                                    directGain: directGain,
                                    monoGain: monoGain,
                                    ohGain: ohGain,
                                    roomGain: roomGain
                                };
                            }
                            
                            // Usage example:
                            const var kick1 = createDrumSampler("Kick", 1);
                            const var kick2 = createDrumSampler("Kick", 2);
                            const var snare = createDrumSampler("Snare", 1);
                            const var tom1 = createDrumSampler("Tom", 1);
                            const var tom2 = createDrumSampler("Tom", 2);
                            const var tom3 = createDrumSampler("Tom", 3);
                            const var floor1 = createDrumSampler("Floor", 1);
                            const var floor2 = createDrumSampler("Floor", 2);
                            
                            // This needs to be called at the end so it sends a rebuild message to the UI
                            b.flush();
                            

                            Dan Korneff - Producer / Mixer / Audio Nerd

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

                            15

                            Online

                            1.7k

                            Users

                            11.8k

                            Topics

                            102.6k

                            Posts