Files
Claude cf87382997 voelin-audio: tap for the processed microphone
The screen share should be able to carry our microphone as one of its
audio sources, and it should be the processed signal (echo
cancellation, noise suppression, gain control) the voice connection
sends, not a second raw capture of the device.

voelin_audio::tap::microphone() is a publish point the voice pipeline
feeds with every processed chunk. Without consumers that costs one
relaxed atomic load per chunk. Consumers attach a TapSink and get the
chunks on the audio thread; the publisher never waits (a try-lock that
only contends with attach and detach). Several pipelines (one per
server, the microphone test) may run at once: the tap follows one until
it is silent for 200 ms. A muted microphone publishes silence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-28 02:56:17 +00:00

55 lines
1.7 KiB
Rust

//! Voice pipeline building blocks.
//!
//! - [`pcm`]: sample-rate constants, tone generation and detection helpers
//! - [`encode`]: Opus encoding of 20 ms frames into TeamSpeak voice packets
//! - [`framer`]: slice an arbitrary sample stream into codec frames
//! - [`resample`]: sample-rate conversion to the 48 kHz the codec uses
//! - [`wav`]: WAV file input/output
//! - [`process`]: echo cancellation, noise suppression and gain control
//! - [`vad`]: voice activity detection
//! - [`mixer`]: per-client jitter buffer, decoder, volume and mixing (on the
//! vendored `tsclientlib::audio::AudioHandler`)
//! - [`settings`]: all user audio settings in one serde struct
//! - [`tap`]: the processed microphone for other consumers (the stream
//! mixer), free while nobody listens
//! - `device` (feature `device`): capture and playback through cpal, device
//! lists and loss detection
pub mod encode;
pub mod framer;
pub mod mixer;
pub mod pcm;
pub mod process;
pub mod resample;
pub mod settings;
pub mod tap;
pub mod vad;
pub mod wav;
#[cfg(feature = "device")]
pub mod device;
pub use encode::{VoiceCodec, VoiceEncoder};
pub use framer::Framer;
pub use mixer::Mixer;
pub use process::{ProcessingSettings, Processor};
pub use settings::AudioSettings;
pub use tsclientlib::audio::AudioHandler;
pub use vad::{Vad, VadSettings};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("opus: {0}")]
Opus(#[from] opus2::Error),
#[error("wav: {0}")]
Wav(#[from] hound::Error),
#[error("resampling failed: {0}")]
Resample(String),
#[error("audio device: {0}")]
Device(String),
#[error("invalid input: {0}")]
Invalid(String),
}
pub type Result<T> = std::result::Result<T, Error>;