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 organ() -> Self {
Self {
name: "Organ".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::organ(),
filter: Filter::none(),
modulation: Vec::new(),
delay: None,
reverb: Some(Reverb::new(0.3, 0.4, 0.2)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn electric_piano() -> Self {
Self {
name: "Electric Piano".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::piano(),
filter: Filter::low_pass(4000.0, 0.2),
modulation: Vec::new(),
delay: Some(Delay::new(0.25, 0.2, 0.15)),
reverb: Some(Reverb::new(0.4, 0.5, 0.25)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn acoustic_piano() -> Self {
Self {
name: "Acoustic Piano".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.001, 0.3, 0.6, 0.8), filter: Filter::low_pass(8000.0, 0.15), modulation: Vec::new(),
delay: None,
reverb: Some(Reverb::new(0.25, 0.4, 0.2)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn harpsichord() -> Self {
Self {
name: "Harpsichord".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.001, 0.15, 0.3, 0.2), filter: Filter::low_pass(5000.0, 0.2), modulation: Vec::new(),
delay: None,
reverb: Some(Reverb::new(0.3, 0.4, 0.2)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn mallet() -> Self {
Self {
name: "Mallet".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::new(0.001, 0.4, 0.2, 0.6), filter: Filter::low_pass(6000.0, 0.15),
modulation: Vec::new(),
delay: Some(Delay::new(0.25, 0.2, 0.15)),
reverb: Some(Reverb::new(0.4, 0.5, 0.3)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn clavinet() -> Self {
Self {
name: "Clavinet".to_string(),
waveform: Waveform::Square,
envelope: Envelope::new(0.001, 0.08, 0.25, 0.1), filter: Filter::low_pass(4500.0, 0.55), modulation: Vec::new(),
delay: None,
reverb: Some(Reverb::new(0.15, 0.25, 0.1)), distortion: Some(Distortion::new(1.3, 0.2)), volume: 1.0,
pan: 0.0,
}
}
pub fn wurlitzer() -> Self {
let tremolo = LFO::new(Waveform::Sine, 4.5, 0.15); Self {
name: "Wurlitzer".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.005, 0.4, 0.5, 0.8), filter: Filter::low_pass(3200.0, 0.22), modulation: vec![ModRoute::new(tremolo, ModTarget::Volume, 0.12)],
delay: Some(Delay::new(0.3, 0.25, 0.18)),
reverb: Some(Reverb::new(0.35, 0.45, 0.25)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn toy_piano() -> Self {
Self {
name: "Toy Piano".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.001, 0.2, 0.05, 0.3), filter: Filter::low_pass(6000.0, 0.35), modulation: Vec::new(),
delay: Some(Delay::new(0.15, 0.2, 0.1)), reverb: Some(Reverb::new(0.2, 0.3, 0.15)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn hammond_organ() -> Self {
let rotary = LFO::new(Waveform::Sine, 6.5, 0.3); Self {
name: "Hammond Organ".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::organ(), filter: Filter::low_pass(5000.0, 0.2), modulation: vec![ModRoute::new(rotary, ModTarget::Volume, 0.18)],
delay: None,
reverb: Some(Reverb::new(0.35, 0.45, 0.3)),
distortion: Some(Distortion::new(1.2, 0.15)), volume: 1.0,
pan: 0.0,
}
}
pub fn church_organ() -> Self {
Self {
name: "Church Organ".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::organ(), filter: Filter::low_pass(6000.0, 0.15), modulation: Vec::new(),
delay: None,
reverb: Some(Reverb::new(0.85, 0.8, 0.7)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn reed_organ() -> Self {
let breath = LFO::new(Waveform::Sine, 3.5, 0.12); Self {
name: "Reed Organ".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.05, 0.1, 0.95, 0.3), filter: Filter::low_pass(3500.0, 0.25), modulation: vec![ModRoute::new(breath, ModTarget::Volume, 0.08)],
delay: None,
reverb: Some(Reverb::new(0.4, 0.5, 0.35)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn accordion() -> Self {
let bellows = LFO::new(Waveform::Sine, 4.0, 0.2); Self {
name: "Accordion".to_string(),
waveform: Waveform::Square,
envelope: Envelope::new(0.03, 0.1, 0.9, 0.25), filter: Filter::low_pass(4000.0, 0.3), modulation: vec![ModRoute::new(bellows, ModTarget::Volume, 0.12)],
delay: None,
reverb: Some(Reverb::new(0.3, 0.4, 0.25)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn cp70() -> Self {
Self {
name: "CP-70 Electric Grand".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.001, 0.45, 0.5, 0.85), filter: Filter::low_pass(5500.0, 0.25), modulation: Vec::new(),
delay: Some(Delay::new(0.2, 0.18, 0.12)),
reverb: Some(Reverb::new(0.32, 0.42, 0.25)),
distortion: Some(Distortion::new(1.1, 0.08)), volume: 1.0,
pan: 0.0,
}
}
pub fn pianet() -> Self {
Self {
name: "Pianet".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.001, 0.25, 0.25, 0.4), filter: Filter::low_pass(4500.0, 0.4), modulation: Vec::new(),
delay: Some(Delay::new(0.18, 0.2, 0.15)),
reverb: Some(Reverb::new(0.25, 0.35, 0.2)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn stage_73() -> Self {
let tremolo = LFO::new(Waveform::Sine, 5.0, 0.18); Self {
name: "Stage 73".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.003, 0.5, 0.5, 0.9), filter: Filter::low_pass(3800.0, 0.22), modulation: vec![ModRoute::new(tremolo, ModTarget::Volume, 0.15)],
delay: Some(Delay::new(0.25, 0.22, 0.18)),
reverb: Some(Reverb::new(0.38, 0.48, 0.28)),
distortion: Some(Distortion::new(1.15, 0.1)), volume: 1.0,
pan: 0.0,
}
}
pub fn mark_i_rhodes() -> Self {
let tremolo = LFO::new(Waveform::Sine, 4.8, 0.2); Self {
name: "Mark I Rhodes".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.004, 0.6, 0.55, 1.0), filter: Filter::low_pass(3200.0, 0.2), modulation: vec![ModRoute::new(tremolo, ModTarget::Volume, 0.18)],
delay: Some(Delay::new(0.28, 0.25, 0.2)),
reverb: Some(Reverb::new(0.42, 0.52, 0.32)),
distortion: Some(Distortion::new(1.2, 0.12)), volume: 1.0,
pan: 0.0,
}
}
pub fn honky_tonk_piano() -> Self {
let detune = LFO::new(Waveform::Sine, 0.6, 0.35); Self {
name: "Honky Tonk Piano".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.001, 0.35, 0.5, 0.75), filter: Filter::low_pass(5500.0, 0.3), modulation: vec![ModRoute::new(detune, ModTarget::FilterCutoff, 0.25)],
delay: None,
reverb: Some(Reverb::new(0.2, 0.3, 0.18)), distortion: Some(Distortion::new(1.25, 0.15)), volume: 1.0,
pan: 0.0,
}
}
}