Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions livekit-agents/livekit/agents/inference/interruption.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@
)

SAMPLE_RATE = 16000
THRESHOLD = 0.5
MIN_INTERRUPTION_DURATION = 0.025 * 2 # 25ms per frame, 2 consecutive frames
THRESHOLD = 0.656
MAX_AUDIO_DURATION = 3 # 3 seconds
DETECTION_INTERVAL = 0.1 # 0.1 second
AUDIO_PREFIX_DURATION = 1.0 # 1.0 second
REMOTE_INFERENCE_TIMEOUT = 0.7 # 700ms
_FRAMES_PER_SECOND = 40
# they are used only to compute MIN_INTERRUPTION_DURATION * _FRAMES_PER_SECOND = min_frames (2 by default)
FRAME_SIZE = 0.01 # 10ms
MIN_INTERRUPTION_DURATION = FRAME_SIZE * 2 # 10ms per frame, any 2 frames
_FRAMES_PER_SECOND = 100


class InterruptionDetectionError(BaseModel):
Expand Down Expand Up @@ -1178,7 +1180,7 @@ def _estimate_probability(
if probabilities is None:
return 0.0

n_th = math.ceil(window_size / 0.025) # 25ms per frame
n_th = math.ceil(window_size / FRAME_SIZE) # 10ms per frame
if len(probabilities) < n_th:
return 0.0

Expand Down
Loading