animalese-rs
Rust library for generating Animal Crossing-style "animalese" speech sounds.
Assets come courtesy of https://github.com/joshxviii/animalese-typing-desktop, also MIT Licensed.
Features
- 8 voice types (f1-f4, m1-m4)
- Pitch shifting and randomization
- Intonation control (rising/falling pitch for questions, excitement, statements)
- Audio assets bundled with the crate
- Interactive CLI tool
Installation
Add to your Cargo.toml:
[]
= "0.1"
Usage
Basic Example
use Animalese;
let engine = new?;
engine.speak?;
Custom Voice Profile
use ;
let mut engine = new?;
let profile = VoiceProfile ;
engine.set_profile;
engine.speak?;
Intonation and Speech Patterns
use Animalese;
let engine = new?;
// Automatic rising intonation for questions
engine.speak_question?;
// Excited speech (higher pitch + rising)
engine.speak_excited?;
// Statement with falling intonation
engine.speak_statement?;
// Or manually control intonation (-1.0 to 1.0)
let mut profile = engine.profile;
profile.intonation = 0.5; // Rising pitch over sentence
engine.set_profile;
engine.speak?;
Advanced: Custom Assets
use Animalese;
// Only if you have custom audio files matching the expected format
let engine = with_custom_assets?;
CLI Tool
Interactive typing sounds:
Speak text directly:
Available options:
--voice(-v): Voice type (f1-f4, m1-m4)--pitch(-p): Pitch shift in semitones (-12.0 to 12.0)--variation(-r): Random pitch variation (0.0 to 2.0)--intonation(-i): Pitch glide over sentence (-1.0 falling to 1.0 rising)--volume(-V): Volume level (0.0 to 1.0)--list(-l): Show available voices--test(-t): Play test phrase
Known Issues
Audio Clicking in Fast Typing Mode
When typing very fast in interactive mode, you may occasionally hear clicking or popping artifacts. This is due to abruptly cutting audio waveforms when sounds overlap rapidly.
Current mitigations:
- 5ms fade-in applied to all sounds
- Reduced playback duration for fast typing (30ms)
Workaround: Type slightly slower or adjust the fast-typing threshold in the source.
Future: We're evaluating alternative audio backends like kira (designed for game audio with per-sound control and tweening) or creek that provide better control over individual sound instances and fade-outs.
Technical Details
Audio Backend
Currently uses rodio for audio playback. While excellent for music playback, rodio's Sink architecture makes it challenging to apply per-sound fade-outs dynamically, which can cause clicks when cutting sounds short during fast typing.
Potential alternatives:
kira- Game audio library with individual sound instance control, tweening, and proper fade-outscreek- Low-latency audio playback with sample-accurate controltunes- Comprehensive music synthesis and composition (heavier weight)
License
MIT