Chuyển tới nội dung chính

beam_audio

beam_audio runs a voice turn (speech-to-text, agent, text-to-speech) and gives you the pieces for a WebSocket protocol. It does not include a WebSocket server.

beam_audio = { path = "../riverbeam/crates/beam_audio", features = ["audio-http-stt"] }
FeatureEffect
audio-http-sttHttpStt
audio-whisperAlias for audio-http-stt
audio-decodeWebM input reports BEM-352 instead of BEM-353

Types​

ItemRole
run_audio_turn(audio, seq, session_id, stt, tts, invoker, sink)One turn
SttBackend, TtsBackend, AudioInvoker, AudioSinkThe traits you implement or pick
MockStt, MockTts, HttpSttShipped backends
AudioSession, SessionState, can_transition, AppendOutcomeSession state and buffering
ControlMessage, ControlType, ServerMessageWebSocket messages
pcm_f32_to_wav_bytes, parse_wav_pcm_f32, resample_pcm, decode_to_pcm_16k, is_probable_webmAudio formats
MAX_AUDIO_CHUNK_BYTES, MAX_AUDIO_BUFFER_BYTES, MIN_UTTERANCE_BYTES, MAX_MSG_PER_SEC, HEARTBEAT_INTERVAL_SEC, HEARTBEAT_TIMEOUT_SECLimits

The protocol and the turn's message order are in Realtime audio.