@griffinboy
For those who want to see the working code:
Best posts made by griffinboy
-
RE: Detect if the plugin UI interface is open or closed (bypass code when the ui is closed using broadcasters and listeners)
-
RE: More Types of Saturation
@Zazzi
Use scriptnode, see the 'Snex Shaper' node.
When you create a new file inside the node, and then expand the node, you will be able to edit the code, and you will find a function which has a statement that says:
'Return input'To create your own waveshaper distortion, you simply need to return something other than input.
By doing this, you are manipulating the digital signal, which causes it to distort.
Here are a couple of algorithms that you can tweak and experiment with:return ( 1.7finput + -0.5fMath.pow(input,2.0f) + -0.2fMath.pow(input,3.0f) - 0.75f(Math.pow(input,2.0f) - 1.9f*Math.pow(input,3.0f) + Math.pow(input,4.0f)));
return 0.6f + (input-0.6f) / Math.pow(1.0f+((input-0.6f)/(1.0f-0.6f)) , 2.0f);
If you want simple digital distortion, I recommend searching for waveshaper algorithms such as these, and experiment with different ways of implementing them.
Things get fun when you have multiple waveshapers mixed (wet/dry) one after the other, with different lowpass filters inbetween the waveshapers.
I recommend watching a youtube video named 'fifty shades of distortion' for some inspiration.Edit:
If you are wanting to emulate an Analog style saturation, things get much more complex. You have to start using some really advanced maths. I am currently working on a tube circuit model, which I'll release here when it's done. Using that, you could recreate the circuit of different tube amps and get an accurate distortion out.
These typically sound better than waveshapers becuase they react very dynamically to different volume levels, which sounds very lively. -
LAF for the filter display (floating tile)
Not the most pressing feature, but it would be great to have 'look and feel' enabled for the filter display floating tile!
Currently you can only use LAF with the Draggable Filter, but not for the Filter Display.
-
RE: C++ Node not appearing
@griffinboy
I solved it.
The solution is simply to compile the nodes as .dll and then they appear.Do this from inside HISE.
Go to:
Export > Compile DSP networks as dll -
RE: How do you get the sample rate in SNEX?
The working answer:
// Get sampleRate inside a snex node double sr = 0.0; void prepare(PrepareSpecs ps) { sr = ps.sampleRate; }
-
RE: ScriptNode Feedback After a Month of Heavy Use
@HISEnberg Yes! I would love a buffer! Insane granular experiments would ensue
-
RE: Universal HISE Downloader/Installer
@Straticah Would still absolutely love this
-
RE: More Types of Saturation
(edit) version 2.5
If you want a spicer distortion sound (nonlinear stuff)
then paste this into your snex node and read the instructions in the code.// Important: replace the two instances of 'NAME' below, with the name of your snex node FILE template <int NumVoices> struct NAME { SNEX_NODE(NAME); float a = 0.6f; float out = 0.0f; float saturate(float input) { if(input < a) { out = input; } else if(input > a) { // This is the distortion formula there is an alternate one below which you can swap out. // Experiment with different values in the equations. out = a + (input-a) / Math.pow(1.0f+((input-a)/(1.0f-a)) , 2.0f); // algorithm 2: use the two lines of code below, and comment out the line above this // a = 0.0f; // out = ( 1.58f*input + -0.16f*Math.pow(input,2.0f) + -0.42f*Math.pow(input,3.0f) - 0.2f*(Math.pow(input,2.0f) - 2.0f*Math.pow(input,3.0f) + Math.pow(input,4.0f))); } else if(input > 1.0f) { out = (a + 1.0f) / 2.0f; } return out; } float getSample(float input) { if(input>0.0f) { saturate(input); } else { input = input * -1.0f; saturate(input); out = out * -1.0f; } return out; } // 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) { } } };
-
RE: Custom filter curves?
@CyberGen I've achieved this using the HISE parametric EQ, using scripts to automate the positions of different bands, stacked to get the frequency response I want.
I am also working on my own irr filter, from the ground up in SNEX. If I finish it I'll post it here, but I'm not an expert, and this is a big undertaking, so it may take a while, don't wait : )
-
RE: Scriptnode Filter Display On Interface
I was searching how to do this, and of course it is very easy to do nowadays but it still took me a second to figure out, so I'm posting the solution here.
Click the green button and set up an external filter display.
Reference the external display using a floating tile. Index correlates with the external display number that you selected in the filter.
ta da
Latest posts made by griffinboy
-
RE: C++ Node not appearing
@griffinboy
I solved it.
The solution is simply to compile the nodes as .dll and then they appear.Do this from inside HISE.
Go to:
Export > Compile DSP networks as dll -
C++ Node not appearing
This is regarding 3rd party C++ nodes.
I created a new 3rd party C++ node, and it works fine. You can see here it's called Dist1.
My issue is that when I go to create an additional node using the "create C++ third party node template" tool, the following nodes I create do not appear inside HISE at all.
As you can see they are not appearing in the list.What am I doing wrong?
Dsp Networks > ThirdParty
node_properties.json
-
RE: SNEX class instantiation, how?
I'm not entirely sure, but here is some snex that uses classes and returns no errors:
class WDFComponent { int id = 0; int type = 0; span<int, 2> links; Complex& calculateImpedance(Complex& value) { Complex n; return n; } void connect(WDFComponent comp2, int port) { links[port] = comp2.id; return; } public: auto& getFromPort(int port) { return components[links[port]]; } }; class WDFComponentCapacitor: public WDFComponent { // WDFComponentCapacitor() {} double capacitance = 0; public: void setCapacitance(double capacitance0) { capacitance = capacitance0; } public: Complex& calculateImpedance(Complex& value) { Complex denominator = multiplyComplex(value.real, value.imag, capacitance, 0.0); return reciprocalComplex(denominator); } /*capacitor.base.connect = function(WDFComponent other, int port) { connectCapacitor(capacitance, other, port); };*/ }; span<WDFComponent&, 100> components; class thing { void thing() { WDFComponent comp; auto& comp2 = comp.getFromPort(0); WDFComponentCapacitor comp3; } }; // Initialise the processing specs here void prepare(PrepareSpecs ps) { WDFComponentCapacitor cap; cap.setCapacitance(3.0); }
-
RE: Scriptnode Filter Display On Interface
I was searching how to do this, and of course it is very easy to do nowadays but it still took me a second to figure out, so I'm posting the solution here.
Click the green button and set up an external filter display.
Reference the external display using a floating tile. Index correlates with the external display number that you selected in the filter.
ta da
-
Snex - Storing references in an array?
Is there any way at all for me to store references (&) in an array?
I've been getting casting errors every time I try.I am trying to create an array which I can use to store references to classes that I've written.
-
RE: Universal HISE Downloader/Installer
@Straticah Would still absolutely love this
-
RE: Snex: pointers, templates, structures & references
@Christoph-Hart
Apologies but I am going to have to ask a rather technical question!Is there any way at all for me to store a reference (&) in an array?
I looked over the docs and ran multiple tests in the SNEX playground that you recommended, but I've had no luck.
What I am trying to do may be beyond SNEX's capabilities.
I am creating a virtual circuit. It is modular, you can declare any component and attach it to another.
I have created classes for each component type, these classes contain dsp .
These have constructors which allow me to declare new component objects easily.But what I need to do now, is create a script which can link these objects together, and then run an audio signal through them. Each object will pass the signal to the next object until it finally reaches the output, having been processed through each of them.
The issue is, I need to store pointers to these objects in an array.
This is necessary so that I can link the objects together and create a modular signal path. Each component object has multiple terminals (functions) inside, and these terminals can be linked to any other terminal inside another object, so it's quite important that I can point to them, to store the instructions of how the circuit all comes together.Is there any solution to this in SNEX? I have tried all the standard C++ methods to achieve this and have failed. The latest method I tried was to fill a SPAN array with references (&) which it did not accept and gave me a casting error.
The alternative is to create a bunch of individual functions and a FAT stack of IF statements to create the modular logic. As long as SNEX is able to compile functions down cleverly, then this should run very efficiently. Does SNEX work that way?
Thanks for your time I appreciate it! : )
-
RE: SNEX working with audio buffers
I am also now searching for the best way to do this.
I am guessing that there is a best practice for this...Up until now I've been copying the samples for each channel into an array, but it would nice if it was possible to reference the existing buffer and grab information from it directly instead of iterating.
-
RE: Snex: pointers, templates, structures & references
Thanks, that's good to know!