adk_live_voice_protocol (erlang_adk v0.7.0)
View SourceStrict provider-neutral binary framing for realtime browser voice.
One binary is exactly one frame. Version 1 intentionally has no generic length-prefixed or JSON envelope: every type has one exact shape, making it possible for an HTTP/WebSocket adapter to reject malformed input before it reaches a Live session. Multi-byte header integers are big-endian; PCM samples inside the payload are signed 16-bit little-endian.
Summary
Types
-type client_action() :: {audio, pos_integer(), binary()} | audio_stream_end | {ack, pos_integer()} | activity_start | activity_end.
-type decode_error() ::
invalid_live_voice_frame | invalid_live_voice_audio | live_voice_audio_frame_too_large |
invalid_live_voice_frame_limit.
-type encode_error() ::
invalid_live_voice_event | invalid_live_voice_frame_limit | live_voice_output_frame_too_large.
Functions
-spec decode_client(binary(), pos_integer()) -> {ok, client_action()} | {error, decode_error()}.
-spec encode_event(adk_live_event:event(), pos_integer()) -> {ok, binary()} | skip | {error, encode_error()}.
-spec lifecycle_code(atom()) -> {ok, 1..9} | error.