[SCM] calf/master: Add windowing-based antialiasing to hard sync in Monosynth; update last stretch even if synth is idle.
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:40:18 UTC 2013
The following commit has been merged in the master branch:
commit d64a0487d88f6730ef90dd6d79b892ad4a114138
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Thu Jul 1 23:02:19 2010 +0100
Add windowing-based antialiasing to hard sync in Monosynth; update last stretch even if synth is idle.
diff --git a/gui/gui-monosynth.xml b/gui/gui-monosynth.xml
index 3fea86f..c8aa3d1 100644
--- a/gui/gui-monosynth.xml
+++ b/gui/gui-monosynth.xml
@@ -50,6 +50,11 @@
<knob param="o1_stretch"/>
<value param="o1_stretch"/>
</vbox>
+ <vbox>
+ <label param="o1_window" text="Window"/>
+ <knob param="o1_window"/>
+ <value param="o1_window"/>
+ </vbox>
</hbox>
</frame>
<frame label="Oscillator 2">
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index 6e3f94c..de17490 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -109,7 +109,7 @@ struct monosynth_metadata: public plugin_metadata<monosynth_metadata>
par_lforate, par_lfodelay, par_lfofilter, par_lfopitch, par_lfopw, par_mwhl_lfo, par_scaledetune,
par_env2tocutoff, par_env2tores, par_env2toamp,
par_env2attack, par_env2decay, par_env2sustain, par_env2fade, par_env2release,
- par_stretch1,
+ par_stretch1, par_window1,
par_lfo1trig, par_lfo2trig,
par_lfo2rate, par_lfo2delay,
param_count };
diff --git a/src/metadata.cpp b/src/metadata.cpp
index ca44b23..bf73f8b 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -703,7 +703,8 @@ CALF_PORT_PROPS(monosynth) = {
{ 0, -10000,10000, 21, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER | PF_UNIT_MSEC, NULL, "adsr2_f", "EG2 Fade" },
{ 50, 10,20000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_FADER | PF_UNIT_MSEC, NULL, "adsr2_r", "Release" },
- { 1, 1, 16, 0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB, NULL, "o1_stretch", "Osc1 Stretch" },
+ { 1, 1, 16, 0, PF_FLOAT | PF_SCALE_LOG | PF_UNIT_COEF | PF_CTL_KNOB, NULL, "o1_stretch", "Osc1 Stretch" },
+ { 0, 0, 1, 0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB, NULL, "o1_window", "Osc1 Window" },
{ 0, 0, 1, 0, PF_ENUM | PF_CTL_COMBO, monosynth_lfotrig_names, "lfo1_trig", "LFO1 Trigger Mode" },
{ 0, 0, 1, 0, PF_ENUM | PF_CTL_COMBO, monosynth_lfotrig_names, "lfo2_trig", "LFO2 Trigger Mode" },
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index 5120eab..d5c77c1 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -222,12 +222,24 @@ bool monosynth_audio_module::get_graph(int index, int subindex, float *data, int
if (wave == wave_sqr)
wave = wave_saw;
float *waveform = waves[wave].original;
+ float rnd_start = 1 - *params[par_window1] * 0.5f;
+ float scl = rnd_start < 1.0 ? 1.f / (1 - rnd_start) : 0.f;
for (int i = 0; i < points; i++)
{
int pos = i * S / points;
+ float r = 1;
if (index == par_wave1)
+ {
+ float ph = i * 1.0 / points;
+ if (ph < 0.5f)
+ ph = 1.f - ph;
+ ph = (ph - rnd_start) * scl;
+ if (ph < 0)
+ ph = 0;
+ r = 1.0 - ph * ph;
pos = int(pos * 1.0 * last_stretch1 / 65536.0 ) % S;
- data[i] = (sign * waveform[pos] + waveform[(pos + shift) & (S - 1)]) / (sign == -1 ? 1 : 2);
+ }
+ data[i] = r * (sign * waveform[pos] + waveform[(pos + shift) & (S - 1)]) / (sign == -1 ? 1 : 2);
}
return true;
}
@@ -281,10 +293,20 @@ void monosynth_audio_module::calculate_buffer_oscs(float lfo1)
float cur_xfade = last_xfade;
float xfade_step = (new_xfade - cur_xfade) * (1.0 / step_size);
+ float rnd_start = 1 - *params[par_window1] * 0.5f;
+ float scl = rnd_start < 1.0 ? 1.f / (1 - rnd_start) : 0.f;
+
for (uint32_t i = 0; i < step_size; i++)
{
//buffer[i] = lerp(osc1.get_phaseshifted(shift1, mix1), osc2.get_phaseshifted(shift2, mix2), cur_xfade);
- buffer[i] = lerp(osc1.get_phasedist(stretch1, shift1, mix1), osc2.get_phaseshifted(shift2, mix2), cur_xfade);
+ float o1phase = osc1.phase / (65536.0 * 65536.0);
+ if (o1phase < 0.5)
+ o1phase = 1 - o1phase;
+ o1phase = (o1phase - rnd_start) * scl;
+ if (o1phase < 0)
+ o1phase = 0;
+ float r = 1.0 - o1phase * o1phase;
+ buffer[i] = lerp(r * osc1.get_phasedist(stretch1, shift1, mix1), osc2.get_phaseshifted(shift2, mix2), cur_xfade);
osc1.advance();
osc2.advance();
shift1 += shift_delta1;
@@ -436,6 +458,9 @@ void monosynth_audio_module::calculate_step()
envelope2.advance();
lfo1.get();
lfo2.get();
+ float modsrc[modsrc_count] = { 1, velocity, inertia_pressure.get_last(), modwheel_value, envelope1.value, envelope2.value, 0.5+0.5*lfo1.last, 0.5+0.5*lfo2.last};
+ calculate_modmatrix(moddest, moddest_count, modsrc);
+ last_stretch1 = (int32_t)(65536 * dsp::clip(*params[par_stretch1] + 0.01f * moddest[moddest_o1stretch], 1.f, 16.f));
return;
}
lfo1.set_freq(*params[par_lforate], crate);
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list