use super::Instrument;
use crate::synthesis::effects::{Delay, Distortion, Reverb};
use crate::synthesis::envelope::Envelope;
use crate::synthesis::filter::Filter;
use crate::synthesis::lfo::{LFO, ModRoute, ModTarget};
use crate::synthesis::waveform::Waveform;
impl Instrument {
pub fn supersaw() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.0, 0.35);
Self {
name: "Supersaw".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.02, 0.25, 0.75, 0.4),
filter: Filter::low_pass(6000.0, 0.5), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.25)],
delay: Some(Delay::new(0.375, 0.25, 0.2)),
reverb: Some(Reverb::new(0.5, 0.5, 0.35)),
distortion: Some(Distortion::new(1.2, 0.15)), volume: 1.0,
pan: 0.0,
}
}
pub fn fm_bells() -> Self {
Self {
name: "FM Bells".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::new(0.001, 1.0, 0.3, 1.2), filter: Filter::low_pass(8000.0, 0.2), modulation: Vec::new(),
delay: Some(Delay::new(0.5, 0.4, 0.3)),
reverb: Some(Reverb::new(0.7, 0.6, 0.5)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn hoover() -> Self {
let sweep = LFO::new(Waveform::Sine, 0.8, 0.9); Self {
name: "Hoover".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.01, 0.2, 0.8, 0.3),
filter: Filter::low_pass(1200.0, 0.8), modulation: vec![ModRoute::new(sweep, ModTarget::FilterCutoff, 0.7)],
delay: Some(Delay::new(0.25, 0.3, 0.2)),
reverb: Some(Reverb::new(0.4, 0.5, 0.3)),
distortion: Some(Distortion::new(2.0, 0.4)), volume: 1.0,
pan: 0.0,
}
}
pub fn stab() -> Self {
Self {
name: "Stab".to_string(),
waveform: Waveform::Square,
envelope: Envelope::new(0.001, 0.08, 0.2, 0.15), filter: Filter::low_pass(3000.0, 0.6),
modulation: Vec::new(),
delay: Some(Delay::new(0.375, 0.3, 0.25)),
reverb: Some(Reverb::new(0.3, 0.4, 0.25)),
distortion: Some(Distortion::new(2.2, 0.5)), volume: 1.0,
pan: 0.0,
}
}
pub fn chiptune() -> Self {
Self {
name: "Chiptune".to_string(),
waveform: Waveform::Square,
envelope: Envelope::new(0.001, 0.03, 0.5, 0.05), filter: Filter::low_pass(4000.0, 0.2),
modulation: Vec::new(),
delay: None,
reverb: None, distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn acid_synth() -> Self {
let acid_sweep = LFO::new(Waveform::Sine, 0.7, 0.8); Self {
name: "Acid Synth".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.001, 0.25, 0.3, 0.15), filter: Filter::low_pass(700.0, 0.75), modulation: vec![ModRoute::new(acid_sweep, ModTarget::FilterCutoff, 0.7)],
delay: None,
reverb: Some(Reverb::new(0.2, 0.3, 0.15)), distortion: Some(Distortion::new(2.5, 0.4)), volume: 1.0,
pan: 0.0,
}
}
pub fn trance_synth() -> Self {
let trance_lfo = LFO::new(Waveform::Sine, 0.3, 0.6); let vibrato = LFO::new(Waveform::Sine, 5.5, 0.25);
Self {
name: "Trance Synth".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.05, 0.3, 0.8, 0.5), filter: Filter::low_pass(5500.0, 0.45), modulation: vec![
ModRoute::new(trance_lfo, ModTarget::FilterCutoff, 0.3),
ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.15),
],
delay: Some(Delay::new(0.375, 0.3, 0.25)),
reverb: Some(Reverb::new(0.6, 0.6, 0.45)), distortion: Some(Distortion::new(1.3, 0.2)),
volume: 1.0,
pan: 0.0,
}
}
pub fn analog_brass() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.8, 0.3);
Self {
name: "Analog Brass".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.08, 0.2, 0.8, 0.4), filter: Filter::low_pass(3500.0, 0.42), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.12)],
delay: None,
reverb: Some(Reverb::new(0.35, 0.45, 0.3)),
distortion: Some(Distortion::new(1.4, 0.25)), volume: 1.0,
pan: 0.0,
}
}
pub fn fm_bass() -> Self {
let fm_sweep = LFO::new(Waveform::Sine, 0.6, 0.5); Self {
name: "FM Bass".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::new(0.001, 0.25, 0.5, 0.35), filter: Filter::low_pass(1500.0, 0.6), modulation: vec![ModRoute::new(fm_sweep, ModTarget::FilterCutoff, 0.35)],
delay: None,
reverb: Some(Reverb::new(0.25, 0.35, 0.2)),
distortion: Some(Distortion::new(2.0, 0.4)), volume: 1.0,
pan: 0.0,
}
}
pub fn pwm_bass() -> Self {
let pwm_lfo = LFO::new(Waveform::Sine, 0.5, 0.7); Self {
name: "PWM Bass".to_string(),
waveform: Waveform::Square,
envelope: Envelope::new(0.01, 0.2, 0.75, 0.4), filter: Filter::low_pass(700.0, 0.5), modulation: vec![ModRoute::new(pwm_lfo, ModTarget::FilterCutoff, 0.3)],
delay: None,
reverb: None,
distortion: Some(Distortion::new(1.5, 0.3)), volume: 1.0,
pan: 0.0,
}
}
pub fn pluck_bass() -> Self {
Self {
name: "Pluck Bass".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.001, 0.08, 0.15, 0.12), filter: Filter::low_pass(800.0, 0.45), modulation: Vec::new(),
delay: None,
reverb: Some(Reverb::new(0.2, 0.3, 0.15)),
distortion: Some(Distortion::new(1.6, 0.3)), volume: 1.0,
pan: 0.0,
}
}
pub fn juno_pad() -> Self {
let chorus_lfo = LFO::new(Waveform::Sine, 0.4, 0.5); Self {
name: "Juno Pad".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.3, 0.4, 0.9, 0.8), filter: Filter::low_pass(3000.0, 0.35), modulation: vec![ModRoute::new(chorus_lfo, ModTarget::FilterCutoff, 0.2)],
delay: None,
reverb: Some(Reverb::new(0.6, 0.65, 0.5)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn dx7_electric_piano() -> Self {
let metallic = LFO::new(Waveform::Sine, 4.0, 0.2); Self {
name: "DX7 Electric Piano".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::new(0.001, 0.5, 0.4, 0.9), filter: Filter::low_pass(6000.0, 0.3), modulation: vec![ModRoute::new(metallic, ModTarget::FilterCutoff, 0.15)],
delay: None,
reverb: Some(Reverb::new(0.35, 0.45, 0.28)),
distortion: Some(Distortion::new(1.2, 0.15)), volume: 1.0,
pan: 0.0,
}
}
pub fn prophet_brass() -> Self {
let pwm = LFO::new(Waveform::Sine, 0.6, 0.6); Self {
name: "Prophet Brass".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.02, 0.2, 0.85, 0.35), filter: Filter::low_pass(4200.0, 0.55), modulation: vec![ModRoute::new(pwm, ModTarget::FilterCutoff, 0.25)],
delay: None,
reverb: Some(Reverb::new(0.3, 0.4, 0.25)),
distortion: Some(Distortion::new(1.5, 0.25)), volume: 1.0,
pan: 0.0,
}
}
pub fn minimoog_bass() -> Self {
let filter_sweep = LFO::new(Waveform::Sine, 0.3, 0.4); Self {
name: "Minimoog Bass".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.001, 0.15, 0.8, 0.3), filter: Filter::low_pass(600.0, 0.7), modulation: vec![ModRoute::new(filter_sweep, ModTarget::FilterCutoff, 0.3)],
delay: None,
reverb: None, distortion: Some(Distortion::new(2.0, 0.35)), volume: 1.0,
pan: 0.0,
}
}
pub fn obx_strings() -> Self {
let detune_lfo = LFO::new(Waveform::Sine, 0.5, 0.45); Self {
name: "OB-X Strings".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.25, 0.35, 0.88, 0.7), filter: Filter::low_pass(3500.0, 0.32), modulation: vec![ModRoute::new(detune_lfo, ModTarget::FilterCutoff, 0.18)],
delay: None,
reverb: Some(Reverb::new(0.65, 0.7, 0.52)), distortion: Some(Distortion::new(1.15, 0.12)), volume: 1.0,
pan: 0.0,
}
}
pub fn sh101_lead() -> Self {
let resonant_sweep = LFO::new(Waveform::Sine, 0.8, 0.7); Self {
name: "SH-101 Lead".to_string(),
waveform: Waveform::Square,
envelope: Envelope::new(0.001, 0.2, 0.6, 0.25), filter: Filter::low_pass(1800.0, 0.72), modulation: vec![ModRoute::new(resonant_sweep, ModTarget::FilterCutoff, 0.5)],
delay: Some(Delay::new(0.25, 0.3, 0.2)),
reverb: Some(Reverb::new(0.25, 0.35, 0.2)),
distortion: Some(Distortion::new(2.2, 0.4)), volume: 1.0,
pan: 0.0,
}
}
}