Compare commits
No commits in common. "59b3b9c8222d3b14f39718c14f03be3fb7c03dc1" and "ca16d2e27ed7028a81a87abcd0c4496ae31ad41d" have entirely different histories.
59b3b9c822
...
ca16d2e27e
18
README.md
18
README.md
|
@ -63,7 +63,6 @@ the following is the current list of plugins
|
|||
- `threebandfolding`: 3 band wave folding distortion
|
||||
- `double_reverse_delta_inverter`: idk, a weird distortion
|
||||
- `transmute_pitch`: pitch to midi converter
|
||||
- `reverter`: play sound backwards
|
||||
|
||||
there's a bit of an explanation of each of the plugins below, but it's not a thorough documentation or a manual, it's just a bunch of notes i've written and a short description of the parameters
|
||||
|
||||
|
@ -253,17 +252,6 @@ aside from that, it works well enough on my quick tests
|
|||
|
||||
you can use it to play synths using other instruments, like a guitar, or by whistling! it's quite fun
|
||||
|
||||
### reverter
|
||||
|
||||
records small grains of audio and plays them backwards
|
||||
|
||||
params:
|
||||
- `length`: length of the grains
|
||||
|
||||
this plugin will introduce a delay of `length` samples, since it has to record that many samples before being able to play them backwards
|
||||
|
||||
in my experience values between 5000 and 8000 tend to work well, but you might want to experiment a bit to see what works for you
|
||||
|
||||
## 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. if you are fine with that, ig go ahead i'm not your mum
|
||||
|
@ -273,9 +261,3 @@ issues and prs are welcome, but please open an issue before making any big pr, i
|
|||
gpl3 or something, i need to check which one to use and the add the correct file
|
||||
|
||||
consider it gpl3 for now
|
||||
|
||||
## naming
|
||||
|
||||
uhhhh yeah cause the plugins are universal or something, but uni is spelled like annie. also sounds like 언니, which is fun
|
||||
|
||||
the plugins are named very lazily, it's just whatever name i could come up with before creating the crate, so yeah many are not good
|
||||
|
|
|
@ -9,5 +9,3 @@ crate-type = ["cdylib"]
|
|||
[dependencies]
|
||||
baseplug = { git = "https://github.com/wrl/baseplug.git", rev = "9cec68f31cca9c0c7a1448379f75d92bbbc782a8" }
|
||||
serde = "1.0.126"
|
||||
|
||||
# utils = { path = "../utils" }
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
[package]
|
||||
name = "reverter"
|
||||
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" }
|
|
@ -1,77 +0,0 @@
|
|||
#![allow(incomplete_features)]
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
use baseplug::{Plugin, ProcessContext};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use utils::buffers::*;
|
||||
|
||||
// If you change this remember to change the max on the model
|
||||
const LEN: usize = 48000;
|
||||
|
||||
baseplug::model! {
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct ReverterModel {
|
||||
#[model(min = 10.0, max = 48000.0)]
|
||||
#[parameter(name = "length")]
|
||||
length: f32,
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ReverterModel {
|
||||
fn default() -> Self {
|
||||
Self { length: 1.0 }
|
||||
}
|
||||
}
|
||||
|
||||
struct Reverter {
|
||||
recording: Buffers<LEN>,
|
||||
playing: Buffers<LEN>,
|
||||
}
|
||||
|
||||
impl Plugin for Reverter {
|
||||
const NAME: &'static str = "reverter";
|
||||
const PRODUCT: &'static str = "reverter";
|
||||
const VENDOR: &'static str = "unnieversal";
|
||||
|
||||
const INPUT_CHANNELS: usize = 2;
|
||||
const OUTPUT_CHANNELS: usize = 2;
|
||||
|
||||
type Model = ReverterModel;
|
||||
|
||||
#[inline]
|
||||
fn new(_sample_rate: f32, _model: &ReverterModel) -> Self {
|
||||
Self {
|
||||
recording: Buffers::<LEN>::new(),
|
||||
playing: Buffers::<LEN>::new(),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn process(&mut self, model: &ReverterModelProcess, ctx: &mut ProcessContext<Self>) {
|
||||
let input = &ctx.inputs[0].buffers;
|
||||
let output = &mut ctx.outputs[0].buffers;
|
||||
|
||||
for i in 0..ctx.nframes {
|
||||
let len = model.length[i].floor() as usize;
|
||||
|
||||
// add to recording buffer
|
||||
let finished = self.recording.write_advance(input[0][i], input[1][i]);
|
||||
|
||||
// we read from the playing buffer at the inverse of the recording buffer
|
||||
// this ensures the two don't go out of sync
|
||||
let (l, r) = self.playing.read_at(len - self.recording.idx);
|
||||
|
||||
// if we're done, swap the two buffers and reset the index
|
||||
if finished || self.recording.idx >= len {
|
||||
self.recording.reset();
|
||||
std::mem::swap(&mut self.recording, &mut self.playing);
|
||||
}
|
||||
|
||||
output[0][i] = l;
|
||||
output[1][i] = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
baseplug::vst2!(Reverter, b"reve");
|
|
@ -140,7 +140,7 @@ impl Plugin for Sosten {
|
|||
let idx = self.buffers.idx.min(len - 1);
|
||||
|
||||
// Play from Buffer
|
||||
let (l, r) = self.buffers.read_at((LEN - len) + idx);
|
||||
let (l, r) = self.buffers.read((LEN - len) + idx);
|
||||
|
||||
output[0][i] = l;
|
||||
output[1][i] = r;
|
||||
|
|
|
@ -47,12 +47,7 @@ impl<const LEN: usize> Buffers<LEN> {
|
|||
})
|
||||
}
|
||||
|
||||
/// Reads buffer, advances idx, returns true if buffer is full
|
||||
pub fn read(&self) -> (f32, f32) {
|
||||
(self.l[self.idx], self.r[self.idx])
|
||||
}
|
||||
|
||||
pub fn read_at(&self, idx: usize) -> (f32, f32) {
|
||||
pub fn read(&self, idx: usize) -> (f32, f32) {
|
||||
let idx = idx % LEN;
|
||||
(self.l[idx], self.r[idx])
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue