Skip to main content

Input Components

EstuaryMicrophone

MonoBehaviour -- Captures microphone audio and sends it to the server. Supports both WebSocket (Unity Microphone API) and LiveKit (WebRTC RtcAudioSource) modes.

Namespace: Estuary

Inspector Fields

FieldTypeDefaultDescription
SampleRateint16000Recording sample rate in Hz
ChunkDurationMsint100Audio chunk size in milliseconds
PushToTalkKeyKeyCodeNoneKey for push-to-talk. None = always-on
UseVoiceActivityDetectionboolfalseEnable client-side VAD (WebSocket mode)
VadThresholdfloat0.5VAD sensitivity: 0 = most sensitive, 1 = least sensitive

Properties

PropertyTypeAccessDescription
IsRecordingboolgettrue while the microphone is capturing
IsMutedboolgettrue when muted (LiveKit mode)
CurrentVolumefloatgetCurrent audio volume level (0--1)
IsSpeechDetectedboolgettrue when VAD detects speech

Methods

MethodReturnsDescription
StartRecording()voidStart capturing audio
StopRecording()voidStop capturing audio
Configure(int sampleRate, int chunkDurationMs)voidReconfigure audio settings
Mute()voidMute the microphone (LiveKit: mutes the track)
Unmute()voidUnmute the microphone

Events

EventSignatureDescription
OnRecordingStartedActionMicrophone started capturing
OnRecordingStoppedActionMicrophone stopped capturing
OnVolumeChangedAction<float>Volume level changed (0--1)
OnSpeechDetectedActionUser started speaking (VAD)
OnSilenceDetectedActionUser stopped speaking (VAD)

WebSocket vs LiveKit Behavior

BehaviorWebSocket ModeLiveKit Mode
CaptureUnity Microphone.Start()LiveKit RtcAudioSource
TransportBase64 PCM over Socket.IOWebRTC audio track
AECNone (manual echo handling)Native platform AEC
MuteStops sending chunksMutes the WebRTC track
VADClient-side amplitude checkServer-side; client VAD used for interrupt detection

Push-to-Talk

When PushToTalkKey is set to a key other than None:

  • WebSocket mode: Audio is only captured and sent while the key is held
  • LiveKit mode: The microphone track is muted when the key is released and unmuted when pressed