Interrupt Prediction (VIVA SDK)
Tell real interruptions from backchannels such as "uh huh", so your voice AI agent stops talking only when the user wants it to.
Interrupt Prediction (IP) decides whether speech that starts while your agent is talking is a real interruption. Users often say short fillers such as "um hmm", "uh huh" or "yeah" to show they are listening. With VAD alone, those words make the bot stop mid-sentence. IP looks at the nature of the speech and tells the agent to keep talking through backchannels and to stop for real interruptions.
When to use it
Use IP in voice AI agents that support barge-in: the user can talk over the bot to interrupt it. Without barge-in, you don't need it.
How it works
- Clean the audio. Run Voice Isolation first, so background speech doesn't trigger the VAD.
- Detect speech. Your VAD decides, for each frame, whether the user is speaking. The sample below uses Krisp's VAD session.
- Process each frame. Pass the frame and the VAD flag to the IP session. IP extends the VAD's begin-of-speech detection.
- Compare with a threshold. IP returns the probability, between 0 and 1, that the user intends to interrupt. When it passes your threshold, stop the bot's speech.
Parameters
| Parameter | Values | Effect |
|---|---|---|
frame | One audio frame, matching the session's sample rate and frame duration | The audio to analyse. |
vad_flag | True / False | Whether voice was detected in this frame. |
| Threshold | 0.5 (recommended) | Lower values stop the bot sooner, including for some backchannels. Higher values let the bot keep talking through more backchannels, but react later to real interruptions. |
The session takes float (IpFloat) or 16-bit PCM (IpInt16) samples.
Code
import krisp_audio
def log_callback(log_message, log_level):
print(f"[{log_level}] {log_message}", flush=True)
# Initialize the Krisp SDK global instance
krisp_audio.globalInit("", log_callback, krisp_audio.LogLevel.Off)
# VAD session: Interrupt Prediction needs a voice-activity flag for every frame
vad_model_info = krisp_audio.ModelInfo()
vad_model_info.path = "/path_to_the/vad_model.kef"
vad_cfg = krisp_audio.VadSessionConfig()
vad_cfg.inputSampleRate = krisp_audio.SamplingRate.Sr16000Hz
vad_cfg.inputFrameDuration = krisp_audio.FrameDuration.Fd10ms
vad_cfg.modelInfo = vad_model_info
vad_instance = krisp_audio.VadFloat.create(vad_cfg)
# Interrupt Prediction session
ip_model_info = krisp_audio.ModelInfo()
ip_model_info.path = "/path_to_the/ip_model.kef"
ip_cfg = krisp_audio.IpSessionConfig()
ip_cfg.inputSampleRate = krisp_audio.SamplingRate.Sr16000Hz
ip_cfg.inputFrameDuration = krisp_audio.FrameDuration.Fd10ms
ip_cfg.modelInfo = ip_model_info
sample_type = "FLOAT" # or "PCM_16"
if sample_type == "FLOAT":
ip_instance = krisp_audio.IpFloat.create(ip_cfg)
elif sample_type == "PCM_16":
# use krisp_audio.VadInt16 for the VAD session as well
ip_instance = krisp_audio.IpInt16.create(ip_cfg)
else:
raise ValueError(f"Unsupported sample type {sample_type}")
vad_threshold = 0.5
ip_recommended_threshold = 0.5
# Processing fixed sized audio frames
for frame in audio_frames:
vad_prob = vad_instance.process(frame)
vad_flag = vad_prob >= vad_threshold
ip_probability = ip_instance.process(frame, vad_flag) # the value is in the [0, 1] range
if ip_probability >= ip_recommended_threshold:
# Consider that the user intended to interrupt the bot
print("Interruption detected")
# Free the sessions, then the Krisp SDK global instance
ip_instance = None
vad_instance = None
krisp_audio.globalDestroy()Troubleshooting
- The bot still stops for "uh huh" and similar fillers. Raise the threshold, and check that your app waits for IP instead of stopping on the VAD's begin-of-speech alone.
- The bot reacts late to real interruptions. Lower the threshold.
- Background speech triggers interruptions. Add Voice Isolation before the VAD and IP.
Updated 9 days ago
Did this page help you?

