HISE Logo Forum
    • Categories
    • Register
    • Login

    Hard Clipper

    Scheduled Pinned Locked Moved General Questions
    43 Posts 6 Posters 2.9k 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.
    • ?
      A Former User @Dan Korneff
      last edited by

      @Dan-Korneff project/DspNetworks/CodeLibrary/snex_node/yournode.h

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

        @Dan-Korneff Hmmm, not sure, guess a snippet won't suffice in this case! DM me a link?

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

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

          @DanH Here ya go! I've been playing with a bunch of different clipping circuits, including a more advanced one that does some creative EQ to the "overs", but this simple clipping circuit with a variable "soft/hard" control is pretty nice.

          Link Preview Image
          Simple Clipper.zip

          KorneffHUB - a safe home for all your data

          favicon

          KorneffHUB (hub.korneffaudio.com)

          simple clipper.gif

          template <int NumVoices> struct snex_shaper
          {
          	SNEX_NODE(snex_shaper);
          	
          	float amount = 0.0;
          	
          	float getSample(float input)
          	{
          		return Math.sign(input) * Math.pow(Math.atan(Math.pow(Math.abs(input), 1 / amount)), amount);
          
          		//return input;
          	}
          	// These functions are the glue code that call the function above
          	template <typename T> void process(T& data)
          	{
          		for(auto ch: data)
          		{
          			for(auto& s: data.toChannelData(ch))
          			{
          				s = getSample(s);
          			}
          		}
          	}
          	template <typename T> void processFrame(T& data)
          	{
          		for(auto& s: data)
          			s = getSample(s);
          	}
          	void reset()
          	{
          		
          	}
          	void prepare(PrepareSpecs ps)
          	{
          		
          	}
          	
          	void setExternalData(const ExternalData& d, int index)
          	{
          	}
          	template <int P> void setParameter(double v)
          	{
          		if(P == 0) // soft/hard value
          			amount = v;
          
          	}
          };
          

          If you want a straight up Hard clipper, try something like:

          f_hard(x, threshold, ceiling) = (abs(x) >= threshold) ? (min(threshold * sign(x), ceiling)) : x
          

          Dan Korneff - Producer / Mixer / Audio Nerd

          ? DanHD 3 Replies Last reply Reply Quote 5
          • ?
            A Former User @Dan Korneff
            last edited by

            @Dan-Korneff are you working on a clipper? I was thinking of picking up flatline by submission audio but i'd wait to see what you can come up with first

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

              @Dan-Korneff oh you absolute beauty! :smiling_face_with_heart-eyes:

              Can't thank you enough!

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

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

                What's tree best way to share a project with SNEX?

                Yeah that's been nagging me for quite some time as I can't embed the SNEX code into the snippet for reasons I already forgot. I'm usually ending up pasting the entire SNEX code along with an example snippet and let the poor reader assemble it manually (the advantage of this is that it makes the SNEX code readable in the forum).

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

                  @Christoph-Hart I'm trying to export the project @Dan-Korneff posted above. I've followed instructions on how to compile the SNEX node for export from this thread: https://forum.hise.audio/topic/4364/snex_node-needs-to-be-wrapped-into-a-compileable-dsp-network?_=1683724590086

                  So:

                  • set 'Allow Compilation'
                  • Select SNEX node and Wrap into Compiled DSP Network
                  • Reload project and choose Export -> Compile DSP Networks
                  • reload project and select Export -> Export as FX Plugin

                  However I run into the 'Snex_node Needs to be wrapped into a compilable DSP Network' error every time.

                  @Dan-Korneff suggested this is an existing bug with the SNEX Shaper node?

                  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

                    @DanH if you 'allow compile network' you don't need to wrap the SNEX node. You need to do that if you don't compile the entire network.
                    It's either one or the other but not both.

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

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

                      @Matt_SF ok thanks, well doing it or not ends up in the same place. My node looks ok I think, the green icon is 'on' as it's meant to be...

                      Any chance anyone else can test?

                      Screenshot 2023-05-10 at 15.22.49.png

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

                      Dan KorneffD ulrikU 2 Replies Last reply Reply Quote 0
                      • Dan KorneffD
                        Dan Korneff @DanH
                        last edited by

                        @DanH I'll try to redo with the SNEX node today. That should work

                        Dan Korneff - Producer / Mixer / Audio Nerd

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

                          @DanH I get the same "Need to be wrapped...." stuff as you

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

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

                            @ulrik Thank you for testing :folded_hands_light_skin_tone:

                            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

                              @DanH @ulrik it's working well here. If you first messed up the DLL compilation, maybe try to redo it in a new project folder (to start from scratch).

                              @Dan-Korneff well done, it sounds nice :thumbs_up:

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

                              Dan KorneffD DanHD 3 Replies Last reply Reply Quote 0
                              • Dan KorneffD
                                Dan Korneff @Matt_SF
                                last edited by

                                @Matt_SF Wish I could take credit. This is a variable clipping equation from 20 years ago.

                                Dan Korneff - Producer / Mixer / Audio Nerd

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

                                  @Dan-Korneff well, old doesn't mean bad, so thanks anyway 😁👍

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

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

                                    @Matt_SF just tried in a new project and get the same result...

                                    I get this error message in the dll compilation though, but says process completed and there's a dylib file created and the node looks correct in Hise...

                                    DLL_EXPORT scriptnode::Error getError()
                                                                 ^
                                    
                                    
                                    ▸ Compiling RNBO.cpp
                                    ▸ Linking CLIPPER.dylib
                                    ▸ Build Succeeded
                                    
                                    Saving session...
                                    ...copying shared history...
                                    ...saving history...truncating history files...
                                    ...completed.
                                    
                                    [Process completed]
                                    
                                    

                                    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 so you managed to export the project as a plugin?

                                      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

                                        @DanH yes, it's working just fine. I don't know why it won't work on your computer.
                                        These are the steps I followed (as usual actually) :

                                        • new project, create a scriptFX module
                                        • create a snex_shaper node
                                        • create a new file called "snex_shaper"
                                        • create a new parameter called "soft/hard"
                                        • copy/paste @Dan-Korneff 's code into it
                                        • set allow compilation to "enabled"
                                        • Done

                                        I'm sure you know how to do it though...

                                        If the snex node doesn't work for you, and you still want to use it, try to use a Math.exprnode and put the algorithm @Dan-Korneff used in the SNEX code in it.

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

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

                                          @Matt_SF I get the same issue here when I try to export a plugin after compiling the network .dll of a SNEX Shaper node.

                                          Screenshot 2023-05-11 165428.jpg

                                          Dan Korneff - Producer / Mixer / Audio Nerd

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

                                            @Dan-Korneff you must not wrap the snex_shaper node, simply leave it as it is and compile the dll :

                                            e651c020-c116-4ca4-bd78-08dce33398f3-image.png

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

                                            Dan KorneffD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            22

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.4k

                                            Posts