Compare commits

..

No commits in common. "fdbb43895fc0c51663f45bfb37d5fa2725f12a83" and "0f56d9a9c88b7b3bc103315a001e86dbda60c6fc" have entirely different histories.

5 changed files with 8 additions and 135 deletions

View File

@ -57,7 +57,6 @@ the following is the current list of plugins
- threebandeq: 3 band eq - threebandeq: 3 band eq
- threebandwidth: 3 band stereo widener - threebandwidth: 3 band stereo widener
- tritu: say-goodbye-to-your-audio distortion - tritu: say-goodbye-to-your-audio distortion
- threebandfolding: 3 band wave folding distortion
### basic_gain ### basic_gain
@ -174,19 +173,6 @@ distortion affects lower volumes more than higher volumes, so if you crank up `d
i like this plugin a lot i like this plugin a lot
### threebandfolding
three band wavefolding distortion
parameters:
- `low band`: frequency at which the low band ends
- `high band`: frequency at which the high band starts
- `low folding freq`: folding frequency for the low band
- `mid folding freq`: folding frequency for the mid band
- `high folding freq`: folding frequency for the high band
bands work as they do in `threebandeq`. the `folding freq` parameters control the frequency of the wavefolding. higher is more distortion. use values over 40 if you want to hear white noise
## contributing ## contributing
issues and prs are welcome, but please open an issue before making any big pr, i don't wanna have to reject a pr where you have put a lot of effort on issues and prs are welcome, but please open an issue before making any big pr, i don't wanna have to reject a pr where you have put a lot of effort on

View File

@ -30,9 +30,9 @@ impl Default for QuinoaModel {
struct Quinoa; struct Quinoa;
impl Plugin for Quinoa { impl Plugin for Quinoa {
const NAME: &'static str = "quinoa"; const NAME: &'static str = "basic gain plug";
const PRODUCT: &'static str = "quinoa"; const PRODUCT: &'static str = "basic gain plug";
const VENDOR: &'static str = "unnieversal"; const VENDOR: &'static str = "spicy plugins & co";
const INPUT_CHANNELS: usize = 2; const INPUT_CHANNELS: usize = 2;
const OUTPUT_CHANNELS: usize = 2; const OUTPUT_CHANNELS: usize = 2;

View File

@ -1,13 +0,0 @@
[package]
name = "threebandfolding"
version = "0.1.0"
edition = "2018"
[lib]
crate-type = ["cdylib"]
[dependencies]
baseplug = { git = "https://github.com/wrl/baseplug.git", rev = "9cec68f31cca9c0c7a1448379f75d92bbbc782a8" }
serde = "1.0.126"
utils = { path = "../utils" }

View File

@ -1,100 +0,0 @@
#![allow(incomplete_features)]
#![feature(generic_associated_types)]
use baseplug::{Plugin, ProcessContext};
use serde::{Deserialize, Serialize};
use utils::threeband::*;
baseplug::model! {
#[derive(Debug, Serialize, Deserialize)]
struct ThreeBandFoldingModel {
#[model(min = 0.0, max = 15000.0)]
#[parameter(name = "low band")]
low_band: f32,
#[model(min = 0.0, max = 15000.0)]
#[parameter(name = "mid band")]
high_band: f32,
#[model(min = 0.0, max = 100.0)]
#[parameter(name = "low folding freq", gradient = "Power(3.0)")]
low_freq: f32,
#[model(min = 0.0, max = 100.0)]
#[parameter(name = "mid folding freq", gradient = "Power(3.0)")]
mid_freq: f32,
#[model(min = 0.0, max = 100.0)]
#[parameter(name = "high folding freq", gradient = "Power(3.0)")]
high_freq: f32,
}
}
impl Default for ThreeBandFoldingModel {
fn default() -> Self {
Self {
low_band: 800.0,
high_band: 5000.0,
low_freq: 1.0,
mid_freq: 1.0,
high_freq: 1.0,
}
}
}
#[derive(Default)]
struct ThreeBandFolding {
l: ThreeBandSplitter,
r: ThreeBandSplitter,
}
impl Plugin for ThreeBandFolding {
const NAME: &'static str = "threebandfolding";
const PRODUCT: &'static str = "threebandfolding";
const VENDOR: &'static str = "unnieversal";
const INPUT_CHANNELS: usize = 2;
const OUTPUT_CHANNELS: usize = 2;
type Model = ThreeBandFoldingModel;
#[inline]
fn new(_sample_rate: f32, _model: &ThreeBandFoldingModel) -> Self {
// Default cause we want to start with 0s in everything
Self::default()
}
#[inline]
fn process(&mut self, model: &ThreeBandFoldingModelProcess, ctx: &mut ProcessContext<Self>) {
let input = &ctx.inputs[0].buffers;
let output = &mut ctx.outputs[0].buffers;
let sr = ctx.sample_rate;
for i in 0..ctx.nframes {
// frequencies
let lf = model.low_band[i];
let hf = model.high_band[i];
// split into bands
let (low_l, mid_l, high_l) = self.l.process(input[0][i], lf, hf, sr);
let (low_r, mid_r, high_r) = self.r.process(input[1][i], lf, hf, sr);
// widen each band
let (low_l, low_r) = fold(model.low_freq[i], low_l, low_r);
let (mid_l, mid_r) = fold(model.mid_freq[i], mid_l, mid_r);
let (high_l, high_r) = fold(model.high_freq[i], high_l, high_r);
output[0][i] = low_l + mid_l + high_l;
output[1][i] = low_r + mid_r + high_r;
}
}
}
fn fold(freq: f32, l: f32, r: f32) -> (f32, f32) {
let l = (l * freq).sin();
let r = (r * freq).sin();
(l, r)
}
baseplug::vst2!(ThreeBandFolding, b"3bsf");

View File

@ -8,7 +8,7 @@ use utils::threeband::*;
baseplug::model! { baseplug::model! {
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
struct ThreeBandWidthModel { struct ThreeBandEqModel {
#[model(min = 0.0, max = 15000.0)] #[model(min = 0.0, max = 15000.0)]
#[parameter(name = "low band")] #[parameter(name = "low band")]
low_band: f32, low_band: f32,
@ -28,7 +28,7 @@ baseplug::model! {
} }
} }
impl Default for ThreeBandWidthModel { impl Default for ThreeBandEqModel {
fn default() -> Self { fn default() -> Self {
Self { Self {
low_band: 800.0, low_band: 800.0,
@ -55,16 +55,16 @@ impl Plugin for ThreeBandWidth {
const INPUT_CHANNELS: usize = 2; const INPUT_CHANNELS: usize = 2;
const OUTPUT_CHANNELS: usize = 2; const OUTPUT_CHANNELS: usize = 2;
type Model = ThreeBandWidthModel; type Model = ThreeBandEqModel;
#[inline] #[inline]
fn new(_sample_rate: f32, _model: &ThreeBandWidthModel) -> Self { fn new(_sample_rate: f32, _model: &ThreeBandEqModel) -> Self {
// Default cause we want to start with 0s in everything // Default cause we want to start with 0s in everything
Self::default() Self::default()
} }
#[inline] #[inline]
fn process(&mut self, model: &ThreeBandWidthModelProcess, ctx: &mut ProcessContext<Self>) { fn process(&mut self, model: &ThreeBandEqModelProcess, ctx: &mut ProcessContext<Self>) {
let input = &ctx.inputs[0].buffers; let input = &ctx.inputs[0].buffers;
let output = &mut ctx.outputs[0].buffers; let output = &mut ctx.outputs[0].buffers;