zk-audio
A Rust library for real-time audio capture, voice enhancement, and microphone simulation.
Features
- Native Audio Capture - CPAL-based cross-platform audio input
- Voice Enhancement Pipeline - 19 DSP processor stages for professional voice quality
- Microphone Simulation - Emulate classic microphones (Neumann U87, Shure SM7B, etc.)
- Profile-Based Processing - Pre-configured profiles for different environments
- WAV Output - Built-in WAV encoding with hound
Installation
Add to your Cargo.toml:
[]
= { = "../zk-audio" }
Or without native capture support:
[]
= { = "../zk-audio", = false }
Quick Start
Basic Voice Recording
use ;
use PathBuf;
// Create capture configuration
let config = NativeCaptureConfig ;
// Start recording
let backend = new;
let mut recording = backend.start?;
// Stop and finalize
let diagnostics = recording.stop?;
println!;
Building a Processing Pipeline
use ;
let builder = new;
let pipeline = builder.build?;
Audio Profiles
| Profile | Description | Use Case |
|---|---|---|
Raw |
No processing | Reference recordings, debugging |
VoiceClean |
Light processing | Quiet environments, studio |
VoiceNoisyRoom |
Moderate noise reduction | Office spaces, cafes |
VoiceHvac |
Aggressive HVAC suppression | Air-conditioned rooms |
Processor Stages
The pipeline applies processors in this order:
-
Filtering
HighPass- Remove low-frequency rumbleLowShelfCut- Reduce bass build-upLowPass- Remove high-frequency noise
-
Dynamics
Expander- Gate out quiet noiseNoiseSuppression- Spectral noise reductionAdaptiveGain- Speech-aware amplificationCompressor- Multi-band compressionAgc- Automatic gain control
-
Tone Shaping
AdaptiveToneShaper- Dynamic EQMidResonanceSuppressor- Reduce boxy soundHighBandCleanup- Clean harsh frequenciesPresenceBoost- Enhance speech clarityDeEsser- Reduce sibilanceTailSuppression- Reduce reverb tailsDehiss- Remove hissAirBandReducer- HVAC-specific filtering
-
Effects
DoublingDelay- Voice thickeningVoiceFinisher- Final polish (glue, warmth, saturation)Limiter- Prevent clipping
Overriding Processor Stages
use ;
use BTreeMap;
let mut overrides = new;
overrides.insert;
overrides.insert;
let config = NativeCaptureConfig ;
Microphone Simulation
Add character of classic microphones to your recordings:
use ;
let mic_config = MicrophoneSimConfig ;
Supported Models
| Model | Description |
|---|---|
U87 |
Neumann U87 - Warm, smooth condenser |
TLM103 |
Neumann TLM103 - Clean, modern |
SM7B |
Shure SM7B - Broadcast standard |
RE20 |
Electro-Voice RE20 - Announcer mic |
C414 |
AKG C414 - Versatile condenser |
MD421 |
Sennheiser MD421 - Dynamic |
M149 |
Neumann M149 - Vintage tube |
Delay Effects
Add vocal effects:
use ;
let delay = DelayEffectConfig ;
| Preset | Effect |
|---|---|
VoiceDoubler |
Subtle widening |
Thickener |
Dense doubling |
Slapback |
Short echo |
Bloom - |
Rich ambience |
Device Enumeration
use ;
// List available input devices
let devices = list_input_devices?;
for device in devices
// Set preferred device
set_default_input_device?;
Documentation
Platform Support
| Platform | Backend | Status |
|---|---|---|
| Linux | PipeWire/PulseAudio | Supported |
| macOS | CoreAudio | Planned |
| Windows | WASAPI | Planned |
Dependencies
cpal- Cross-platform audio I/O (optional)hound- WAV encoding/decodingbiquad- Biquad filter coefficientsrealfft- Real-valued FFTserde- Serialization
License
MIT