Member Junction
    Preparing search index...

    Web Audio playout scheduler for raw PCM16 model audio at a driver-supplied sample rate.

    Chunks are wrapped in AudioBuffers and scheduled back-to-back against a playhead clock: each chunk starts at max(playheadTime, currentTime) and advances the playhead by its duration, producing gapless playout regardless of network jitter. IsPlaying is computed directly from that clock — the playhead being ahead of currentTime (with live sources) means audio is audibly coming out of the speaker. On interruption, Flush stops every scheduled source and rewinds the playhead.

    Generalized from the Gemini driver's original 24 kHz-fixed engine: the sample rate is now a constructor parameter so providers that negotiate their output format at session start (e.g. ElevenLabs' agent_output_audio_format) can construct the playout engine with the negotiated rate.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Parameters

      • sampleRate: number

        The PCM16 sample rate (Hz) of the chunks this engine will play (e.g. 24000 for Gemini Live, the negotiated agent_output_audio_format rate for ElevenLabs).

      Returns RealtimePcmPlayback

    Accessors

    Methods

    • The agent's output audio as a MediaStream, or null when unsupported. Hosts mix this into a recording: WebRTC drivers get the agent voice from the peer connection, PCM drivers (which play through Web Audio) must expose it from here. The stream lives on this engine's own (e.g. 24 kHz) context, so consumers wrap it in a source node on THEIR context rather than reusing this one.

      Returns MediaStream