use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum Vocalization {
Howl,
Bark,
Growl,
Roar,
Hiss,
Chirp,
Trill,
Whine,
Rumble,
Purr,
Yelp,
Screech,
Stridulate,
Buzz,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum CallIntent {
Alarm,
Territorial,
Mating,
Distress,
Idle,
Threat,
Social,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[must_use]
pub struct IntentModifiers {
pub pitch_scale: f32,
pub amplitude_scale: f32,
pub duration_scale: f32,
pub urgency: f32,
}
impl CallIntent {
#[must_use = "returns intent modifiers that should be applied to synthesis"]
pub fn modifiers(self) -> IntentModifiers {
match self {
Self::Alarm => IntentModifiers {
pitch_scale: 1.4,
amplitude_scale: 1.5,
duration_scale: 0.7,
urgency: 0.9,
},
Self::Territorial => IntentModifiers {
pitch_scale: 0.9,
amplitude_scale: 1.3,
duration_scale: 1.5,
urgency: 0.5,
},
Self::Mating => IntentModifiers {
pitch_scale: 1.1,
amplitude_scale: 1.0,
duration_scale: 2.0,
urgency: 0.2,
},
Self::Distress => IntentModifiers {
pitch_scale: 1.5,
amplitude_scale: 1.4,
duration_scale: 0.8,
urgency: 1.0,
},
Self::Idle => IntentModifiers {
pitch_scale: 1.0,
amplitude_scale: 0.5,
duration_scale: 1.0,
urgency: 0.0,
},
Self::Threat => IntentModifiers {
pitch_scale: 0.7,
amplitude_scale: 1.4,
duration_scale: 1.2,
urgency: 0.7,
},
Self::Social => IntentModifiers {
pitch_scale: 1.0,
amplitude_scale: 0.8,
duration_scale: 1.0,
urgency: 0.3,
},
}
}
}