Skip to content

Commit

Permalink
0.5.19
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-bouffier committed Jan 28, 2018
1 parent d0bbbf8 commit ed2fc51
Show file tree
Hide file tree
Showing 16 changed files with 1,961 additions and 129 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
SLUG = Bidoo
VERSION = 0.5.18
VERSION = 0.5.19

FLAGS = -I./pffft -DPFFFT_SIMD_DISABLE

SOURCES = $(wildcard src/*.cpp src/dep/audiofile/*cpp src/dep/pffft/*c)
SOURCES = $(wildcard src/*.cpp src/dep/audiofile/*cpp src/dep/pffft/*c src/dep/filters/*cpp)

DISTRIBUTABLES += $(wildcard LICENSE*) res

Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Bidoo's plugins for [VCVRack](https://vcvrack.com)

<!-- Version and License Badges -->
![Version](https://img.shields.io/badge/version-0.5.18-green.svg?style=flat-square)
![Version](https://img.shields.io/badge/version-0.5.19-green.svg?style=flat-square)
![License](https://img.shields.io/badge/license-BSD3-blue.svg?style=flat-square)
![Language](https://img.shields.io/badge/language-C++-yellow.svg?style=flat-square)

Expand All @@ -13,11 +13,16 @@ You can find information on that plugins pack in the [wiki](https://github.com/s

## Last changes

0.5.18
0.5.19

lIMbO
lIMbO the 4th order ladder filter has a second mode i.e. "non linear". In that mode the GAIN control is no more a gain on the output but a gain on the tanh() that introduces non linearity.

pErCO is a step in my journey across filters. To achieve the next plugin I needed a BP filter so I tried this approach. The result is a very simple 1st order LP, BP, HP filter.

ziNC is the plugin I wanted to do with filters. It is a 16 band vocoder. I started this plugin with pErCO's BP but I needed more selective filters so I finally used 4 poles BP.
If you are interested in filter design and more generally in dsp I recommend that website http://www.earlevel.com.
Controls are gains for the 16 bands. Attack and Decay for the envelop follower and gain stages for MODulator, CARRier and OUTput.

lIMbO is a ladder LPF. Based on Will Pirkle's courses & Vadim Zavalishin's book.

## License

Expand Down
Binary file modified images/pack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
220 changes: 138 additions & 82 deletions res/LIMBO.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 72 additions & 30 deletions res/LIMBOtemp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
339 changes: 339 additions & 0 deletions res/PERCO.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
331 changes: 331 additions & 0 deletions res/PERCOtemp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
266 changes: 266 additions & 0 deletions res/ZINC.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
272 changes: 272 additions & 0 deletions res/ZINCtemp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/Bidoo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ void init(rack::Plugin *p) {
p->addModel(createModel<CLACOSWidget>("Bidoo", "clACos", "clACos oscillator", OSCILLATOR_TAG));
p->addModel(createModel<BARWidget>("Bidoo", "baR", "bAR compressor", DYNAMICS_TAG));
p->addModel(createModel<LIMBOWidget>("Bidoo", "lIMbO", "lIMbO filter", FILTER_TAG));
p->addModel(createModel<PERCOWidget>("Bidoo", "pErCO", "pErCO filter", FILTER_TAG));
p->addModel(createModel<ZINCWidget>("Bidoo", "ziNC", "ziNC vocoder", EFFECT_TAG));
}
8 changes: 8 additions & 0 deletions src/Bidoo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,11 @@ struct BARWidget : ModuleWidget {
struct LIMBOWidget : ModuleWidget {
LIMBOWidget();
};

struct PERCOWidget : ModuleWidget {
PERCOWidget();
};

struct ZINCWidget : ModuleWidget {
ZINCWidget();
};
33 changes: 22 additions & 11 deletions src/LIMBO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ struct FilterStage
{
float mem = 0.0;

float Filter(float sample, float freq, float smpRate)
float Filter(float sample, float freq, float smpRate, float gain, int mode)
{
float g = tan(pi*freq/smpRate);
float G = g/(1.0 + g);
float out = (sample - mem) * G + mem;
float out;
if (mode == 0) {
out = (sample - mem) * G + mem;
} else {
out = (tanh(sample*gain)/tanh(gain) - mem) * G + mem;
}
mem = out + (sample - mem) * G ;
return out;
}
Expand All @@ -31,11 +36,15 @@ struct LadderFilter
float q;
float freq;
float smpRate;
int mode = 0;
float gain = 1;

void setParams(float freq, float q, float smpRate) {
void setParams(float freq, float q, float smpRate, float gain, int mode) {
this->freq = freq;
this->q=q;
this->smpRate=smpRate;
this->mode = mode;
this->gain = gain;
}

float calcOutput(float sample)
Expand All @@ -48,7 +57,7 @@ struct LadderFilter
float S3 = stage3.mem/(1 + g);
float S4 = stage4.mem/(1 + g);
float S = G*G*G*S1 + G*G*S2 + G*S3 + S4;
return stage4.Filter(stage3.Filter(stage2.Filter(stage1.Filter((sample - q*S)/(1 + q*G),freq,smpRate),freq,smpRate),freq,smpRate),freq,smpRate);
return stage4.Filter(stage3.Filter(stage2.Filter(stage1.Filter((sample - q*S)/(1 + q*G),freq,smpRate,gain,mode),freq,smpRate,gain,mode),freq,smpRate,gain,mode),freq,smpRate,gain,mode);
}

};
Expand All @@ -59,6 +68,7 @@ struct LIMBO : Module {
Q_PARAM,
CMOD_PARAM,
MUG_PARAM,
MODE_PARAM,
NUM_PARAMS
};
enum InputIds {
Expand Down Expand Up @@ -90,14 +100,14 @@ struct LIMBO : Module {
void LIMBO::step() {
float cfreq = pow(2,rescalef(clampf(params[CUTOFF_PARAM].value + params[CMOD_PARAM].value * inputs[CUTOFF_INPUT].value / 5,0,1),0,1,4.5,13));
float q = 3.5 * clampf(params[Q_PARAM].value + inputs[Q_INPUT].value / 5.0, 0.0, 1.0);
lFilter.setParams(cfreq,q,engineGetSampleRate());
rFilter.setParams(cfreq,q,engineGetSampleRate());
float g = pow(2,rescalef(clampf(params[MUG_PARAM].value + inputs[MUG_INPUT].value / 5,0,1),0,1,0,3));
int mode = (int)params[MODE_PARAM].value;
lFilter.setParams(cfreq,q,engineGetSampleRate(),g/3,mode);
rFilter.setParams(cfreq,q,engineGetSampleRate(),g/3,mode);
float inL = inputs[IN_L].value/5; //normalise to -1/+1 we consider VCV Rack standard is #+5/-5V on VCO1
float inR = inputs[IN_R].value/5;
//filtering + makeup gain
float g = clampf(params[MUG_PARAM].value + inputs[MUG_INPUT].value,1,10);
inL = lFilter.calcOutput(inL)*5*g;
inR = rFilter.calcOutput(inR)*5*g;
inL = lFilter.calcOutput(inL)*5*(mode == 0 ? g : 1);
inR = rFilter.calcOutput(inR)*5*(mode == 0 ? g : 1);
outputs[OUT_L].value = inL;
outputs[OUT_R].value = inR;
}
Expand Down Expand Up @@ -134,8 +144,9 @@ LIMBOWidget::LIMBOWidget() {

addParam(createParam<BidooHugeBlueKnob>(Vec(33, 61), module, LIMBO::CUTOFF_PARAM, 0, 1, 1));
addParam(createParam<BidooLargeBlueKnob>(Vec(12, 143), module, LIMBO::Q_PARAM, 0, 1, 0));
addParam(createParam<BidooLargeBlueKnob>(Vec(71, 143), module, LIMBO::MUG_PARAM, 1, 10, 1));
addParam(createParam<BidooLargeBlueKnob>(Vec(71, 143), module, LIMBO::MUG_PARAM, 0, 1, 0));
addParam(createParam<BidooLargeBlueKnob>(Vec(12, 208), module, LIMBO::CMOD_PARAM, -1, 1, 0));
addParam(createParam<CKSS>(Vec(83, 217), module, LIMBO::MODE_PARAM, 0.0, 1.0, 0.0));

addInput(createInput<PJ301MPort>(Vec(12, 280), module, LIMBO::CUTOFF_INPUT));
addInput(createInput<PJ301MPort>(Vec(47, 280), module, LIMBO::Q_INPUT));
Expand Down
128 changes: 128 additions & 0 deletions src/PERCO.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// Based on Will Pirkle's courses & Vadim Zavalishin's book

#include "Bidoo.hpp"
#include "BidooComponents.hpp"
#include "dsp/decimator.hpp"

using namespace std;

#define pi 3.14159265359


struct MultiFilter
{
float q;
float freq;
float smpRate;
float hp = 0,bp = 0,lp = 0,mem1 = 0,mem2 = 0;

void setParams(float freq, float q, float smpRate) {
this->freq = freq;
this->q=q;
this->smpRate=smpRate;
}

void calcOutput(float sample)
{
float g = tan(pi*freq/smpRate);
float R = 1.0/(2.0*q);
hp = (sample - (2.0*R + g)*mem1 - mem2)/(1.0 + 2.0*R*g + g*g);
bp = g*hp + mem1;
lp = g*bp + mem2;
mem1 = g*hp + bp;
mem2 = g*bp + lp;
}

};

struct PERCO : Module {
enum ParamIds {
CUTOFF_PARAM,
Q_PARAM,
CMOD_PARAM,
NUM_PARAMS
};
enum InputIds {
IN,
CUTOFF_INPUT,
Q_INPUT,
NUM_INPUTS
};
enum OutputIds {
OUT_LP,
OUT_BP,
OUT_HP,
NUM_OUTPUTS
};
enum LightIds {
LEARN_LIGHT,
NUM_LIGHTS
};
MultiFilter filter;

PERCO() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
}

void step() override;

};

void PERCO::step() {
float cfreq = pow(2,rescalef(clampf(params[CUTOFF_PARAM].value + params[CMOD_PARAM].value * inputs[CUTOFF_INPUT].value / 5,0,1),0,1,4.5,13));
float q = 10 * clampf(params[Q_PARAM].value + inputs[Q_INPUT].value / 5.0, 0.1, 1.0);
filter.setParams(cfreq,q,engineGetSampleRate());
float in = inputs[IN].value/5; //normalise to -1/+1 we consider VCV Rack standard is #+5/-5V on VCO1
//filtering
filter.calcOutput(in);
outputs[OUT_LP].value = filter.lp * 5;
outputs[OUT_HP].value = filter.hp * 5;
outputs[OUT_BP].value = filter.bp * 5;
}

struct PERCODisplay : TransparentWidget {
PERCO *module;
std::shared_ptr<Font> font;
PERCODisplay() {
font = Font::load(assetPlugin(plugin, "res/DejaVuSansMono.ttf"));
}

void draw(NVGcontext *vg) override {

}
};

PERCOWidget::PERCOWidget() {
PERCO *module = new PERCO();
setModule(module);
box.size = Vec(15*8, 380);

{
SVGPanel *panel = new SVGPanel();
panel->box.size = box.size;
panel->setBackground(SVG::load(assetPlugin(plugin, "res/PERCO.svg")));
addChild(panel);
}

PERCODisplay *display = new PERCODisplay();
display->module = module;
display->box.pos = Vec(5, 40);
display->box.size = Vec(110, 70);
addChild(display);

addParam(createParam<BidooHugeBlueKnob>(Vec(33, 61), module, PERCO::CUTOFF_PARAM, 0, 1, 1));
addParam(createParam<BidooLargeBlueKnob>(Vec(12, 143), module, PERCO::Q_PARAM, 0.1, 1, 0.1));
addParam(createParam<BidooLargeBlueKnob>(Vec(71, 143), module, PERCO::CMOD_PARAM, -1, 1, 0));

addInput(createInput<PJ301MPort>(Vec(10, 276), module, PERCO::IN));
addInput(createInput<PJ301MPort>(Vec(48, 276), module, PERCO::CUTOFF_INPUT));
addInput(createInput<PJ301MPort>(Vec(85, 276), module, PERCO::Q_INPUT));

addOutput(createOutput<PJ301MPort>(Vec(10, 320), module, PERCO::OUT_LP));
addOutput(createOutput<PJ301MPort>(Vec(48, 320), module, PERCO::OUT_BP));
addOutput(createOutput<PJ301MPort>(Vec(85, 320), module, PERCO::OUT_HP));

addChild(createScrew<ScrewSilver>(Vec(15, 0)));
addChild(createScrew<ScrewSilver>(Vec(box.size.x-30, 0)));
addChild(createScrew<ScrewSilver>(Vec(15, 365)));
addChild(createScrew<ScrewSilver>(Vec(box.size.x-30, 365)));
}
Loading

0 comments on commit ed2fc51

Please sign in to comment.