adk_live_voice_protocol (erlang_adk v0.7.0)

View Source

Strict 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

client_action/0

-type client_action() ::
          {audio, pos_integer(), binary()} |
          audio_stream_end |
          {ack, pos_integer()} |
          activity_start | activity_end.

decode_error/0

-type decode_error() ::
          invalid_live_voice_frame | invalid_live_voice_audio | live_voice_audio_frame_too_large |
          invalid_live_voice_frame_limit.

encode_error/0

-type encode_error() ::
          invalid_live_voice_event | invalid_live_voice_frame_limit | live_voice_output_frame_too_large.

Functions

decode_client(Frame, MaxAudioBytes)

-spec decode_client(binary(), pos_integer()) -> {ok, client_action()} | {error, decode_error()}.

encode_event(Event, MaxFrameBytes)

-spec encode_event(adk_live_event:event(), pos_integer()) ->
                      {ok, binary()} | skip | {error, encode_error()}.

lifecycle_code(Kind)

-spec lifecycle_code(atom()) -> {ok, 1..9} | error.