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 acoustic_guitar() -> Self {
Self {
name: "Acoustic Guitar".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.002, 0.4, 0.3, 0.6), filter: Filter::low_pass(4500.0, 0.28), modulation: Vec::new(),
delay: None,
reverb: Some(Reverb::new(0.25, 0.35, 0.2)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn electric_guitar_clean() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.0, 0.2); Self {
name: "Electric Guitar (Clean)".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.005, 0.3, 0.5, 0.7), filter: Filter::low_pass(5000.0, 0.32), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.08)],
delay: Some(Delay::new(0.35, 0.25, 0.2)),
reverb: Some(Reverb::new(0.35, 0.45, 0.28)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn electric_guitar_distorted() -> Self {
Self {
name: "Electric Guitar (Distorted)".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.008, 0.25, 0.6, 0.5), filter: Filter::low_pass(4000.0, 0.55), modulation: Vec::new(),
delay: Some(Delay::new(0.3, 0.3, 0.25)),
reverb: Some(Reverb::new(0.3, 0.4, 0.25)),
distortion: Some(Distortion::new(3.5, 0.65)), volume: 1.0,
pan: 0.0,
}
}
pub fn guitar_12_string() -> Self {
let chorus = LFO::new(Waveform::Sine, 0.8, 0.5); Self {
name: "12-String Guitar".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.002, 0.45, 0.35, 0.7), filter: Filter::low_pass(5500.0, 0.3), modulation: vec![ModRoute::new(chorus, ModTarget::FilterCutoff, 0.15)],
delay: Some(Delay::new(0.25, 0.28, 0.22)),
reverb: Some(Reverb::new(0.4, 0.48, 0.32)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn guitar_palm_muted() -> Self {
Self {
name: "Palm Muted Guitar".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.001, 0.05, 0.15, 0.08), filter: Filter::low_pass(1200.0, 0.55), modulation: Vec::new(),
delay: None,
reverb: Some(Reverb::new(0.15, 0.25, 0.12)), distortion: Some(Distortion::new(3.0, 0.65)), volume: 1.0,
pan: 0.0,
}
}
pub fn guitar_harmonics() -> Self {
let shimmer = LFO::new(Waveform::Sine, 0.3, 0.2); Self {
name: "Guitar Harmonics".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::new(0.001, 0.5, 0.2, 0.8), filter: Filter::low_pass(7000.0, 0.2), modulation: vec![ModRoute::new(shimmer, ModTarget::FilterCutoff, 0.15)],
delay: Some(Delay::new(0.4, 0.3, 0.25)),
reverb: Some(Reverb::new(0.6, 0.65, 0.45)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
}