tool (RealtimeVoice.swift)

iOS-vibebuddy · realtime, speech-to-speech, multi-provider, real-time-voice, voice

Provides a provider-agnostic protocol and events for real-time speech-to-speech voice sessions, supporting multiple backends including Qwen, Gemini, and OpenAI Realtime.

// Source: https://github.com/semantic-craft/iOS-vibebuddy | License: MIT | Copyright 2026 Xianwei Zhang
// Provided via justclaw.it.com; keep this notice with the code.
import Foundation

/// A provider-agnostic event from a real-time speech-to-speech session. Qwen,
/// Gemini Live, and OpenAI Realtime all map onto this, so the audio/UI layer
/// stays the same and providers are swappable.
public enum RealtimeVoiceEvent: Sendable {
    case connected
    case userTranscript(text: String, final: Bool)       // what the user said
    case assistantTranscript(text: String, final: Bool)  // what the model says
    case audioDelta(Data)                                 // PCM 24 kHz mono 16-bit, to play
    case speechStarted                                    // server VAD: user started talkin

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

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

Get a free API key