sniff_container (tools/audio_container.py)

plastic-labs/hermes-agent · tools/audio_container.py · python · MIT
voice

Shared magic-byte audio/AV container detection — the ONE sniffer for the codebase. Outbound (``tools/tts_tool.py``): TTS backends silently ignore the requested format (Edge emits MP3, Piper WAV), so the file is sniffed and its ``.ogg`` extension repaired. Inbound (``gateway/platf

# Source: https://github.com/plastic-labs/hermes-agent | License: MIT | Copyright 2025 Nous Research
# Provided via justclaw.it.com; keep this notice with the code.
"""Shared magic-byte audio/AV container detection — the ONE sniffer for the codebase.

Outbound (``tools/tts_tool.py``): TTS backends silently ignore the requested
format (Edge emits MP3, Piper WAV), so the file is sniffed and its ``.ogg``
extension repaired. Inbound (``gateway/platforms/base.py`` cache_audio_*,
``gateway/platforms/signal.py``): adapters pass wrong/guessed voice-note
extensions (Telegram ``.oga``, iOS M4A-branded MP4), so the cache sniffs the
real container for STT and players. Only audio/AV containers are claimed:
RIFF/WEBP and other images return ``None`` so callers check images first.
"""

from __future__ im

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key