Skip to content

Commit

Permalink
Merge pull request #1027 from paulfd/shelving-eqs
Browse files Browse the repository at this point in the history
Update the filters' code ...
  • Loading branch information
paulfd authored Nov 20, 2021
2 parents fbc0e74 + 204914e commit 0bc63e3
Show file tree
Hide file tree
Showing 53 changed files with 456 additions and 458 deletions.
8 changes: 6 additions & 2 deletions src/sfizz/dsp/filters/sfz_filters.dsp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,16 @@ sfzEqPeak = fm.rbjPeakingEqSmooth(smoothCoefs,cutoff,pkShGain,Q) with {

// the SFZ low-shelf with EQ controls
sfzEqLshelf = fm.rbjLowShelfSmooth(smoothCoefs,cutoff,pkShGain,Q) with {
Q = sfzGetQFromSlope(slope);
// Q = sfzGetQFromSlope(slope);
Q = 1./(2.*ma.sinh(0.5*log(2)*bandwidth*w0/sin(w0)));
w0 = 2*ma.PI*cutoff/ma.SR;
};

// the SFZ high-shelf with EQ controls
sfzEqHshelf = fm.rbjHighShelfSmooth(smoothCoefs,cutoff,pkShGain,Q) with {
Q = sfzGetQFromSlope(slope);
// Q = sfzGetQFromSlope(slope);
Q = 1./(2.*ma.sinh(0.5*log(2)*bandwidth*w0/sin(w0)));
w0 = 2*ma.PI*cutoff/ma.SR;
};

//==============================================================================
Expand Down
16 changes: 8 additions & 8 deletions src/sfizz/gen/filters/sfz2chApf1p.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author: "Jean Pierre Cimalando"
license: "BSD-2-Clause"
name: "sfz_filters"
Code generated with Faust 2.30.5 (https://faust.grame.fr)
Code generated with Faust 2.37.3 (https://faust.grame.fr)
Compilation options: -lang cpp -inpl -es 1 -double -ftz 0
------------------------------------------------------------ */

Expand All @@ -19,6 +19,7 @@ Compilation options: -lang cpp -inpl -es 1 -double -ftz 0

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <math.h>


Expand All @@ -40,7 +41,6 @@ class faust2chApf1p : public sfzFilterDsp {
private:

int fSampleRate;
double fConst0;
double fConst1;
double fConst2;
FAUSTFLOAT fHslider0;
Expand All @@ -66,7 +66,7 @@ class faust2chApf1p : public sfzFilterDsp {
void instanceConstants(int sample_rate) {
//[Begin:instanceConstants]
fSampleRate = sample_rate;
fConst0 = double(fSampleRate);
double fConst0 = double(fSampleRate);
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
fConst2 = (6.2831853071795862 / fConst0);
//[End:instanceConstants]
Expand Down Expand Up @@ -120,14 +120,14 @@ class faust2chApf1p : public sfzFilterDsp {
FAUSTFLOAT* output1 = outputs[1];
double fSlow0 = (fSmoothEnable ? fConst1 : 0.0);
double fSlow1 = (((fConst2 * std::min<double>(20000.0, std::max<double>(1.0, double(fHslider0)))) + -1.0) * (1.0 - fSlow0));
for (int i = 0; (i < count); i = (i + 1)) {
double fTemp0 = double(input0[i]);
double fTemp1 = double(input1[i]);
for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
double fTemp0 = double(input0[i0]);
double fTemp1 = double(input1[i0]);
fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow1);
fRec0[0] = (fTemp0 - (fRec1[0] * fRec0[1]));
output0[i] = FAUSTFLOAT((fRec0[1] + (fRec1[0] * fRec0[0])));
output0[i0] = FAUSTFLOAT((fRec0[1] + (fRec1[0] * fRec0[0])));
fRec2[0] = (fTemp1 - (fRec1[0] * fRec2[1]));
output1[i] = FAUSTFLOAT((fRec2[1] + (fRec1[0] * fRec2[0])));
output1[i0] = FAUSTFLOAT((fRec2[1] + (fRec1[0] * fRec2[0])));
fRec1[1] = fRec1[0];
fRec0[1] = fRec0[0];
fRec2[1] = fRec2[0];
Expand Down
16 changes: 8 additions & 8 deletions src/sfizz/gen/filters/sfz2chBpf1p.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author: "Jean Pierre Cimalando"
license: "BSD-2-Clause"
name: "sfz_filters"
Code generated with Faust 2.30.5 (https://faust.grame.fr)
Code generated with Faust 2.37.3 (https://faust.grame.fr)
Compilation options: -lang cpp -inpl -es 1 -double -ftz 0
------------------------------------------------------------ */

Expand All @@ -19,6 +19,7 @@ Compilation options: -lang cpp -inpl -es 1 -double -ftz 0

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <math.h>


Expand All @@ -40,7 +41,6 @@ class faust2chBpf1p : public sfzFilterDsp {
private:

int fSampleRate;
double fConst0;
double fConst1;
double fConst2;
FAUSTFLOAT fHslider0;
Expand Down Expand Up @@ -68,7 +68,7 @@ class faust2chBpf1p : public sfzFilterDsp {
void instanceConstants(int sample_rate) {
//[Begin:instanceConstants]
fSampleRate = sample_rate;
fConst0 = double(fSampleRate);
double fConst0 = double(fSampleRate);
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
fConst2 = (1.0 / fConst0);
//[End:instanceConstants]
Expand Down Expand Up @@ -128,19 +128,19 @@ class faust2chBpf1p : public sfzFilterDsp {
FAUSTFLOAT* output1 = outputs[1];
double fSlow0 = (fSmoothEnable ? fConst1 : 0.0);
double fSlow1 = (std::exp((fConst2 * (0.0 - (6.2831853071795862 * std::min<double>(20000.0, std::max<double>(1.0, double(fHslider0))))))) * (1.0 - fSlow0));
for (int i = 0; (i < count); i = (i + 1)) {
double fTemp0 = double(input0[i]);
double fTemp1 = double(input1[i]);
for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
double fTemp0 = double(input0[i0]);
double fTemp1 = double(input1[i0]);
fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow1);
fRec1[0] = (fTemp0 + (fRec2[0] * fRec1[1]));
double fTemp2 = (1.0 - fRec2[0]);
fRec0[0] = ((fRec1[0] * fTemp2) + (fRec2[0] * fRec0[1]));
double fTemp3 = (fRec2[0] + 1.0);
double fTemp4 = (0.0 - (0.5 * fTemp3));
output0[i] = FAUSTFLOAT(((0.5 * (fRec0[0] * fTemp3)) + (fRec0[1] * fTemp4)));
output0[i0] = FAUSTFLOAT(((0.5 * (fRec0[0] * fTemp3)) + (fRec0[1] * fTemp4)));
fRec4[0] = (fTemp1 + (fRec2[0] * fRec4[1]));
fRec3[0] = ((fRec4[0] * fTemp2) + (fRec2[0] * fRec3[1]));
output1[i] = FAUSTFLOAT(((0.5 * (fRec3[0] * fTemp3)) + (fTemp4 * fRec3[1])));
output1[i0] = FAUSTFLOAT(((0.5 * (fRec3[0] * fTemp3)) + (fTemp4 * fRec3[1])));
fRec2[1] = fRec2[0];
fRec1[1] = fRec1[0];
fRec0[1] = fRec0[0];
Expand Down
16 changes: 8 additions & 8 deletions src/sfizz/gen/filters/sfz2chBpf2p.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author: "Jean Pierre Cimalando"
license: "BSD-2-Clause"
name: "sfz_filters"
Code generated with Faust 2.30.5 (https://faust.grame.fr)
Code generated with Faust 2.37.3 (https://faust.grame.fr)
Compilation options: -lang cpp -inpl -es 1 -double -ftz 0
------------------------------------------------------------ */

Expand All @@ -19,6 +19,7 @@ Compilation options: -lang cpp -inpl -es 1 -double -ftz 0

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <math.h>


Expand All @@ -40,7 +41,6 @@ class faust2chBpf2p : public sfzFilterDsp {
private:

int fSampleRate;
double fConst0;
double fConst1;
double fRec2[2];
double fVec0[2];
Expand Down Expand Up @@ -79,7 +79,7 @@ class faust2chBpf2p : public sfzFilterDsp {
void instanceConstants(int sample_rate) {
//[Begin:instanceConstants]
fSampleRate = sample_rate;
fConst0 = double(fSampleRate);
double fConst0 = double(fSampleRate);
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
fConst2 = (6.2831853071795862 / fConst0);
//[End:instanceConstants]
Expand Down Expand Up @@ -180,9 +180,9 @@ class faust2chBpf2p : public sfzFilterDsp {
double fSlow9 = ((0.0 - fSlow6) * fSlow7);
double fSlow10 = (((1.0 - fSlow4) / fSlow5) * fSlow7);
double fSlow11 = (((0.0 - (2.0 * std::cos(fSlow1))) / fSlow5) * fSlow7);
for (int i = 0; (i < count); i = (i + 1)) {
double fTemp0 = double(input0[i]);
double fTemp1 = double(input1[i]);
for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
double fTemp0 = double(input0[i0]);
double fTemp1 = double(input1[i0]);
fRec2[0] = (fSlow0 * fRec2[1]);
fVec0[0] = (fTemp0 * fRec2[0]);
fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow8);
Expand All @@ -193,13 +193,13 @@ class faust2chBpf2p : public sfzFilterDsp {
fRec6[0] = ((fSlow0 * fRec6[1]) + fSlow11);
fRec1[0] = ((fVec0[1] + ((fTemp0 * fRec3[0]) + fVec2[1])) - (fRec6[0] * fRec1[1]));
fRec0[0] = fRec1[0];
output0[i] = FAUSTFLOAT(fRec0[0]);
output0[i0] = FAUSTFLOAT(fRec0[0]);
fVec3[0] = (fTemp1 * fRec2[0]);
fVec4[0] = (fTemp1 * fRec4[0]);
fVec5[0] = (fVec4[1] - (fRec5[0] * fRec7[1]));
fRec8[0] = ((fVec3[1] + ((fTemp1 * fRec3[0]) + fVec5[1])) - (fRec6[0] * fRec8[1]));
fRec7[0] = fRec8[0];
output1[i] = FAUSTFLOAT(fRec7[0]);
output1[i0] = FAUSTFLOAT(fRec7[0]);
fRec2[1] = fRec2[0];
fVec0[1] = fVec0[0];
fRec3[1] = fRec3[0];
Expand Down
16 changes: 8 additions & 8 deletions src/sfizz/gen/filters/sfz2chBpf2pSv.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author: "Jean Pierre Cimalando"
license: "BSD-2-Clause"
name: "sfz_filters"
Code generated with Faust 2.30.5 (https://faust.grame.fr)
Code generated with Faust 2.37.3 (https://faust.grame.fr)
Compilation options: -lang cpp -inpl -es 1 -double -ftz 0
------------------------------------------------------------ */

Expand All @@ -19,6 +19,7 @@ Compilation options: -lang cpp -inpl -es 1 -double -ftz 0

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <math.h>


Expand All @@ -40,7 +41,6 @@ class faust2chBpf2pSv : public sfzFilterDsp {
private:

int fSampleRate;
double fConst0;
double fConst1;
double fConst2;
FAUSTFLOAT fHslider0;
Expand Down Expand Up @@ -71,7 +71,7 @@ class faust2chBpf2pSv : public sfzFilterDsp {
void instanceConstants(int sample_rate) {
//[Begin:instanceConstants]
fSampleRate = sample_rate;
fConst0 = double(fSampleRate);
double fConst0 = double(fSampleRate);
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
fConst2 = (3.1415926535897931 / fConst0);
//[End:instanceConstants]
Expand Down Expand Up @@ -140,9 +140,9 @@ class faust2chBpf2pSv : public sfzFilterDsp {
double fSlow1 = (1.0 - fSlow0);
double fSlow2 = (std::tan((fConst2 * std::min<double>(20000.0, std::max<double>(1.0, double(fHslider0))))) * fSlow1);
double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min<double>(60.0, std::max<double>(-60.0, double(fVslider0))))));
for (int i = 0; (i < count); i = (i + 1)) {
double fTemp0 = double(input0[i]);
double fTemp1 = double(input1[i]);
for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
double fTemp0 = double(input0[i0]);
double fTemp1 = double(input1[i0]);
fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow2);
double fTemp2 = (fSlow3 + fRec3[0]);
fRec4[0] = ((fSlow0 * fRec4[1]) + (fSlow1 / ((fRec3[0] * fTemp2) + 1.0)));
Expand All @@ -155,15 +155,15 @@ class faust2chBpf2pSv : public sfzFilterDsp {
fRec1[0] = (fRec1[1] + (2.0 * (fRec3[0] * fTemp6)));
double fTemp7 = (fRec2[1] + (2.0 * fTemp5));
fRec2[0] = fTemp7;
output0[i] = FAUSTFLOAT(fRec0);
output0[i0] = FAUSTFLOAT(fRec0);
double fTemp8 = (fTemp1 - (fRec7[1] + (fRec5[0] * fRec8[1])));
double fTemp9 = (fTemp3 * fTemp8);
double fTemp10 = (fRec8[1] + fTemp9);
double fRec6 = fTemp10;
fRec7[0] = (fRec7[1] + (2.0 * (fRec3[0] * fTemp10)));
double fTemp11 = (fRec8[1] + (2.0 * fTemp9));
fRec8[0] = fTemp11;
output1[i] = FAUSTFLOAT(fRec6);
output1[i0] = FAUSTFLOAT(fRec6);
fRec3[1] = fRec3[0];
fRec4[1] = fRec4[0];
fRec5[1] = fRec5[0];
Expand Down
16 changes: 8 additions & 8 deletions src/sfizz/gen/filters/sfz2chBpf4p.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author: "Jean Pierre Cimalando"
license: "BSD-2-Clause"
name: "sfz_filters"
Code generated with Faust 2.30.5 (https://faust.grame.fr)
Code generated with Faust 2.37.3 (https://faust.grame.fr)
Compilation options: -lang cpp -inpl -es 1 -double -ftz 0
------------------------------------------------------------ */

Expand All @@ -19,6 +19,7 @@ Compilation options: -lang cpp -inpl -es 1 -double -ftz 0

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <math.h>


Expand All @@ -40,7 +41,6 @@ class faust2chBpf4p : public sfzFilterDsp {
private:

int fSampleRate;
double fConst0;
double fConst1;
double fConst2;
FAUSTFLOAT fHslider0;
Expand Down Expand Up @@ -89,7 +89,7 @@ class faust2chBpf4p : public sfzFilterDsp {
void instanceConstants(int sample_rate) {
//[Begin:instanceConstants]
fSampleRate = sample_rate;
fConst0 = double(fSampleRate);
double fConst0 = double(fSampleRate);
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
fConst2 = (6.2831853071795862 / fConst0);
//[End:instanceConstants]
Expand Down Expand Up @@ -220,9 +220,9 @@ class faust2chBpf4p : public sfzFilterDsp {
double fSlow9 = (fSlow6 * fSlow7);
double fSlow10 = (((1.0 - fSlow4) / fSlow5) * fSlow7);
double fSlow11 = (((0.0 - (2.0 * std::cos(fSlow1))) / fSlow5) * fSlow7);
for (int i = 0; (i < count); i = (i + 1)) {
double fTemp0 = double(input0[i]);
double fTemp1 = double(input1[i]);
for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
double fTemp0 = double(input0[i0]);
double fTemp1 = double(input1[i0]);
fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow8);
fRec5[0] = (fSlow0 * fRec5[1]);
fVec0[0] = (fTemp0 * fRec5[0]);
Expand All @@ -238,7 +238,7 @@ class faust2chBpf4p : public sfzFilterDsp {
fVec5[0] = (fRec5[0] * fRec3[0]);
fRec1[0] = (((fVec4[1] + fVec5[1]) + (fRec6[0] * fRec3[0])) - (fRec8[0] * fRec1[1]));
fRec0[0] = fRec1[0];
output0[i] = FAUSTFLOAT(fRec0[0]);
output0[i0] = FAUSTFLOAT(fRec0[0]);
fVec6[0] = (fTemp1 * fRec5[0]);
fVec7[0] = (fTemp1 * fRec2[0]);
fVec8[0] = (fVec7[1] - (fRec7[0] * fRec11[1]));
Expand All @@ -249,7 +249,7 @@ class faust2chBpf4p : public sfzFilterDsp {
fVec11[0] = (fRec5[0] * fRec11[0]);
fRec10[0] = (((fVec10[1] + fVec11[1]) + (fRec6[0] * fRec11[0])) - (fRec8[0] * fRec10[1]));
fRec9[0] = fRec10[0];
output1[i] = FAUSTFLOAT(fRec9[0]);
output1[i0] = FAUSTFLOAT(fRec9[0]);
fRec2[1] = fRec2[0];
fRec5[1] = fRec5[0];
fVec0[1] = fVec0[0];
Expand Down
16 changes: 8 additions & 8 deletions src/sfizz/gen/filters/sfz2chBpf6p.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author: "Jean Pierre Cimalando"
license: "BSD-2-Clause"
name: "sfz_filters"
Code generated with Faust 2.30.5 (https://faust.grame.fr)
Code generated with Faust 2.37.3 (https://faust.grame.fr)
Compilation options: -lang cpp -inpl -es 1 -double -ftz 0
------------------------------------------------------------ */

Expand All @@ -19,6 +19,7 @@ Compilation options: -lang cpp -inpl -es 1 -double -ftz 0

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <math.h>


Expand All @@ -40,7 +41,6 @@ class faust2chBpf6p : public sfzFilterDsp {
private:

int fSampleRate;
double fConst0;
double fConst1;
double fConst2;
FAUSTFLOAT fHslider0;
Expand Down Expand Up @@ -99,7 +99,7 @@ class faust2chBpf6p : public sfzFilterDsp {
void instanceConstants(int sample_rate) {
//[Begin:instanceConstants]
fSampleRate = sample_rate;
fConst0 = double(fSampleRate);
double fConst0 = double(fSampleRate);
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
fConst2 = (6.2831853071795862 / fConst0);
//[End:instanceConstants]
Expand Down Expand Up @@ -260,9 +260,9 @@ class faust2chBpf6p : public sfzFilterDsp {
double fSlow9 = (fSlow6 * fSlow7);
double fSlow10 = (((1.0 - fSlow4) / fSlow5) * fSlow7);
double fSlow11 = (((0.0 - (2.0 * std::cos(fSlow1))) / fSlow5) * fSlow7);
for (int i = 0; (i < count); i = (i + 1)) {
double fTemp0 = double(input0[i]);
double fTemp1 = double(input1[i]);
for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
double fTemp0 = double(input0[i0]);
double fTemp1 = double(input1[i0]);
fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow8);
fRec7[0] = (fSlow0 * fRec7[1]);
fVec0[0] = (fTemp0 * fRec7[0]);
Expand All @@ -283,7 +283,7 @@ class faust2chBpf6p : public sfzFilterDsp {
fVec8[0] = (fRec7[0] * fRec3[0]);
fRec1[0] = (((fVec7[1] + fVec8[1]) + (fRec8[0] * fRec3[0])) - (fRec10[0] * fRec1[1]));
fRec0[0] = fRec1[0];
output0[i] = FAUSTFLOAT(fRec0[0]);
output0[i0] = FAUSTFLOAT(fRec0[0]);
fVec9[0] = (fTemp1 * fRec7[0]);
fVec10[0] = (fTemp1 * fRec2[0]);
fVec11[0] = (fVec10[1] - (fRec9[0] * fRec15[1]));
Expand All @@ -299,7 +299,7 @@ class faust2chBpf6p : public sfzFilterDsp {
fVec17[0] = (fRec7[0] * fRec13[0]);
fRec12[0] = (((fVec16[1] + fVec17[1]) + (fRec8[0] * fRec13[0])) - (fRec10[0] * fRec12[1]));
fRec11[0] = fRec12[0];
output1[i] = FAUSTFLOAT(fRec11[0]);
output1[i0] = FAUSTFLOAT(fRec11[0]);
fRec2[1] = fRec2[0];
fRec7[1] = fRec7[0];
fVec0[1] = fVec0[0];
Expand Down
Loading

0 comments on commit 0bc63e3

Please sign in to comment.