~rantlivelintkale/kuroihako

89d45e0a02d74263f7b52abd0c400f307488b567 — Veikka Valtteri Kallinen 1 year, 5 months ago 4a36e32 master
implement processing and controls
4 files changed, 649 insertions(+), 18 deletions(-)

M gen/jack-cli.cpp
M gen/lv2.cpp
M lv2ttl/kuroihako.ttl
M src/main.dsp
M gen/jack-cli.cpp => gen/jack-cli.cpp +264 -8
@@ 103,6 103,7 @@ using namespace std;
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <math.h>

#ifndef FAUSTCLASS 
#define FAUSTCLASS mydsp


@@ 119,28 120,125 @@ using namespace std;
#define RESTRICT __restrict__
#endif

static float mydsp_faustpower2_f(float value) {
	return value * value;
}

class mydsp : public dsp {
	
 private:
	
	int iRec0[2];
	int fSampleRate;
	float fConst1;
	float fConst2;
	FAUSTFLOAT fHslider0;
	float fRec0[2];
	float fConst3;
	FAUSTFLOAT fHslider1;
	float fRec2[2];
	float fConst4;
	float fConst6;
	float fConst7;
	FAUSTFLOAT fHslider2;
	float fRec4[2];
	FAUSTFLOAT fHslider3;
	float fRec6[2];
	float fConst10;
	float fConst11;
	float fConst12;
	float fConst13;
	float fConst14;
	FAUSTFLOAT fHslider4;
	float fRec10[2];
	float fRec11[3];
	float fVec0[2];
	float fConst15;
	float fConst17;
	float fRec9[2];
	float fRec8[3];
	FAUSTFLOAT fHslider5;
	float fRec12[2];
	float fConst18;
	float fRec14[2];
	float fRec13[3];
	float fConst19;
	float fRec7[3];
	FAUSTFLOAT fHslider6;
	float fRec5[3];
	float fRec3[3];
	float fRec1[3];
	FAUSTFLOAT fHslider7;
	
 public:
	
