[SCM] calf/master: + MultiChorus: add frequency response graph
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:38:25 UTC 2013
The following commit has been merged in the master branch:
commit fc8c597920600116bed3a5b0871cb4351cfdab23
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Fri Nov 7 20:14:59 2008 +0000
+ MultiChorus: add frequency response graph
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 4769e1c..18be830 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -713,7 +713,7 @@ public:
};
/// A multitap stereo chorus thing - processing
-class multichorus_audio_module: public audio_module<multichorus_metadata>
+class multichorus_audio_module: public audio_module<multichorus_metadata>, public line_graph_iface
{
public:
float *ins[in_count];
@@ -769,6 +769,16 @@ public:
*params[par_lfophase_r] = (double)right.lfo.phase * 360.0 / 4096.0;
return outputs_mask; // XXXKF allow some delay after input going blank
}
+ bool get_graph(int index, int subindex, float *data, int points, cairo_t *context)
+ {
+ if (index == par_delay && subindex < 2)
+ return calf_plugins::get_graph(*this, subindex, data, points);
+ return false;
+ }
+ float freq_gain(int subindex, float freq, float srate)
+ {
+ return (subindex ? right : left).freq_gain(freq, srate);
+ }
};
extern std::string get_builtin_modules_rdf();
diff --git a/src/calf/multichorus.h b/src/calf/multichorus.h
index 49ee54e..fcd96da 100644
--- a/src/calf/multichorus.h
+++ b/src/calf/multichorus.h
@@ -152,6 +152,31 @@ public:
lfo.step();
}
}
+ float freq_gain(float freq, float sr)
+ {
+ typedef std::complex<double> cfloat;
+ freq *= 2.0 * M_PI / sr;
+ cfloat z = 1.0 / exp(cfloat(0.0, freq)); // z^-1
+ cfloat h = 0.0;
+ int mds = min_delay_samples + mod_depth_samples * 1024 + 2*65536;
+ int mdepth = mod_depth_samples;
+ mdepth = mdepth >> 2;
+ T scale = lfo.get_scale();
+ unsigned int nvoices = lfo.get_voices();
+ for (unsigned int v = 0; v < nvoices; v++)
+ {
+ int lfo_output = lfo.get_value(v);
+ // 3 = log2(32 >> 2) + 1 because the LFO value is in range of [-65535, 65535] (17 bits)
+ int v = mds + (mdepth * lfo_output >> (3 + 1));
+ int fldp = v >> 16;
+ cfloat zn = std::pow(z, fldp); // z^-N
+ h += zn + (zn * z - zn) * cfloat(v / 65536.0 - fldp);
+ }
+ // simulate a lerped comb filter - H(z) = 1 / (1 + fb * (lerp(z^-N, z^-(N+1), fracpos))), N = int(pos), fracpos = pos - int(pos)
+ // mix with dry signal
+ float v = std::abs(cfloat(gs_dry.get_last()) + cfloat(scale * gs_wet.get_last()) * h);
+ return v;
+ }
};
};
diff --git a/src/modules.cpp b/src/modules.cpp
index 7d84f50..acf1374 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -155,7 +155,7 @@ CALF_PLUGIN_INFO(rotary_speaker) = { 0x8483, "RotarySpeaker", "Calf Rotary Speak
CALF_PORT_NAMES(multichorus) = {"In L", "In R", "Out L", "Out R"};
CALF_PORT_PROPS(multichorus) = {
- { 5, 0.1, 10, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC, NULL, "min_delay", "Minimum delay" },
+ { 5, 0.1, 10, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC | PF_PROP_GRAPH, NULL, "min_delay", "Minimum delay" },
{ 6, 0.1, 10, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC, NULL, "mod_depth", "Modulation depth" },
{ 0.5, 0.01, 20, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "mod_rate", "Modulation rate" },
{ 180, 0, 360, 91, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_DEG, NULL, "stereo", "Stereo phase" },
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list