Chorus



  • I neved did an effect. Just instruments. I'm needing a better chorus than the default one. Not too fancy but warmer (the default Cubase basic chorus is more than enough). Where should I start? Any advice or roadmap?


  • administrators

    Yeah, that chorus is just taken from the mda FX suite IIRC that was open sourced recently.

    I am really not interested in recoding these simple stock effects, so the most simple way is to find some open source code with a liberal license (BSD or MIT) and if it's straight forward to add, I'll write the wrapper code and include it as HISE module (eg. the Dynamics module is something I found lurking on GitHub / Music DSP).

    Otherwise I'd say "wait for hnode", but again, takes time 🙂



  • @christoph-hart Is the saturation module tape or tube? Is that mda code too?



  • @christoph-hart Cool! will do my research! Thing is I wont be able to check if it's a good one or not.
    I've found some faust modules that can be converted on the faust online compiler to C++ Does this work?

     /* ------------------------------------------------------------
    name: "Flanger"
    Code generated with Faust 2.11.5 (https://faust.grame.fr)
    Compilation options: cpp, -scal -ftz 0
    ------------------------------------------------------------ */
    
    #ifndef  __mydsp_H__
    #define  __mydsp_H__
    
    #ifndef FAUSTFLOAT
    #define FAUSTFLOAT float
    #endif 
    
    #include <algorithm>
    #include <cmath>
    #include <math.h>
    
    
    #ifndef FAUSTCLASS 
    #define FAUSTCLASS mydsp
    #endif
    #ifdef __APPLE__ 
    #define exp10f __exp10f
    #define exp10 __exp10
    #endif
    
    class mydsp : public dsp {
    	
     private:
    	
    	FAUSTFLOAT fHslider0;
    	int iVec0[2];
    	float fRec0[2];
    	int IOTA;
    	float fVec1[4096];
    	int fSamplingFreq;
    	float fConst0;
    	float fConst1;
    	FAUSTFLOAT fHslider1;
    	float fRec2[2];
    	float fRec3[2];
    	float fRec1[2];
    	float fVec2[4096];
    	float fRec4[2];
    	
     public:
    	
    	void metadata(Meta* m) { 
    		m->declare("delays.lib/name", "Faust Delay Library");
    		m->declare("delays.lib/version", "0.0");
    		m->declare("filename", "myFaustProgram");
    		m->declare("filters.lib/name", "Faust Filters Library");
    		m->declare("filters.lib/version", "0.0");
    		m->declare("maths.lib/author", "GRAME");
    		m->declare("maths.lib/copyright", "GRAME");
    		m->declare("maths.lib/license", "LGPL with exception");
    		m->declare("maths.lib/name", "Faust Math Library");
    		m->declare("maths.lib/version", "2.1");
    		m->declare("name", "Flanger");
    		m->declare("oscillators.lib/name", "Faust Oscillator Library");
    		m->declare("oscillators.lib/version", "0.0");
    		m->declare("phaflangers.lib/name", "Faust Phaser and Flanger Library");
    		m->declare("phaflangers.lib/version", "0.0");
    		m->declare("signals.lib/name", "Faust Signal Routing Library");
    		m->declare("signals.lib/version", "0.0");
    	}
    
    	virtual int getNumInputs() {
    		return 1;
    		
    	}
    	virtual int getNumOutputs() {
    		return 1;
    		
    	}
    	virtual int getInputRate(int channel) {
    		int rate;
    		switch (channel) {
    			case 0: {
    				rate = 1;
    				break;
    			}
    			default: {
    				rate = -1;
    				break;
    			}
    			
    		}
    		return rate;
    		
    	}
    	virtual int getOutputRate(int channel) {
    		int rate;
    		switch (channel) {
    			case 0: {
    				rate = 1;
    				break;
    			}
    			default: {
    				rate = -1;
    				break;
    			}
    			
    		}
    		return rate;
    		
    	}
    	
    	static void classInit(int samplingFreq) {
    		
    	}
    	
    	virtual void instanceConstants(int samplingFreq) {
    		fSamplingFreq = samplingFreq;
    		fConst0 = std::min<float>(192000.0f, std::max<float>(1.0f, float(fSamplingFreq)));
    		fConst1 = (6.28318548f / fConst0);
    		
    	}
    	
    	virtual void instanceResetUserInterface() {
    		fHslider0 = FAUSTFLOAT(10.0f);
    		fHslider1 = FAUSTFLOAT(3.0f);
    		
    	}
    	
    	virtual void instanceClear() {
    		for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
    			iVec0[l0] = 0;
    			
    		}
    		for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
    			fRec0[l1] = 0.0f;
    			
    		}
    		IOTA = 0;
    		for (int l2 = 0; (l2 < 4096); l2 = (l2 + 1)) {
    			fVec1[l2] = 0.0f;
    			
    		}
    		for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
    			fRec2[l3] = 0.0f;
    			
    		}
    		for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
    			fRec3[l4] = 0.0f;
    			
    		}
    		for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
    			fRec1[l5] = 0.0f;
    			
    		}
    		for (int l6 = 0; (l6 < 4096); l6 = (l6 + 1)) {
    			fVec2[l6] = 0.0f;
    			
    		}
    		for (int l7 = 0; (l7 < 2); l7 = (l7 + 1)) {
    			fRec4[l7] = 0.0f;
    			
    		}
    		
    	}
    	
    	virtual void init(int samplingFreq) {
    		classInit(samplingFreq);
    		instanceInit(samplingFreq);
    	}
    	virtual void instanceInit(int samplingFreq) {
    		instanceConstants(samplingFreq);
    		instanceResetUserInterface();
    		instanceClear();
    	}
    	
    	virtual mydsp* clone() {
    		return new mydsp();
    	}
    	virtual int getSampleRate() {
    		return fSamplingFreq;
    		
    	}
    	
    	virtual void buildUserInterface(UI* ui_interface) {
    		ui_interface->openVerticalBox("Flanger");
    		ui_interface->declare(0, "tooltip", "Reference: https://ccrma.stanford.edu/~jos/pasp/Flanging.html");
    		ui_interface->openVerticalBox("FLANGER");
    		ui_interface->declare(0, "1", "");
    		ui_interface->openHorizontalBox("0x00");
    		ui_interface->declare(&fHslider1, "1", "");
    		ui_interface->declare(&fHslider1, "acc", "0 1 -10 0 10");
    		ui_interface->declare(&fHslider1, "style", "knob");
    		ui_interface->declare(&fHslider1, "unit", "Hz");
    		ui_interface->addHorizontalSlider("Speed", &fHslider1, 3.0f, 0.0f, 10.0f, 0.00999999978f);
    		ui_interface->closeBox();
    		ui_interface->closeBox();
    		ui_interface->declare(&fHslider0, "3", "");
    		ui_interface->declare(&fHslider0, "acc", "1 0 -10 0 10");
    		ui_interface->declare(&fHslider0, "unit", "%");
    		ui_interface->addHorizontalSlider("Flanger Intensity", &fHslider0, 10.0f, 0.0f, 100.0f, 0.00999999978f);
    		ui_interface->closeBox();
    		
    	}
    	
    	virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
    		FAUSTFLOAT* input0 = inputs[0];
    		FAUSTFLOAT* output0 = outputs[0];
    		float fSlow0 = (9.99999975e-06f * float(fHslider0));
    		float fSlow1 = (fConst1 * float(fHslider1));
    		float fSlow2 = std::sin(fSlow1);
    		float fSlow3 = std::cos(fSlow1);
    		for (int i = 0; (i < count); i = (i + 1)) {
    			iVec0[0] = 1;
    			fRec0[0] = (fSlow0 + (0.999000013f * fRec0[1]));
    			float fTemp0 = float(input0[i]);
    			float fTemp1 = ((0.99000001f * fRec1[1]) - fTemp0);
    			fVec1[(IOTA & 4095)] = fTemp1;
    			fRec2[0] = ((fSlow2 * fRec3[1]) + (fSlow3 * fRec2[1]));
    			fRec3[0] = ((float((1 - iVec0[1])) + (fSlow3 * fRec3[1])) - (fSlow2 * fRec2[1]));
    			float fTemp2 = (fConst0 * ((0.00499999989f * (fRec2[0] + 1.0f)) + 0.00100000005f));
    			int iTemp3 = int(fTemp2);
    			float fTemp4 = std::floor(fTemp2);
    			fRec1[0] = ((fVec1[((IOTA - std::min<int>(2049, std::max<int>(0, iTemp3))) & 4095)] * (fTemp4 + (1.0f - fTemp2))) + ((fTemp2 - fTemp4) * fVec1[((IOTA - std::min<int>(2049, std::max<int>(0, (iTemp3 + 1)))) & 4095)]));
    			float fTemp5 = ((0.99000001f * fRec4[1]) - fTemp0);
    			fVec2[(IOTA & 4095)] = fTemp5;
    			float fTemp6 = (fConst0 * ((0.00499999989f * (fRec3[0] + 1.0f)) + 0.00100000005f));
    			int iTemp7 = int(fTemp6);
    			float fTemp8 = std::floor(fTemp6);
    			fRec4[0] = ((fVec2[((IOTA - std::min<int>(2049, std::max<int>(0, iTemp7))) & 4095)] * (fTemp8 + (1.0f - fTemp6))) + ((fTemp6 - fTemp8) * fVec2[((IOTA - std::min<int>(2049, std::max<int>(0, (iTemp7 + 1)))) & 4095)]));
    			output0[i] = FAUSTFLOAT(((0.0500000007f * (fRec0[0] * ((fRec1[0] + fTemp0) + (fRec4[0] + fTemp0)))) + ((1.0f - fRec0[0]) * fTemp0)));
    			iVec0[1] = iVec0[0];
    			fRec0[1] = fRec0[0];
    			IOTA = (IOTA + 1);
    			fRec2[1] = fRec2[0];
    			fRec3[1] = fRec3[0];
    			fRec1[1] = fRec1[0];
    			fRec4[1] = fRec4[0];
    			
    		}
    		
    	}
    
    	
    };
    
    #endif
    

  • administrators

    Yes, but the license is LGPL, so you can't use it in commercial projects.



  • @christoph-hart I think you can use LGPL components in a proprietary project

    "The license allows developers and companies to use and integrate software released under the LGPL into their own (even proprietary) software without being required by the terms of a strong copyleft license to release the source code of their own components. The license only requires software under the LGPL be modifiable by end users via source code availability. For proprietary software, code under the LGPL is usually used in the form of a shared library, so that there is a clear separation between the proprietary and LGPL components. The LGPL is primarily used for software libraries, although it is also used by some stand-alone applications."


  • administrators

    Yeah I am not going to ship a separate library just for one lousy Faust chorus 😉



  • @christoph-hart https://github.com/thestk/stk/blob/master/include/Chorus.h
    Don't really know if it fits but STK seems to be GPL



  • @hisefilo GPL components are definitely not allowed to be used in proprietary software. However STK is not GPL licensed - https://github.com/thestk/stk/blob/master/LICENSE



  • @d-healey sorry for my ignorance. But what kind of license should have to be valid for Christoph to wrap it?



  • @hisefilo The STK license is fine. Basically it has to be permissive, so it allows you to do whatever you want with it. BSD, MIT, and Apache are common ones. This is one of my favourites - https://en.wikipedia.org/wiki/WTFPL 😉


Log in to reply
 

1
Online

339
Users

1.0k
Topics

7.1k
Posts

Looks like your connection to Forum was lost, please wait while we try to reconnect.