Skip to main content

rill_core_model/string/
params.rs

1use rill_core::Transcendental;
2
3/// Parameters for a physical string model.
4#[derive(Debug, Clone)]
5pub struct StringParams<T: Transcendental> {
6    /// Fundamental frequency in Hz (e.g., 440.0 for A4).
7    pub frequency: T,
8    /// Decay factor per sample (0.0 = instant decay, 0.99999 = near-infinite sustain).
9    pub decay: T,
10    /// Stiffness coefficient (0.0 = ideal flexible string, > 0 = inharmonic dispersion).
11    pub stiffness: T,
12    /// Brightness — loop filter cutoff ratio (0.0 = fully dark, 1.0 = fully bright).
13    pub brightness: T,
14}
15
16impl<T: Transcendental> Default for StringParams<T> {
17    fn default() -> Self {
18        Self {
19            frequency: T::from_f32(440.0),
20            decay: T::from_f32(0.9995),
21            stiffness: T::from_f32(0.0),
22            brightness: T::from_f32(0.95),
23        }
24    }
25}