+
    >jS                        ^ RI Ht ^ RIt^ RIHtHt ^RIHt ^RIH	t	 Rt
 ! R R]P                  P                  4      t ! R	 R
]P                  P                  4      tR# )    )annotationsN)agentsrtclogger) FRAME_USERDATA_AIC_VAD_ATTRIBUTEi  c                  j   a  ] tR t^tRtR V 3R llt]R R l4       t]R R l4       tR R	 lt	R
t
V ;t# )VADz
A VAD implementation that relies on the accompanying ai-coustics
:func:`~livekit.plugins.ai_coustics.audio_enhancement` FrameProcessor
instead of performing its own inference.
c                   V ^8  d   QhRR/#    returnNone )formats   "t/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/livekit/plugins/ai_coustics/vad.py__annotate__VAD.__annotate__   s     5 5$ 5    c                	   < \         SV `  \        P                  P	                  R R7      R7       \
        P                  \        ,          ! 4       V n        R# )gMb?)update_interval)capabilitiesN)	super__init__r   vadVADCapabilitiesweakrefWeakSet	VADStream_streams)self	__class__s   &r   r   VAD.__init__   s9    fjj&@&@QV&@&WX	24r   c                   V ^8  d   QhRR/# r   r   strr   )r   s   "r   r   r      s      s r   c                	    R # zai-cousticsr   r!   s   &r   model	VAD.model       r   c                   V ^8  d   QhRR/# r%   r   )r   s   "r   r   r       s      # r   c                	    R # r(   r   r)   s   &r   providerVAD.provider   r,   r   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r   #   s      	 r   c                	R    \        V 4      pV P                  P                  V4       V# )N)r   r    add)r!   streams   & r   r4   
VAD.stream#   s"    4&!r   )r    )__name__
__module____qualname____firstlineno____doc__r   propertyr*   r/   r4   __static_attributes____classcell__r"   s   @r   r
   r
      sD    5 5     r   r
   c                  x   a  ] tR t^)tR V 3R llt]P                  P                  ]R7      R R l4       t	Rt
V ;t# )r   c                    V ^8  d   QhRRRR/# )r   r   r
   r   r   r   )r   s   "r   r   VADStream.__annotate__*   s     * *C *D *r   c                	4   < \         SV `  V4       ^ V n        R# )r   N)r   r   _has_no_metadata_counter)r!   r   r"   s   &&r   r   VADStream.__init__*   s    ()%r   r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rA   /   s     yJ yJ$ yJr   c                	  "   ^ pRp^ p^ p. p^ pRpRpRp	V P                     Rj  xL
  p
\        V
\        P                  4      '       g   K,  V'       g   V
P                  pM)V
P                  V8w  d   \
        P                  ! R4       Kj  V
P                  P                  \        4      pVfb   \        V
P                  4      ^ 8  dF   V P                  ^
8  d   \
        P                  ! R\        4       V ;P                  ^,          un        K  ^ V n        TpV
P                  pWjP                  ,          pW},          pV'       d
   W,          pMW,          p	V P                  P!                  \"        P$                  P'                  \"        P$                  P(                  P*                  VVVV	RRV
.VVVR7      4       VP-                  V
4       V'       d   V^,          p^ pV'       g   RpRp	V P                  P!                  \"        P$                  P'                  \"        P$                  P(                  P.                  VVVV P0                  P2                  P4                  ,          RRR\7        V4      R^ VR7      4       MV^,          p^ pV'       d   RpRpV P                  P!                  \"        P$                  P'                  \"        P$                  P(                  P8                  VVRVV P0                  P2                  P4                  ,          RR\7        V4      RV^ R7      4       . p\        V4      \:        8  g   EK#  V\:        ) R pEK0   EL,ED.R# 5i)	r   Fg        Nz3a frame with another sample rate was already pushedzNo VAD metadata found in frame.userdata['%s'] make sure that you are using noise_cancellation=audio_enhancement() on the audio input. This VAD plugin relies on its preprocessing.g      ?)typesamples_index	timestampspeech_durationsilence_durationprobabilityinference_durationframesspeakingraw_accumulated_silenceraw_accumulated_speechT)	_input_ch
isinstancer   
AudioFramesample_rater   erroruserdatagetr   lendatarC   durationsamples_per_channel	_event_chsend_nowaitr   r   VADEventVADEventTypeINFERENCE_DONEappendSTART_OF_SPEECH_vadr   r   listEND_OF_SPEECHSPEECH_BUFFER_MAX_FRAMES)r!   rU   rO   speech_frame_countsilence_frame_countspeech_buffercurrent_samplerI   rJ   rK   input_framevad_metadatais_speakingframe_durations   &             r   
_main_taskVADStream._main_task.   s    .0	!% n	J n	J+k3>>::)55((K7RS&//334TUL#{''(1,44r9K =	 11Q6101- ,K(11N===N'I1 2  NN&&

##00??"0'$3%5 #'*'=%,?+= $     -"a'"&'##H'*$NN..

++!'!8!8!H!H*8&/,>"ii44DD-E-0(+/2#'#6%)453E , " $q(#%&"$H&)ONN..

++!'!8!8!F!F*8&/,/-@"ii44DD.E(+/2#'#6%*4G34 , " %'M =!$<< -/G.G.H I]n	JsF   MMMM+MF MM)B*MB*MMMM)rC   )r6   r7   r8   r9   r   r   utilslog_exceptionsr   rp   r<   r=   r>   s   @r   r   r   )   s7    * * \\   /yJ 0yJr   r   )
__future__r   r   livekitr   r   logr   pluginr   rg   r   r
   r   r   r   r   <module>rx      sJ    #    4 &**.. 2J

$$ Jr   