AudioStreamer (streamer.py)

VibeVoice · audio-streaming, microphone-capture, realtime-streaming, realtime

Streams audio data from microphone to server for real-time voice processing.

# Source: https://github.com/microsoft/VibeVoice | License: MIT | Copyright 2025 Microsoft
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations

import torch

import asyncio
from queue import Empty, Queue
from typing import TYPE_CHECKING, Optional


from transformers.generation import BaseStreamer


class AudioStreamer(BaseStreamer):
    """
    Audio streamer that stores audio chunks in queues for each sample in the batch.
    This allows streaming audio generation for multiple samples simultaneously.
    
    Parameters:
        batch_size (`int`):
            The batch size for generation
        stop_signal (`any`, *optional*):
            The signal to put in the queue when generation ends. Defaults to None.
        timeout (`float`, *opti

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

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

Get a free API key