Module livekit.plugins.ai_coustics
Sub-modules
livekit.plugins.ai_coustics.authlivekit.plugins.ai_coustics.libplugins_ai_coustics_uniffilivekit.plugins.ai_coustics.loglivekit.plugins.ai_coustics.pluginlivekit.plugins.ai_coustics.vad
Functions
def audio_enhancement(*,
model: livekit.plugins.ai_coustics._ffi.EnhancerModel = EnhancerModel.QUAIL_L,
vad_settings: livekit.plugins.ai_coustics._ffi.VadSettings = VadSettings(),
model_parameters: ModelParameters | None = None,
auth: AuthBase = <livekit.plugins.ai_coustics.auth.LiveKitCloud object>)-
Expand source code
def audio_enhancement( *, model: EnhancerModel = EnhancerModel.QUAIL_L, vad_settings: VadSettings = VadSettings( speech_hold_duration=None, sensitivity=None, minimum_speech_duration=None, ), model_parameters: Optional[ModelParameters] = None, auth: AuthBase = Auth.livekit_cloud(), ): """ Implements a mechanism to apply [ai-coustics models](https://ai-coustics.com/) on audio data represented as `AudioFrame`s. In addition, each frame will be annotated with a FRAME_USERDATA_AIC_VAD_ATTRIBUTE `userdata` attribute containing the output of the aic vad model. """ if model == EnhancerModel.SPARROW_S: warnings.warn( "sparrowS is deprecated, use rookS instead", DeprecationWarning, stacklevel=2, ) return AICousticsAudioEnhancer( model=model, vad_settings=vad_settings, model_parameters=model_parameters, auth=auth, )Implements a mechanism to apply ai-coustics models on audio data represented as
AudioFrames. In addition, each frame will be annotated with a FRAME_USERDATA_AIC_VAD_ATTRIBUTEuserdataattribute containing the output of the aic vad model.
Classes
class AiCousticsApi (*, license_key: str)-
Expand source code
class AiCousticsApi(AuthBase): """Use your own ai-coustics credentials directly, bypassing LiveKit Cloud.""" provider = "aiCousticsApi" def __init__(self, *, license_key: str): self.license_key = license_key def _to_auth_mode(self, credentials): from ._ffi import AuthMode return AuthMode.AI_COUSTICS_API(license_key=self.license_key)Use your own ai-coustics credentials directly, bypassing LiveKit Cloud.
Ancestors
- AuthBase
- abc.ABC
Class variables
var provider : str
class Auth-
Expand source code
class Auth: """Namespace of auth provider factories.""" @staticmethod def livekit_cloud() -> LiveKitCloud: """Use LiveKit Cloud for ai-coustics authentication and billing (default).""" return LiveKitCloud() @staticmethod def ai_coustics_api(*, license_key: str) -> AiCousticsApi: """Use your own ai-coustics credentials directly, bypassing LiveKit Cloud.""" return AiCousticsApi(license_key=license_key)Namespace of auth provider factories.
Static methods
def ai_coustics_api(*, license_key: str) ‑> AiCousticsApi-
Expand source code
@staticmethod def ai_coustics_api(*, license_key: str) -> AiCousticsApi: """Use your own ai-coustics credentials directly, bypassing LiveKit Cloud.""" return AiCousticsApi(license_key=license_key)Use your own ai-coustics credentials directly, bypassing LiveKit Cloud.
def livekit_cloud() ‑> LiveKitCloud-
Expand source code
@staticmethod def livekit_cloud() -> LiveKitCloud: """Use LiveKit Cloud for ai-coustics authentication and billing (default).""" return LiveKitCloud()Use LiveKit Cloud for ai-coustics authentication and billing (default).
class AuthBase-
Expand source code
class AuthBase(ABC): """Base for ai-coustics authentication providers.""" provider: str @abstractmethod def _to_auth_mode(self, credentials): ...Base for ai-coustics authentication providers.
Ancestors
- abc.ABC
Subclasses
Class variables
var provider : str
class EnhancerModel (*args, **kwds)-
Expand source code
class EnhancerModel(enum.Enum): QUAIL_L = 0 QUAIL_VF_L = 1 QUAIL_VF_S = 2 SPARROW_S = 3 ROOK_S = 4Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3Access them by:
- attribute access:
Color.RED
- value lookup:
Color(1)
- name lookup:
Color['RED']
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
Ancestors
- enum.Enum
Class variables
var QUAIL_Lvar QUAIL_VF_Lvar QUAIL_VF_Svar ROOK_Svar SPARROW_S
class ModelParameters (enhancement_level: float | None = None, bypass: float | None = None)-
Expand source code
@dataclass class ModelParameters: enhancement_level: Optional[float] = None bypass: Optional[float] = None def _to_uniffi(self): return ModelParametersUniffi( enhancement_level=self.enhancement_level, bypass=self.bypass, )ModelParameters(enhancement_level: Optional[float] = None, bypass: Optional[float] = None)
Instance variables
var bypass : float | Nonevar enhancement_level : float | None
class VAD-
Expand source code
class VAD(agents.vad.VAD): """ A VAD implementation that relies on the accompanying ai-coustics :func:`~livekit.plugins.ai_coustics.audio_enhancement` FrameProcessor instead of performing its own inference. """ def __init__(self) -> None: super().__init__(capabilities=agents.vad.VADCapabilities(update_interval=0.032)) self._streams = weakref.WeakSet[VADStream]() @property def model(self) -> str: return "ai-coustics" @property def provider(self) -> str: return "ai-coustics" def stream(self) -> VADStream: stream = VADStream(self) self._streams.add(stream) return streamA VAD implementation that relies on the accompanying ai-coustics :func:
~livekit.plugins.ai_coustics.audio_enhancementFrameProcessor instead of performing its own inference.Ancestors
- VAD
- abc.ABC
- EventEmitter
- typing.Generic
Instance variables
prop model : str-
Expand source code
@property def model(self) -> str: return "ai-coustics" prop provider : str-
Expand source code
@property def provider(self) -> str: return "ai-coustics"
Methods
def stream(self) ‑> VADStream-
Expand source code
def stream(self) -> VADStream: stream = VADStream(self) self._streams.add(stream) return stream
Inherited members
class VadSettings (*,
speech_hold_duration: typing.Optional[float],
sensitivity: typing.Optional[float],
minimum_speech_duration: typing.Optional[float])-
Expand source code
@dataclass class VadSettings: def __init__(self, *, speech_hold_duration:typing.Optional[float], sensitivity:typing.Optional[float], minimum_speech_duration:typing.Optional[float]): self.speech_hold_duration = speech_hold_duration self.sensitivity = sensitivity self.minimum_speech_duration = minimum_speech_duration def __str__(self): return "VadSettings(speech_hold_duration={}, sensitivity={}, minimum_speech_duration={})".format(self.speech_hold_duration, self.sensitivity, self.minimum_speech_duration) def __eq__(self, other): if self.speech_hold_duration != other.speech_hold_duration: return False if self.sensitivity != other.sensitivity: return False if self.minimum_speech_duration != other.minimum_speech_duration: return False return TrueVadSettings(*, speech_hold_duration: 'typing.Optional[float]', sensitivity: 'typing.Optional[float]', minimum_speech_duration: 'typing.Optional[float]')