Skip to main content

Crate shravan

Crate shravan 

Source
Expand description

§shravan

shravan (Sanskrit: hearing / perception) — Audio codecs for the AGNOS ecosystem.

Provides encode/decode for WAV, FLAC, AIFF, Ogg/Opus, AAC, ALAC, and MP3, plus PCM sample format conversion, sinc resampling, and metadata tag reading.

§Feature flags

FeatureDefaultDescription
stdyesStandard library support
wavyesWAV encode/decode
flacyesFLAC encode/decode
pcmyesPCM format conversions
resamplenoSinc resampler
tagnoID3v2 / Vorbis Comment tag reading
oggnoOgg container parsing/muxing
aiffnoAIFF/AIFF-C encode/decode
mp3noMP3 frame parsing (header only)
opusnoOpus header parsing + CELT-mode encode
aacnoAAC-LC decode (ADTS) + encode (requires std)
alacnoApple Lossless decode (raw frames)
simdnoSIMD-accelerated PCM conversion
dithernoDithering for bit-depth reduction
streamingnoStreaming decoders (requires std)
loggingnotracing instrumentation

§Quick start

use shravan::format::detect_format;
use shravan::codec::open;

// Auto-detect and decode (requires wav + pcm features)
let wav_bytes = shravan::wav::encode(
    &[0.0f32; 100], 44100, 1, shravan::pcm::PcmFormat::I16,
).unwrap();
let (info, samples) = open(&wav_bytes).unwrap();
assert_eq!(info.sample_rate, 44100);

Re-exports§

pub use error::Result;
pub use error::ShravanError;
pub use format::AudioFormat;
pub use format::FormatInfo;

Modules§

codec
Unified codec interface — auto-detect and decode audio data.
error
Error types for shravan.
flac
FLAC (Free Lossless Audio Codec) encoder and decoder.
format
Audio format detection and metadata.
pcm
PCM sample format conversion and layout utilities.
wav
WAV (RIFF WAVE) encoder and decoder.