krisp_instance

Krisp Instance manager for pipecat audio.

pipecat.audio.krisp_instance.int_to_krisp_sample_rate(sample_rate: int)[source]

Convert integer sample rate to Krisp SDK enum value.

Parameters:

sample_rate – Sample rate in Hz (e.g., 16000, 24000, 48000).

Returns:

Corresponding Krisp SDK SampleRate enum value.

Raises:

ValueError – If the sample rate is not supported by Krisp SDK.

pipecat.audio.krisp_instance.int_to_krisp_frame_duration(frame_duration_ms: int)[source]

Convert integer frame duration to Krisp SDK enum value.

Parameters:

frame_duration_ms – Frame duration in milliseconds (e.g., 10, 20, 30).

Returns:

Corresponding Krisp SDK FrameDuration enum value.

Raises:

ValueError – If the frame duration is not supported by Krisp SDK.

class pipecat.audio.krisp_instance.KrispVivaSDKManager[source]

Bases: object

Singleton manager for Krisp VIVA SDK with reference counting.

classmethod acquire(api_key: str = '')[source]

Acquire a reference to the SDK (initializes if needed).

Call this when creating a filter instance.

Parameters:

api_key – Krisp SDK API key. If empty, falls back to the KRISP_VIVA_API_KEY environment variable.

Raises:

Exception – If SDK initialization fails (propagated from krisp_audio)

classmethod release()[source]

Release a reference to the SDK (destroys if last reference).

Call this when destroying a filter instance.

classmethod get_reference_count() int[source]

Get the current reference count.

Returns:

Current number of active references to the SDK.

classmethod is_initialized() bool[source]

Check if the SDK is currently initialized.

Returns:

True if SDK is initialized, False otherwise.