	void metadata(Meta* m) { 
		m->declare("analyzers.lib/name", "Faust Analyzer Library");
		m->declare("analyzers.lib/version", "0.2");
		m->declare("author", "Veikka Valtteri Kallinen");
		m->declare("basics.lib/name", "Faust Basic Element Library");
		m->declare("basics.lib/version", "0.8");
		m->declare("compile_options", "-a jack-console.cpp -lang cpp -es 1 -mcd 16 -single -ftz 0");
		m->declare("filename", "main.dsp");
		m->declare("filters.lib/filterbank:author", "Julius O. Smith III");
		m->declare("filters.lib/filterbank:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/filterbank:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/fir:author", "Julius O. Smith III");
		m->declare("filters.lib/fir:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/fir:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/highpass:author", "Julius O. Smith III");
		m->declare("filters.lib/highpass:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/highshelf:author", "Julius O. Smith III");
		m->declare("filters.lib/highshelf:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/highshelf:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/iir:author", "Julius O. Smith III");
		m->declare("filters.lib/iir:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/iir:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/lowpass0_highpass1", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/lowpass0_highpass1:author", "Julius O. Smith III");
		m->declare("filters.lib/lowpass:author", "Julius O. Smith III");
		m->declare("filters.lib/lowpass:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/lowpass:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/name", "Faust Filters Library");
		m->declare("filters.lib/peak_eq:author", "Julius O. Smith III");
		m->declare("filters.lib/peak_eq:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/peak_eq:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/peak_eq_cq:author", "Julius O. Smith III");
		m->declare("filters.lib/peak_eq_cq:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/peak_eq_cq:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/resonhp:author", "Julius O. Smith III");
		m->declare("filters.lib/resonhp:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/resonhp:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/resonlp:author", "Julius O. Smith III");
		m->declare("filters.lib/resonlp:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/resonlp:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/tf1:author", "Julius O. Smith III");
		m->declare("filters.lib/tf1:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/tf1:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/tf1s:author", "Julius O. Smith III");
		m->declare("filters.lib/tf1s:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/tf1s:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/tf2:author", "Julius O. Smith III");
		m->declare("filters.lib/tf2:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/tf2:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/tf2s:author", "Julius O. Smith III");
		m->declare("filters.lib/tf2s:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/tf2s:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/version", "0.3");
		m->declare("license", "http://www.gnu.org/licenses/gpl-3.0.en.html");
		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.5");
		m->declare("name", "Kuroihako");
		m->declare("noises.lib/name", "Faust Noise Generator Library");
		m->declare("noises.lib/version", "0.4");
		m->declare("platform.lib/name", "Generic Platform Library");
		m->declare("platform.lib/version", "0.2");
		m->declare("signals.lib/name", "Faust Signal Routing Library");
		m->declare("signals.lib/version", "0.3");
	}

	virtual int getNumInputs() {
		return 0;
		return 1;
	}
	virtual int getNumOutputs() {
		return 1;


@@ 151,14 249,87 @@ class mydsp : public dsp {
	
	virtual void instanceConstants(int sample_rate) {
		fSampleRate = sample_rate;
		float fConst0 = std::min<float>(1.92e+05f, std::max<float>(1.0f, float(fSampleRate)));
		fConst1 = 44.1f / fConst0;
		fConst2 = 1.0f - fConst1;
		fConst3 = 3.1415927f / fConst0;
		fConst4 = 2232.6252f / (fConst0 * std::sin(3348.9377f / fConst0));
		float fConst5 = std::tan(1674.4689f / fConst0);
		fConst6 = 1.0f / fConst5;
		fConst7 = 2.0f * (1.0f - 1.0f / mydsp_faustpower2_f(fConst5));
		float fConst8 = std::tan(3141.5928f / fConst0);
		float fConst9 = mydsp_faustpower2_f(fConst8);
		fConst10 = 1.0f / fConst9;
		fConst11 = 2.0f * (1.0f - fConst10);
		fConst12 = 1.0f / fConst8;
		fConst13 = (fConst12 + -1.0f) / fConst8 + 1.0f;
		fConst14 = 1.0f / ((fConst12 + 1.0f) / fConst8 + 1.0f);
		fConst15 = 1.0f - fConst12;
		float fConst16 = fConst12 + 1.0f;
		fConst17 = 1.0f / fConst16;
		fConst18 = 0.0f - 1.0f / (fConst8 * fConst16);
		fConst19 = 0.0f - 2.0f / fConst9;
	}
	
	virtual void instanceResetUserInterface() {
		fHslider0 = FAUSTFLOAT(8e+03f);
		fHslider1 = FAUSTFLOAT(-8.6f);
		fHslider2 = FAUSTFLOAT(201.0f);
		fHslider3 = FAUSTFLOAT(2.5e+03f);
		fHslider4 = FAUSTFLOAT(405.0f);
		fHslider5 = FAUSTFLOAT(18.0f);
		fHslider6 = FAUSTFLOAT(0.0f);
		fHslider7 = FAUSTFLOAT(0.0f);
	}
	
	virtual void instanceClear() {
		for (int l0 = 0; l0 < 2; l0 = l0 + 1) {
			iRec0[l0] = 0;
			fRec0[l0] = 0.0f;
		}
		for (int l1 = 0; l1 < 2; l1 = l1 + 1) {
			fRec2[l1] = 0.0f;
		}
		for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
			fRec4[l2] = 0.0f;
		}
		for (int l3 = 0; l3 < 2; l3 = l3 + 1) {
			fRec6[l3] = 0.0f;
		}
		for (int l4 = 0; l4 < 2; l4 = l4 + 1) {
			fRec10[l4] = 0.0f;
		}
		for (int l5 = 0; l5 < 3; l5 = l5 + 1) {
			fRec11[l5] = 0.0f;
		}
		for (int l6 = 0; l6 < 2; l6 = l6 + 1) {
			fVec0[l6] = 0.0f;
		}
		for (int l7 = 0; l7 < 2; l7 = l7 + 1) {
			fRec9[l7] = 0.0f;
		}
		for (int l8 = 0; l8 < 3; l8 = l8 + 1) {
			fRec8[l8] = 0.0f;
		}
		for (int l9 = 0; l9 < 2; l9 = l9 + 1) {
			fRec12[l9] = 0.0f;
		}
		for (int l10 = 0; l10 < 2; l10 = l10 + 1) {
			fRec14[l10] = 0.0f;
		}
		for (int l11 = 0; l11 < 3; l11 = l11 + 1) {
			fRec13[l11] = 0.0f;
		}
		for (int l12 = 0; l12 < 3; l12 = l12 + 1) {
			fRec7[l12] = 0.0f;
		}
		for (int l13 = 0; l13 < 3; l13 = l13 + 1) {
			fRec5[l13] = 0.0f;
		}
		for (int l14 = 0; l14 < 3; l14 = l14 + 1) {
			fRec3[l14] = 0.0f;
		}
		for (int l15 = 0; l15 < 3; l15 = l15 + 1) {
			fRec1[l15] = 0.0f;
		}
	}
	


@@ 182,15 353,100 @@ class mydsp : public dsp {
	
	virtual void buildUserInterface(UI* ui_interface) {
		ui_interface->openVerticalBox("Kuroihako");
		ui_interface->declare(&fHslider4, "1", "");
		ui_interface->addHorizontalSlider("Pre Bass", &fHslider4, FAUSTFLOAT(405.0f), FAUSTFLOAT(1e+01f), FAUSTFLOAT(1e+03f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider5, "2", "");
		ui_interface->addHorizontalSlider("Brightness", &fHslider5, FAUSTFLOAT(18.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(18.0f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider3, "3", "");
		ui_interface->addHorizontalSlider("Pre Treble", &fHslider3, FAUSTFLOAT(2.5e+03f), FAUSTFLOAT(6.3e+02f), FAUSTFLOAT(1e+04f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider6, "4", "");
		ui_interface->addHorizontalSlider("Pre Gain", &fHslider6, FAUSTFLOAT(0.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(1e+01f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider2, "5", "");
		ui_interface->addHorizontalSlider("Post Bass", &fHslider2, FAUSTFLOAT(201.0f), FAUSTFLOAT(1e+01f), FAUSTFLOAT(1e+03f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider1, "6", "");
		ui_interface->addHorizontalSlider("Post Mid", &fHslider1, FAUSTFLOAT(-8.6f), FAUSTFLOAT(-18.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider0, "7", "");
		ui_interface->addHorizontalSlider("Post Treble", &fHslider0, FAUSTFLOAT(8e+03f), FAUSTFLOAT(6.3e+02f), FAUSTFLOAT(1e+04f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider7, "8", "");
		ui_interface->addHorizontalSlider("Post Gain", &fHslider7, FAUSTFLOAT(0.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(1e+01f), FAUSTFLOAT(0.01f));
		ui_interface->closeBox();
	}
	
	virtual void compute(int count, FAUSTFLOAT** RESTRICT inputs, FAUSTFLOAT** RESTRICT outputs) {
		FAUSTFLOAT* input0 = inputs[0];
		FAUSTFLOAT* output0 = outputs[0];
		float fSlow0 = fConst1 * float(fHslider0);
		float fSlow1 = fConst1 * float(fHslider1);
		float fSlow2 = fConst1 * float(fHslider2);
		float fSlow3 = fConst1 * float(fHslider3);
		float fSlow4 = fConst1 * float(fHslider4);
		float fSlow5 = fConst1 * float(fHslider5);
		float fSlow6 = std::pow(1e+01f, 0.5f * float(fHslider6));
		float fSlow7 = 0.1f / std::atan(0.1f * fSlow6);
		float fSlow8 = std::pow(1e+01f, 0.5f * float(fHslider7));
		float fSlow9 = 0.1f / std::atan(0.1f * fSlow8);
		for (int i0 = 0; i0 < count; i0 = i0 + 1) {
			iRec0[0] = 1103515245 * iRec0[1] + 12345;
			output0[i0] = FAUSTFLOAT(4.656613e-10f * float(iRec0[0]));
			iRec0[1] = iRec0[0];
			fRec0[0] = fSlow0 + fConst2 * fRec0[1];
			float fTemp0 = std::tan(fConst3 * fRec0[0]);
			float fTemp1 = 1.0f / fTemp0;
			float fTemp2 = (fTemp1 + 1.3333334f) / fTemp0 + 1.0f;
			fRec2[0] = fSlow1 + fConst2 * fRec2[1];
			int iTemp3 = fRec2[0] > 0.0f;
			float fTemp4 = fConst4 * std::pow(1e+01f, 0.05f * std::fabs(fRec2[0]));
			float fTemp5 = ((iTemp3) ? fConst4 : fTemp4);
			float fTemp6 = fConst6 * (fConst6 + fTemp5) + 1.0f;
			float fTemp7 = ((iTemp3) ? fTemp4 : fConst4);
			float fTemp8 = fConst7 * fRec3[1];
			fRec4[0] = fSlow2 + fConst2 * fRec4[1];
			float fTemp9 = std::tan(fConst3 * fRec4[0]);
			float fTemp10 = 1.0f / fTemp9;
			float fTemp11 = (fTemp10 + 1.3333334f) / fTemp9 + 1.0f;
			fRec6[0] = fSlow3 + fConst2 * fRec6[1];
			float fTemp12 = std::tan(fConst3 * fRec6[0]);
			float fTemp13 = 1.0f / fTemp12;
			float fTemp14 = (fTemp13 + 1.3333334f) / fTemp12 + 1.0f;
			fRec10[0] = fSlow4 + fConst2 * fRec10[1];
			float fTemp15 = std::tan(fConst3 * fRec10[0]);
			float fTemp16 = 1.0f / fTemp15;
			float fTemp17 = (fTemp16 + 1.3333334f) / fTemp15 + 1.0f;
			float fTemp18 = float(input0[i0]);
			fRec11[0] = fTemp18 - (fRec11[2] * ((fTemp16 + -1.3333334f) / fTemp15 + 1.0f) + 2.0f * fRec11[1] * (1.0f - 1.0f / mydsp_faustpower2_f(fTemp15))) / fTemp17;
			float fTemp19 = fTemp18 - (fRec11[2] + fRec11[0] + 2.0f * fRec11[1]) / fTemp17;
			fVec0[0] = fTemp19;
			fRec9[0] = 0.0f - fConst17 * (fConst15 * fRec9[1] - (fTemp19 + fVec0[1]));
			fRec8[0] = fRec9[0] - fConst14 * (fConst13 * fRec8[2] + fConst11 * fRec8[1]);
			fRec12[0] = fSlow5 + fConst2 * fRec12[1];
			fRec14[0] = fConst18 * fVec0[1] - fConst17 * (fConst15 * fRec14[1] - fConst12 * fTemp19);
			fRec13[0] = fRec14[0] - fConst14 * (fConst13 * fRec13[2] + fConst11 * fRec13[1]);
			fRec7[0] = fConst14 * ((fConst10 * fRec13[0] + fConst19 * fRec13[1] + fConst10 * fRec13[2]) * std::pow(1e+01f, 0.05f * fRec12[0]) + fRec8[2] + fRec8[0] + 2.0f * fRec8[1]) - (fRec7[2] * ((fTemp13 + -1.3333334f) / fTemp12 + 1.0f) + 2.0f * fRec7[1] * (1.0f - 1.0f / mydsp_faustpower2_f(fTemp12))) / fTemp14;
			float fTemp20 = fSlow7 * std::atan(fSlow6 * ((fRec7[2] + fRec7[0] + 2.0f * fRec7[1]) / fTemp14));
			fRec5[0] = fTemp20 - (fRec5[2] * ((fTemp10 + -1.3333334f) / fTemp9 + 1.0f) + 2.0f * fRec5[1] * (1.0f - 1.0f / mydsp_faustpower2_f(fTemp9))) / fTemp11;
			fRec3[0] = fTemp20 - ((fRec5[2] + fRec5[0] + 2.0f * fRec5[1]) / fTemp11 + (fRec3[2] * (fConst6 * (fConst6 - fTemp5) + 1.0f) + fTemp8) / fTemp6);
			fRec1[0] = (fTemp8 + fRec3[0] * (fConst6 * (fConst6 + fTemp7) + 1.0f) + fRec3[2] * (fConst6 * (fConst6 - fTemp7) + 1.0f)) / fTemp6 - (fRec1[2] * ((fTemp1 + -1.3333334f) / fTemp0 + 1.0f) + 2.0f * fRec1[1] * (1.0f - 1.0f / mydsp_faustpower2_f(fTemp0))) / fTemp2;
			output0[i0] = FAUSTFLOAT(fSlow9 * std::atan(fSlow8 * ((fRec1[2] + fRec1[0] + 2.0f * fRec1[1]) / fTemp2)));
			fRec0[1] = fRec0[0];
			fRec2[1] = fRec2[0];
			fRec4[1] = fRec4[0];
			fRec6[1] = fRec6[0];
			fRec10[1] = fRec10[0];
			fRec11[2] = fRec11[1];
			fRec11[1] = fRec11[0];
			fVec0[1] = fVec0[0];
			fRec9[1] = fRec9[0];
			fRec8[2] = fRec8[1];
			fRec8[1] = fRec8[0];
			fRec12[1] = fRec12[0];
			fRec14[1] = fRec14[0];
			fRec13[2] = fRec13[1];
			fRec13[1] = fRec13[0];
			fRec7[2] = fRec7[1];
			fRec7[1] = fRec7[0];
			fRec5[2] = fRec5[1];
			fRec5[1] = fRec5[0];
			fRec3[2] = fRec3[1];
			fRec3[1] = fRec3[0];
			fRec1[2] = fRec1[1];
			fRec1[1] = fRec1[0];
		}
	}


M gen/lv2.cpp => gen/lv2.cpp +264 -8
@@ 295,6 295,7 @@ void LV2UI::run() {}
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <math.h>

#ifndef FAUSTCLASS 
#define FAUSTCLASS kuroihako


@@ 311,28 312,125 @@ void LV2UI::run() {}
#define RESTRICT __restrict__
#endif

static float kuroihako_faustpower2_f(float value) {
	return value * value;
}

class kuroihako : public dsp {
	
 private:
	
	int iRec0[2];
	int fSampleRate;
	float fConst1;
	float fConst2;
	FAUSTFLOAT fHslider0;
	float fRec0[2];
	float fConst3;
	FAUSTFLOAT fHslider1;
	float fRec2[2];
	float fConst4;
	float fConst6;
	float fConst7;
	FAUSTFLOAT fHslider2;
	float fRec4[2];
	FAUSTFLOAT fHslider3;
	float fRec6[2];
	float fConst10;
	float fConst11;
	float fConst12;
	float fConst13;
	float fConst14;
	FAUSTFLOAT fHslider4;
	float fRec10[2];
	float fRec11[3];
	float fVec0[2];
	float fConst15;
	float fConst17;
	float fRec9[2];
	float fRec8[3];
	FAUSTFLOAT fHslider5;
	float fRec12[2];
	float fConst18;
	float fRec14[2];
	float fRec13[3];
	float fConst19;
	float fRec7[3];
	FAUSTFLOAT fHslider6;
	float fRec5[3];
	float fRec3[3];
	float fRec1[3];
	FAUSTFLOAT fHslider7;
	
 public:
	
	void metadata(Meta* m) { 
		m->declare("analyzers.lib/name", "Faust Analyzer Library");
		m->declare("analyzers.lib/version", "0.2");
		m->declare("author", "Veikka Valtteri Kallinen");
		m->declare("basics.lib/name", "Faust Basic Element Library");
		m->declare("basics.lib/version", "0.8");
		m->declare("compile_options", "-a lv2.cpp -lang cpp -cn kuroihako -es 1 -mcd 16 -single -ftz 0");
		m->declare("filename", "main.dsp");
		m->declare("filters.lib/filterbank:author", "Julius O. Smith III");
		m->declare("filters.lib/filterbank:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/filterbank:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/fir:author", "Julius O. Smith III");
		m->declare("filters.lib/fir:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/fir:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/highpass:author", "Julius O. Smith III");
		m->declare("filters.lib/highpass:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/highshelf:author", "Julius O. Smith III");
		m->declare("filters.lib/highshelf:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/highshelf:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/iir:author", "Julius O. Smith III");
		m->declare("filters.lib/iir:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/iir:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/lowpass0_highpass1", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/lowpass0_highpass1:author", "Julius O. Smith III");
		m->declare("filters.lib/lowpass:author", "Julius O. Smith III");
		m->declare("filters.lib/lowpass:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/lowpass:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/name", "Faust Filters Library");
		m->declare("filters.lib/peak_eq:author", "Julius O. Smith III");
		m->declare("filters.lib/peak_eq:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/peak_eq:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/peak_eq_cq:author", "Julius O. Smith III");
		m->declare("filters.lib/peak_eq_cq:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/peak_eq_cq:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/resonhp:author", "Julius O. Smith III");
		m->declare("filters.lib/resonhp:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/resonhp:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/resonlp:author", "Julius O. Smith III");
		m->declare("filters.lib/resonlp:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/resonlp:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/tf1:author", "Julius O. Smith III");
		m->declare("filters.lib/tf1:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/tf1:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/tf1s:author", "Julius O. Smith III");
		m->declare("filters.lib/tf1s:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/tf1s:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/tf2:author", "Julius O. Smith III");
		m->declare("filters.lib/tf2:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/tf2:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/tf2s:author", "Julius O. Smith III");
		m->declare("filters.lib/tf2s:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m->declare("filters.lib/tf2s:license", "MIT-style STK-4.3 license");
		m->declare("filters.lib/version", "0.3");
		m->declare("license", "http://www.gnu.org/licenses/gpl-3.0.en.html");
		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.5");
		m->declare("name", "Kuroihako");
		m->declare("noises.lib/name", "Faust Noise Generator Library");
		m->declare("noises.lib/version", "0.4");
		m->declare("platform.lib/name", "Generic Platform Library");
		m->declare("platform.lib/version", "0.2");
		m->declare("signals.lib/name", "Faust Signal Routing Library");
		m->declare("signals.lib/version", "0.3");
	}

	virtual int getNumInputs() {
		return 0;
		return 1;
	}
	virtual int getNumOutputs() {
		return 1;


@@ 343,14 441,87 @@ class kuroihako : public dsp {
	
	virtual void instanceConstants(int sample_rate) {
		fSampleRate = sample_rate;
		float fConst0 = std::min<float>(1.92e+05f, std::max<float>(1.0f, float(fSampleRate)));
		fConst1 = 44.1f / fConst0;
		fConst2 = 1.0f - fConst1;
		fConst3 = 3.1415927f / fConst0;
		fConst4 = 2232.6252f / (fConst0 * std::sin(3348.9377f / fConst0));
		float fConst5 = std::tan(1674.4689f / fConst0);
		fConst6 = 1.0f / fConst5;
		fConst7 = 2.0f * (1.0f - 1.0f / kuroihako_faustpower2_f(fConst5));
		float fConst8 = std::tan(3141.5928f / fConst0);
		float fConst9 = kuroihako_faustpower2_f(fConst8);
		fConst10 = 1.0f / fConst9;
		fConst11 = 2.0f * (1.0f - fConst10);
		fConst12 = 1.0f / fConst8;
		fConst13 = (fConst12 + -1.0f) / fConst8 + 1.0f;
		fConst14 = 1.0f / ((fConst12 + 1.0f) / fConst8 + 1.0f);
		fConst15 = 1.0f - fConst12;
		float fConst16 = fConst12 + 1.0f;
		fConst17 = 1.0f / fConst16;
		fConst18 = 0.0f - 1.0f / (fConst8 * fConst16);
		fConst19 = 0.0f - 2.0f / fConst9;
	}
	
	virtual void instanceResetUserInterface() {
		fHslider0 = FAUSTFLOAT(8e+03f);
		fHslider1 = FAUSTFLOAT(-8.6f);
		fHslider2 = FAUSTFLOAT(201.0f);
		fHslider3 = FAUSTFLOAT(2.5e+03f);
		fHslider4 = FAUSTFLOAT(405.0f);
		fHslider5 = FAUSTFLOAT(18.0f);
		fHslider6 = FAUSTFLOAT(0.0f);
		fHslider7 = FAUSTFLOAT(0.0f);
	}
	
	virtual void instanceClear() {
		for (int l0 = 0; l0 < 2; l0 = l0 + 1) {
			iRec0[l0] = 0;
			fRec0[l0] = 0.0f;
		}
		for (int l1 = 0; l1 < 2; l1 = l1 + 1) {
			fRec2[l1] = 0.0f;
		}
		for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
			fRec4[l2] = 0.0f;
		}
		for (int l3 = 0; l3 < 2; l3 = l3 + 1) {
			fRec6[l3] = 0.0f;
		}
		for (int l4 = 0; l4 < 2; l4 = l4 + 1) {
			fRec10[l4] = 0.0f;
		}
		for (int l5 = 0; l5 < 3; l5 = l5 + 1) {
			fRec11[l5] = 0.0f;
		}
		for (int l6 = 0; l6 < 2; l6 = l6 + 1) {
			fVec0[l6] = 0.0f;
		}
		for (int l7 = 0; l7 < 2; l7 = l7 + 1) {
			fRec9[l7] = 0.0f;
		}
		for (int l8 = 0; l8 < 3; l8 = l8 + 1) {
			fRec8[l8] = 0.0f;
		}
		for (int l9 = 0; l9 < 2; l9 = l9 + 1) {
			fRec12[l9] = 0.0f;
		}
		for (int l10 = 0; l10 < 2; l10 = l10 + 1) {
			fRec14[l10] = 0.0f;
		}
		for (int l11 = 0; l11 < 3; l11 = l11 + 1) {
			fRec13[l11] = 0.0f;
		}
		for (int l12 = 0; l12 < 3; l12 = l12 + 1) {
			fRec7[l12] = 0.0f;
		}
		for (int l13 = 0; l13 < 3; l13 = l13 + 1) {
			fRec5[l13] = 0.0f;
		}
		for (int l14 = 0; l14 < 3; l14 = l14 + 1) {
			fRec3[l14] = 0.0f;
		}
		for (int l15 = 0; l15 < 3; l15 = l15 + 1) {
			fRec1[l15] = 0.0f;
		}
	}
	


@@ 374,15 545,100 @@ class kuroihako : public dsp {
	
	virtual void buildUserInterface(UI* ui_interface) {
		ui_interface->openVerticalBox("Kuroihako");
		ui_interface->declare(&fHslider4, "1", "");
		ui_interface->addHorizontalSlider("Pre Bass", &fHslider4, FAUSTFLOAT(405.0f), FAUSTFLOAT(1e+01f), FAUSTFLOAT(1e+03f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider5, "2", "");
		ui_interface->addHorizontalSlider("Brightness", &fHslider5, FAUSTFLOAT(18.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(18.0f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider3, "3", "");
		ui_interface->addHorizontalSlider("Pre Treble", &fHslider3, FAUSTFLOAT(2.5e+03f), FAUSTFLOAT(6.3e+02f), FAUSTFLOAT(1e+04f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider6, "4", "");
		ui_interface->addHorizontalSlider("Pre Gain", &fHslider6, FAUSTFLOAT(0.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(1e+01f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider2, "5", "");
		ui_interface->addHorizontalSlider("Post Bass", &fHslider2, FAUSTFLOAT(201.0f), FAUSTFLOAT(1e+01f), FAUSTFLOAT(1e+03f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider1, "6", "");
		ui_interface->addHorizontalSlider("Post Mid", &fHslider1, FAUSTFLOAT(-8.6f), FAUSTFLOAT(-18.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider0, "7", "");
		ui_interface->addHorizontalSlider("Post Treble", &fHslider0, FAUSTFLOAT(8e+03f), FAUSTFLOAT(6.3e+02f), FAUSTFLOAT(1e+04f), FAUSTFLOAT(0.01f));
		ui_interface->declare(&fHslider7, "8", "");
		ui_interface->addHorizontalSlider("Post Gain", &fHslider7, FAUSTFLOAT(0.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(1e+01f), FAUSTFLOAT(0.01f));
		ui_interface->closeBox();
	}
	
	virtual void compute(int count, FAUSTFLOAT** RESTRICT inputs, FAUSTFLOAT** RESTRICT outputs) {
		FAUSTFLOAT* input0 = inputs[0];
		FAUSTFLOAT* output0 = outputs[0];
		float fSlow0 = fConst1 * float(fHslider0);
		float fSlow1 = fConst1 * float(fHslider1);
		float fSlow2 = fConst1 * float(fHslider2);
		float fSlow3 = fConst1 * float(fHslider3);
		float fSlow4 = fConst1 * float(fHslider4);
		float fSlow5 = fConst1 * float(fHslider5);
		float fSlow6 = std::pow(1e+01f, 0.5f * float(fHslider6));
		float fSlow7 = 0.1f / std::atan(0.1f * fSlow6);
		float fSlow8 = std::pow(1e+01f, 0.5f * float(fHslider7));
		float fSlow9 = 0.1f / std::atan(0.1f * fSlow8);
		for (int i0 = 0; i0 < count; i0 = i0 + 1) {
			iRec0[0] = 1103515245 * iRec0[1] + 12345;
			output0[i0] = FAUSTFLOAT(4.656613e-10f * float(iRec0[0]));
			iRec0[1] = iRec0[0];
			fRec0[0] = fSlow0 + fConst2 * fRec0[1];
			float fTemp0 = std::tan(fConst3 * fRec0[0]);
			float fTemp1 = 1.0f / fTemp0;
			float fTemp2 = (fTemp1 + 1.3333334f) / fTemp0 + 1.0f;
			fRec2[0] = fSlow1 + fConst2 * fRec2[1];
			int iTemp3 = fRec2[0] > 0.0f;
			float fTemp4 = fConst4 * std::pow(1e+01f, 0.05f * std::fabs(fRec2[0]));
			float fTemp5 = ((iTemp3) ? fConst4 : fTemp4);
			float fTemp6 = fConst6 * (fConst6 + fTemp5) + 1.0f;
			float fTemp7 = ((iTemp3) ? fTemp4 : fConst4);
			float fTemp8 = fConst7 * fRec3[1];
			fRec4[0] = fSlow2 + fConst2 * fRec4[1];
			float fTemp9 = std::tan(fConst3 * fRec4[0]);
			float fTemp10 = 1.0f / fTemp9;
			float fTemp11 = (fTemp10 + 1.3333334f) / fTemp9 + 1.0f;
			fRec6[0] = fSlow3 + fConst2 * fRec6[1];
			float fTemp12 = std::tan(fConst3 * fRec6[0]);
			float fTemp13 = 1.0f / fTemp12;
			float fTemp14 = (fTemp13 + 1.3333334f) / fTemp12 + 1.0f;
			fRec10[0] = fSlow4 + fConst2 * fRec10[1];
			float fTemp15 = std::tan(fConst3 * fRec10[0]);
			float fTemp16 = 1.0f / fTemp15;
			float fTemp17 = (fTemp16 + 1.3333334f) / fTemp15 + 1.0f;
			float fTemp18 = float(input0[i0]);
			fRec11[0] = fTemp18 - (fRec11[2] * ((fTemp16 + -1.3333334f) / fTemp15 + 1.0f) + 2.0f * fRec11[1] * (1.0f - 1.0f / kuroihako_faustpower2_f(fTemp15))) / fTemp17;
			float fTemp19 = fTemp18 - (fRec11[2] + fRec11[0] + 2.0f * fRec11[1]) / fTemp17;
			fVec0[0] = fTemp19;
			fRec9[0] = 0.0f - fConst17 * (fConst15 * fRec9[1] - (fTemp19 + fVec0[1]));
			fRec8[0] = fRec9[0] - fConst14 * (fConst13 * fRec8[2] + fConst11 * fRec8[1]);
			fRec12[0] = fSlow5 + fConst2 * fRec12[1];
			fRec14[0] = fConst18 * fVec0[1] - fConst17 * (fConst15 * fRec14[1] - fConst12 * fTemp19);
			fRec13[0] = fRec14[0] - fConst14 * (fConst13 * fRec13[2] + fConst11 * fRec13[1]);
			fRec7[0] = fConst14 * ((fConst10 * fRec13[0] + fConst19 * fRec13[1] + fConst10 * fRec13[2]) * std::pow(1e+01f, 0.05f * fRec12[0]) + fRec8[2] + fRec8[0] + 2.0f * fRec8[1]) - (fRec7[2] * ((fTemp13 + -1.3333334f) / fTemp12 + 1.0f) + 2.0f * fRec7[1] * (1.0f - 1.0f / kuroihako_faustpower2_f(fTemp12))) / fTemp14;
			float fTemp20 = fSlow7 * std::atan(fSlow6 * ((fRec7[2] + fRec7[0] + 2.0f * fRec7[1]) / fTemp14));
			fRec5[0] = fTemp20 - (fRec5[2] * ((fTemp10 + -1.3333334f) / fTemp9 + 1.0f) + 2.0f * fRec5[1] * (1.0f - 1.0f / kuroihako_faustpower2_f(fTemp9))) / fTemp11;
			fRec3[0] = fTemp20 - ((fRec5[2] + fRec5[0] + 2.0f * fRec5[1]) / fTemp11 + (fRec3[2] * (fConst6 * (fConst6 - fTemp5) + 1.0f) + fTemp8) / fTemp6);
			fRec1[0] = (fTemp8 + fRec3[0] * (fConst6 * (fConst6 + fTemp7) + 1.0f) + fRec3[2] * (fConst6 * (fConst6 - fTemp7) + 1.0f)) / fTemp6 - (fRec1[2] * ((fTemp1 + -1.3333334f) / fTemp0 + 1.0f) + 2.0f * fRec1[1] * (1.0f - 1.0f / kuroihako_faustpower2_f(fTemp0))) / fTemp2;
			output0[i0] = FAUSTFLOAT(fSlow9 * std::atan(fSlow8 * ((fRec1[2] + fRec1[0] + 2.0f * fRec1[1]) / fTemp2)));
			fRec0[1] = fRec0[0];
			fRec2[1] = fRec2[0];
			fRec4[1] = fRec4[0];
			fRec6[1] = fRec6[0];
			fRec10[1] = fRec10[0];
			fRec11[2] = fRec11[1];
			fRec11[1] = fRec11[0];
			fVec0[1] = fVec0[0];
			fRec9[1] = fRec9[0];
			fRec8[2] = fRec8[1];
			fRec8[1] = fRec8[0];
			fRec12[1] = fRec12[0];
			fRec14[1] = fRec14[0];
			fRec13[2] = fRec13[1];
			fRec13[1] = fRec13[0];
			fRec7[2] = fRec7[1];
			fRec7[1] = fRec7[0];
			fRec5[2] = fRec5[1];
			fRec5[1] = fRec5[0];
			fRec3[2] = fRec3[1];
			fRec3[1] = fRec3[0];
			fRec1[2] = fRec1[1];
			fRec1[1] = fRec1[0];
		}
	}


M lv2ttl/kuroihako.ttl => lv2ttl/kuroihako.ttl +95 -1
@@ 18,9 18,103 @@
       doap:maintainer [ foaf:name "Veikka Valtteri Kallinen" ] ;
       doap:license "http://www.gnu.org/licenses/gpl-3.0.en.html" ;
    lv2:port [
	a lv2:InputPort ;
	a lv2:ControlPort ;
	lv2:index 0 ;
	lv2:symbol "Pre_Bass_0" ;
	lv2:name "Pre Bass" ;
        lv2:portProperty epp:hasStrictBounds ;
        epp:rangeSteps 99000 ;
	lv2:default 405 ;
	lv2:minimum 10 ;
	lv2:maximum 1000 ;
    ] , [
	a lv2:InputPort ;
	a lv2:ControlPort ;
	lv2:index 1 ;
	lv2:symbol "Brightness_1" ;
	lv2:name "Brightness" ;
        lv2:portProperty epp:hasStrictBounds ;
        epp:rangeSteps 1800 ;
	lv2:default 18 ;
	lv2:minimum 0 ;
	lv2:maximum 18 ;
    ] , [
	a lv2:InputPort ;
	a lv2:ControlPort ;
	lv2:index 2 ;
	lv2:symbol "Pre_Treble_2" ;
	lv2:name "Pre Treble" ;
        lv2:portProperty epp:hasStrictBounds ;
        epp:rangeSteps 937000 ;
	lv2:default 2500 ;
	lv2:minimum 630 ;
	lv2:maximum 10000 ;
    ] , [
	a lv2:InputPort ;
	a lv2:ControlPort ;
	lv2:index 3 ;
	lv2:symbol "Pre_Gain_3" ;
	lv2:name "Pre Gain" ;
        lv2:portProperty epp:hasStrictBounds ;
        epp:rangeSteps 1000 ;
	lv2:default 0 ;
	lv2:minimum 0 ;
	lv2:maximum 10 ;
    ] , [
	a lv2:InputPort ;
	a lv2:ControlPort ;
	lv2:index 4 ;
	lv2:symbol "Post_Bass_4" ;
	lv2:name "Post Bass" ;
        lv2:portProperty epp:hasStrictBounds ;
        epp:rangeSteps 99000 ;
	lv2:default 201 ;
	lv2:minimum 10 ;
	lv2:maximum 1000 ;
    ] , [
	a lv2:InputPort ;
	a lv2:ControlPort ;
	lv2:index 5 ;
	lv2:symbol "Post_Mid_5" ;
	lv2:name "Post Mid" ;
        lv2:portProperty epp:hasStrictBounds ;
        epp:rangeSteps 1800 ;
	lv2:default -8.6 ;
	lv2:minimum -18 ;
	lv2:maximum 0 ;
    ] , [
	a lv2:InputPort ;
	a lv2:ControlPort ;
	lv2:index 6 ;
	lv2:symbol "Post_Treble_6" ;
	lv2:name "Post Treble" ;
        lv2:portProperty epp:hasStrictBounds ;
        epp:rangeSteps 937000 ;
	lv2:default 8000 ;
	lv2:minimum 630 ;
	lv2:maximum 10000 ;
    ] , [
	a lv2:InputPort ;
	a lv2:ControlPort ;
	lv2:index 7 ;
	lv2:symbol "Post_Gain_7" ;
	lv2:name "Post Gain" ;
        lv2:portProperty epp:hasStrictBounds ;
        epp:rangeSteps 1000 ;
	lv2:default 0 ;
	lv2:minimum 0 ;
	lv2:maximum 10 ;
    ] , [
	a lv2:InputPort ;
	a lv2:AudioPort ;
	lv2:index 8 ;
	lv2:symbol "in0" ;
	lv2:name "in0" ;
    ] , [
	a lv2:OutputPort ;
	a lv2:AudioPort ;
	lv2:index 0 ;
	lv2:index 9 ;
	lv2:symbol "out0" ;
	lv2:name "out0" ;
    ]

M src/main.dsp => src/main.dsp +26 -1
@@ 3,5 3,30 @@ declare author "Veikka Valtteri Kallinen";
declare license "http://www.gnu.org/licenses/gpl-3.0.en.html";

import("stdfaust.lib");
process = no.noise;
pre_bass = hslider("[1]Pre Bass",405,10,1000,0.01) : si.smoo;
pre_brightness = hslider("[2]Brightness",18,0,18,0.01) : si.smoo;
pre_treble = hslider("[3]Pre Treble",2500,630,10000,0.01) : si.smoo;
pre_gain = hslider("[4]Pre Gain",0,0,10,0.01);

post_bass = hslider("[5]Post Bass",201,10,1000,0.01) : si.smoo;
post_mid = hslider("[6]Post Mid",-8.6,-18,0,0.01) : si.smoo;
post_treble = hslider("[7]Post Treble",8000,630,10000,0.01) : si.smoo;
post_gain = hslider("[8]Post Gain",0,0,10,0.01);

pre_bf = fi.resonhp(pre_bass,0.75,1);
pre_hs = fi.highshelf(3,pre_brightness,1000);
pre_tf = fi.resonlp(pre_treble,0.75,1);
pre_eq = pre_bf : pre_hs : pre_tf;

post_bf = fi.resonhp(post_bass,0.75,1);
post_mf = fi.peak_eq_cq(post_mid,533,0.75);
post_tf = fi.resonlp(post_treble,0.75,1);
post_eq = post_bf : post_mf : post_tf;

dist(gain) = *(pregain) : atan : *(postgain)
with {
    pregain = pow(10.0, gain/2);
    postgain = 0.1 / (atan(0.1 * pregain));
};

process = _ : pre_eq : dist(pre_gain) : post_eq : dist(post_gain) : _;