Voice AI Base Classes (voice/base.py)

SynapseKit · src/synapsekit/voice/base.py · python · Apache-2.0
voice, ai, realtime, lang:python

Defines abstract base classes for Voice Activity Detection, Speech-to-Text, and Text-to-Speech providers with streaming support. Use when building modular voice processing pipelines.

# Source: https://github.com/SynapseKit/SynapseKit | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Abstract base classes for VAD, STT, and TTS providers."""

from __future__ import annotations

from abc import ABC, abstractmethod
from collections.abc import AsyncIterator


class BaseVAD(ABC):
    """Abstract Voice Activity Detector."""

    @abstractmethod
    async def is_speech(self, frame: bytes) -> bool:
        """Return True if *frame* contains speech."""
        ...


class BaseSTT(ABC):
    """
    Abstract Speech-to-Text provider with streaming support.

    Concrete implementations should yield incremental transcript strings
    as audio arrives.  The final transcript 

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

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

Get a free API key