use super::Instrument;
use crate::synthesis::effects::{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 strings() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.5, 0.3); Self {
name: "Strings".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.15, 0.3, 0.85, 0.6), filter: Filter::low_pass(4000.0, 0.25), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.15)],
delay: None,
reverb: Some(Reverb::new(0.6, 0.6, 0.45)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn brass() -> Self {
let vibrato = LFO::new(Waveform::Sine, 6.0, 0.25);
Self {
name: "Brass".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.05, 0.15, 0.8, 0.4), filter: Filter::low_pass(5000.0, 0.5), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.12)],
delay: None,
reverb: Some(Reverb::new(0.35, 0.5, 0.25)),
distortion: Some(Distortion::new(1.3, 0.2)), volume: 1.0,
pan: 0.0,
}
}
pub fn flute() -> Self {
let breath_lfo = LFO::new(Waveform::Sine, 4.0, 0.2); Self {
name: "Flute".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::new(0.08, 0.2, 0.7, 0.5), filter: Filter::low_pass(6000.0, 0.2), modulation: vec![ModRoute::new(breath_lfo, ModTarget::Volume, 0.08)],
delay: None,
reverb: Some(Reverb::new(0.4, 0.5, 0.3)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn clarinet() -> Self {
Self {
name: "Clarinet".to_string(),
waveform: Waveform::Square, envelope: Envelope::new(0.06, 0.2, 0.75, 0.4), filter: Filter::low_pass(3500.0, 0.3), modulation: Vec::new(),
delay: None,
reverb: Some(Reverb::new(0.35, 0.45, 0.25)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn oboe() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.8, 0.3); Self {
name: "Oboe".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.04, 0.18, 0.8, 0.45), filter: Filter::low_pass(2800.0, 0.55), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.15)],
delay: None,
reverb: Some(Reverb::new(0.35, 0.45, 0.25)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn bassoon() -> Self {
let vibrato = LFO::new(Waveform::Sine, 4.5, 0.2); Self {
name: "Bassoon".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.08, 0.25, 0.75, 0.5), filter: Filter::low_pass(1200.0, 0.4), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.12)],
delay: None,
reverb: Some(Reverb::new(0.4, 0.5, 0.3)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn french_horn() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.0, 0.25);
Self {
name: "French Horn".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.1, 0.2, 0.82, 0.5), filter: Filter::low_pass(3800.0, 0.38), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.1)],
delay: None,
reverb: Some(Reverb::new(0.55, 0.6, 0.4)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn harp() -> Self {
let shimmer = LFO::new(Waveform::Sine, 0.3, 0.15); Self {
name: "Harp".to_string(),
waveform: Waveform::Triangle,
envelope: Envelope::new(0.002, 0.35, 0.15, 0.7), filter: Filter::low_pass(7000.0, 0.25), modulation: vec![ModRoute::new(shimmer, ModTarget::FilterCutoff, 0.08)],
delay: None,
reverb: Some(Reverb::new(0.5, 0.55, 0.35)), distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn alto_sax() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.5, 0.35); Self {
name: "Alto Sax".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.03, 0.15, 0.85, 0.4), filter: Filter::low_pass(3200.0, 0.48), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.15)],
delay: None,
reverb: Some(Reverb::new(0.3, 0.4, 0.25)),
distortion: Some(Distortion::new(1.2, 0.15)), volume: 1.0,
pan: 0.0,
}
}
pub fn tenor_sax() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.0, 0.3); Self {
name: "Tenor Sax".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.04, 0.18, 0.88, 0.45), filter: Filter::low_pass(2400.0, 0.45), 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.15, 0.12)), volume: 1.0,
pan: 0.0,
}
}
pub fn soprano_sax() -> Self {
let vibrato = LFO::new(Waveform::Sine, 6.0, 0.4); Self {
name: "Soprano Sax".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.025, 0.12, 0.85, 0.35), filter: Filter::low_pass(4200.0, 0.5), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.18)],
delay: None,
reverb: Some(Reverb::new(0.28, 0.38, 0.22)),
distortion: Some(Distortion::new(1.25, 0.18)), volume: 1.0,
pan: 0.0,
}
}
pub fn baritone_sax() -> Self {
let vibrato = LFO::new(Waveform::Sine, 4.5, 0.25); Self {
name: "Baritone Sax".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.05, 0.2, 0.9, 0.5), filter: Filter::low_pass(1800.0, 0.42), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.1)],
delay: None,
reverb: Some(Reverb::new(0.4, 0.5, 0.35)),
distortion: Some(Distortion::new(1.1, 0.1)), volume: 1.0,
pan: 0.0,
}
}
pub fn trombone() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.2, 0.28);
Self {
name: "Trombone".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.06, 0.18, 0.82, 0.45), filter: Filter::low_pass(2800.0, 0.42), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.12)],
delay: None,
reverb: Some(Reverb::new(0.4, 0.5, 0.32)),
distortion: Some(Distortion::new(1.25, 0.18)), volume: 1.0,
pan: 0.0,
}
}
pub fn tuba() -> Self {
let vibrato = LFO::new(Waveform::Sine, 4.0, 0.2); Self {
name: "Tuba".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.08, 0.25, 0.88, 0.6), filter: Filter::low_pass(1200.0, 0.38), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.08)],
delay: None,
reverb: Some(Reverb::new(0.45, 0.52, 0.38)),
distortion: Some(Distortion::new(1.15, 0.12)), volume: 1.0,
pan: 0.0,
}
}
pub fn piccolo() -> Self {
let breath = LFO::new(Waveform::Sine, 4.5, 0.18); Self {
name: "Piccolo".to_string(),
waveform: Waveform::Sine,
envelope: Envelope::new(0.05, 0.15, 0.7, 0.4), filter: Filter::low_pass(8000.0, 0.25), modulation: vec![ModRoute::new(breath, ModTarget::Volume, 0.1)],
delay: None,
reverb: Some(Reverb::new(0.35, 0.42, 0.28)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn english_horn() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.2, 0.3);
Self {
name: "English Horn".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.06, 0.22, 0.78, 0.5), filter: Filter::low_pass(2200.0, 0.52), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.14)],
delay: None,
reverb: Some(Reverb::new(0.38, 0.48, 0.32)),
distortion: None,
volume: 1.0,
pan: 0.0,
}
}
pub fn muted_trumpet() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.8, 0.22); Self {
name: "Muted Trumpet".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.04, 0.15, 0.75, 0.35), filter: Filter::low_pass(2400.0, 0.38), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.1)],
delay: None,
reverb: Some(Reverb::new(0.3, 0.38, 0.22)),
distortion: Some(Distortion::new(1.15, 0.12)), volume: 1.0,
pan: 0.0,
}
}
pub fn flugelhorn() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.2, 0.3); Self {
name: "Flugelhorn".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.06, 0.18, 0.82, 0.45), filter: Filter::low_pass(3200.0, 0.35), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.12)],
delay: None,
reverb: Some(Reverb::new(0.42, 0.52, 0.35)),
distortion: Some(Distortion::new(1.2, 0.15)), volume: 1.0,
pan: 0.0,
}
}
pub fn euphonium() -> Self {
let vibrato = LFO::new(Waveform::Sine, 4.8, 0.25);
Self {
name: "Euphonium".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.07, 0.2, 0.85, 0.5), filter: Filter::low_pass(2000.0, 0.4), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.1)],
delay: None,
reverb: Some(Reverb::new(0.45, 0.52, 0.38)),
distortion: Some(Distortion::new(1.18, 0.14)), volume: 1.0,
pan: 0.0,
}
}
pub fn brass_section() -> Self {
let ensemble_vibrato = LFO::new(Waveform::Sine, 5.5, 0.28); Self {
name: "Brass Section".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.08, 0.2, 0.85, 0.5), filter: Filter::low_pass(4500.0, 0.48), modulation: vec![ModRoute::new(ensemble_vibrato, ModTarget::FilterCutoff, 0.15)],
delay: None,
reverb: Some(Reverb::new(0.55, 0.62, 0.45)), distortion: Some(Distortion::new(1.35, 0.22)), volume: 1.0,
pan: 0.0,
}
}
pub fn solo_trumpet() -> Self {
let vibrato = LFO::new(Waveform::Sine, 6.2, 0.35); Self {
name: "Solo Trumpet".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.03, 0.15, 0.8, 0.38), filter: Filter::low_pass(5200.0, 0.52), modulation: vec![ModRoute::new(vibrato, ModTarget::FilterCutoff, 0.18)],
delay: None,
reverb: Some(Reverb::new(0.32, 0.42, 0.28)),
distortion: Some(Distortion::new(1.28, 0.2)), volume: 1.0,
pan: 0.0,
}
}
pub fn muted_trombone() -> Self {
let vibrato = LFO::new(Waveform::Sine, 5.0, 0.25);
Self {
name: "Muted Trombone".to_string(),
waveform: Waveform::Sawtooth,
envelope: Envelope::new(0.05, 0.18, 0.78, 0.42), filter: Filter::low_pass(2200.0, 0.4), 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.22, 0.16)), volume: 1.0,
pan: 0.0,
}
}
}