[SCM] calf/master: + Primitive implementation of pitch bend (octave range) in monosynth + Fixed stupid bug in bandlimiting code + Allowed some aliasing in bandlimiter (monosynth is not a synth for dogs)
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:36:43 UTC 2013
The following commit has been merged in the master branch:
commit dd2fd0ea0ea1e90be989c2ecc8e68f5b2ddfe576
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Sat Dec 8 23:30:18 2007 +0000
+ Primitive implementation of pitch bend (octave range) in monosynth
+ Fixed stupid bug in bandlimiting code
+ Allowed some aliasing in bandlimiter (monosynth is not a synth for dogs)
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@10 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/calf/modules_dev.h b/src/calf/modules_dev.h
index e439180..13a70fa 100644
--- a/src/calf/modules_dev.h
+++ b/src/calf/modules_dev.h
@@ -59,7 +59,7 @@ public:
biquad<float> filter2;
int wave1, wave2;
float freq, cutoff, decay_factor;
- float detune, xpose, xfade;
+ float detune, xpose, xfade, pitchbend;
int voice_age;
float odcr;
int queue_note_on;
@@ -74,8 +74,7 @@ public:
void note_on()
{
freq = 440 * pow(2.0, (queue_note_on - 69) / 12.0);
- osc1.set_freq(freq * (2 - detune), srate);
- osc2.set_freq(freq * (detune) * xpose, srate);
+ set_frequency();
osc1.waveform = waves[wave1].get_level(osc1.phasedelta);
osc2.waveform = waves[wave2].get_level(osc2.phasedelta);
@@ -132,9 +131,18 @@ public:
if (data[1] == last_key)
gate = false;
break;
+ case 14:
+ float value = data[1] + 128 *data[2] - 8192;
+ pitchbend = pow(2.0, value / 8192.0);
+ break;
}
default_handle_event(data, len, params, param_count);
}
+ void set_frequency()
+ {
+ osc1.set_freq(freq * (2 - detune) * pitchbend, srate);
+ osc2.set_freq(freq * (detune) * pitchbend * xpose, srate);
+ }
void params_changed() {
decay_factor = odcr * 1000.0 / *params[par_decay];
wave1 = dsp::clip(dsp::fastf2i_drm(*params[par_wave1]), 0, (int)wave_count - 1);
@@ -143,11 +151,13 @@ public:
xpose = pow(2.0, *params[par_osc2xpose] / 12.0);
xfade = *params[par_oscmix];
legato = *params[par_legato] >= 0.5f;
+ set_frequency();
}
void activate() {
running = false;
output_pos = 0;
queue_note_on = -1;
+ pitchbend = 1.f;
filter.reset();
filter2.reset();
float data[2048];
@@ -192,6 +202,7 @@ public:
dsp::zero(buffer, step_size);
return;
}
+ set_frequency();
float env = max(0.f, 1.f - voice_age * decay_factor);
cutoff = *params[par_cutoff] * pow(2.0f, env * *params[par_envmod] * (1.f / 1200.f));
if (*params[par_keyfollow] >= 0.5f)
diff --git a/src/calf/osc.h b/src/calf/osc.h
index 6efc107..a523e9a 100644
--- a/src/calf/osc.h
+++ b/src/calf/osc.h
@@ -77,9 +77,11 @@ struct bandlimiter
{
std::complex<float> new_spec[SIZE], iffted[SIZE];
for (int i = 0; i < cutoff; i++)
- new_spec[i] = spectrum[i];
- for (int i = cutoff; i < SIZE; i++)
- new_spec[i] = 0.f;
+ new_spec[i] = spectrum[i],
+ new_spec[SIZE - 1 - i] = spectrum[SIZE - 1 - i];
+ for (int i = cutoff; i < SIZE / 2; i++)
+ new_spec[i] = 0.f,
+ new_spec[SIZE - 1 - i] = 0.f;
fft.calculate(new_spec, iffted, true);
for (int i = 0; i < SIZE; i++)
output[i] = iffted[i].real();
@@ -106,7 +108,7 @@ struct waveform_family: public map<uint32_t, float *>
uint32_t multiple = 1, base = 1 << (32 - SIZE_BITS);
while(multiple < SIZE / 2) {
float *wf = new float[SIZE];
- bl.make_waveform(wf, (1 << SIZE_BITS) / multiple);
+ bl.make_waveform(wf, (int)((1 << SIZE_BITS) / (1.5 * multiple));
(*this)[base * multiple] = wf;
multiple = multiple << 1;
}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list