Loading...
Loading...
Compare original and translation side by side
src/pipecat/audio/vad/vad_analyzer.pyVADAnalyzerclass ClassNamesrc/pipecat/__init______str____repr____post_init__src/pipecat/audio/vad/vad_analyzer.pyVADAnalyzersrc/pipecat/class ClassName__init______str____repr____post_init__"""[One-line description of module purpose].
[Optional: Longer explanation of functionality, key classes, or use cases.]
""""""Neuphonic text-to-speech service implementations.
This module provides WebSocket and HTTP-based integrations with Neuphonic's
text-to-speech API for real-time audio synthesis.
""""""[模块用途的一行描述]。
[可选:对功能、核心类或使用场景的详细说明。]
""""""Neuphonic文本转语音服务实现。
本模块提供基于WebSocket和HTTP的Neuphonic文本转语音API集成,用于实时音频合成。
"""class ClassName:
"""One-line summary describing what the class does.
[Longer description explaining purpose, behavior, and key features.
Use action-oriented language.]
[Optional: Event handlers, usage notes, or important caveats.]
"""class FrameProcessor(BaseObject):
"""Base class for all frame processors in the pipeline.
Frame processors are the building blocks of Pipecat pipelines, they can be
linked to form complex processing pipelines. They receive frames, process
them, and pass them to the next or previous processor in the chain.
Event handlers available:
- on_before_process_frame: Called before a frame is processed
- on_after_process_frame: Called after a frame is processed
Example::
@processor.event_handler("on_before_process_frame")
async def on_before_process_frame(processor, frame):
...
@processor.event_handler("on_after_process_frame")
async def on_after_process_frame(processor, frame):
...
"""Example::class ClassName:
"""描述类功能的一行摘要。
[对用途、行为和核心特性的详细说明。使用面向动作的语言。]
[可选:事件处理器、使用说明或重要注意事项。]
"""class FrameProcessor(BaseObject):
"""管道中所有帧处理器的基类。
帧处理器是Pipecat管道的构建块,它们可以链接起来形成复杂的处理管道。帧处理器接收帧、处理帧,并将其传递给链中的下一个或上一个处理器。
可用的事件处理器:
- on_before_process_frame:在处理帧之前调用
- on_after_process_frame:在处理帧之后调用
示例::
@processor.event_handler("on_before_process_frame")
async def on_before_process_frame(processor, frame):
...
@processor.event_handler("on_after_process_frame")
async def on_after_process_frame(processor, frame):
...
"""Example::__init____init__def __init__(self, *, param1: Type, param2: Type = default, **kwargs):
"""Initialize the [ClassName].
Args:
param1: Description of param1 and its purpose.
param2: Description of param2. Defaults to [default].
**kwargs: Additional arguments passed to parent class.
"""def __init__(
self,
*,
api_key: str,
voice_id: Optional[str] = None,
sample_rate: Optional[int] = 22050,
**kwargs,
):
"""Initialize the Neuphonic TTS service.
Args:
api_key: Neuphonic API key for authentication.
voice_id: ID of the voice to use for synthesis.
sample_rate: Audio sample rate in Hz. Defaults to 22050.
**kwargs: Additional arguments passed to parent InterruptibleTTSService.
"""def __init__(self, *, param1: Type, param2: Type = default, **kwargs):
"""初始化[ClassName]。
参数:
param1: param1的描述及其用途。
param2: param2的描述。默认为[default]。
**kwargs: 传递给父类的额外参数。
"""def __init__(
self,
*,
api_key: str,
voice_id: Optional[str] = None,
sample_rate: Optional[int] = 22050,
**kwargs,
):
"""初始化Neuphonic TTS服务。
参数:
api_key: 用于身份验证的Neuphonic API密钥。
voice_id: 用于合成的语音ID。
sample_rate: 音频采样率(单位:Hz)。默认为22050。
**kwargs: 传递给父类InterruptibleTTSService的额外参数。
"""async def method_name(self, param1: Type) -> ReturnType:
"""One-line summary of what method does.
[Longer description if behavior isn't obvious.]
Args:
param1: Description of param1.
Returns:
Description of return value.
Raises:
ExceptionType: When this exception is raised.
"""async def put(self, item: Tuple[Frame, FrameDirection, FrameCallback]):
"""Put an item into the priority queue.
System frames (`SystemFrame`) have higher priority than any other
frames. If a non-frame item is provided it will have the highest priority.
Args:
item: The item to enqueue.
"""async def method_name(self, param1: Type) -> ReturnType:
"""方法功能的一行摘要。
[如果行为不明显,则添加详细说明。]
参数:
param1: param1的描述。
返回:
返回值的描述。
异常:
ExceptionType: 触发该异常的场景。
"""async def put(self, item: Tuple[Frame, FrameDirection, FrameCallback]):
"""将项目放入优先级队列。
系统帧(`SystemFrame`)的优先级高于其他所有帧。如果传入非帧项目,它将拥有最高优先级。
参数:
item: 要入队的项目。
"""@dataclass
class ConfigName:
"""One-line description of configuration.
[Explanation of when/how to use this config.]
Parameters:
field1: Description of field1.
field2: Description of field2. Defaults to [default].
"""
field1: Type
field2: Type = default_value@dataclass
class FrameProcessorSetup:
"""Configuration parameters for frame processor initialization.
Parameters:
clock: The clock instance for timing operations.
task_manager: The task manager for handling async operations.
observer: Optional observer for monitoring frame processing events.
"""
clock: BaseClock
task_manager: BaseTaskManager
observer: Optional[BaseObserver] = None@dataclass
class ConfigName:
"""配置用途的一行描述。
[对配置使用场景/方式的说明。]
参数:
field1: field1的描述。
field2: field2的描述。默认为[default]。
"""
field1: Type
field2: Type = default_value@dataclass
class FrameProcessorSetup:
"""帧处理器初始化的配置参数。
参数:
clock: 用于计时操作的时钟实例。
task_manager: 用于处理异步操作的任务管理器。
observer: 用于监控帧处理事件的可选观察者。
"""
clock: BaseClock
task_manager: BaseTaskManager
observer: Optional[BaseObserver] = Noneclass EnumName(Enum):
"""One-line description of the enum purpose.
[Longer description of how the enum is used.]
Parameters:
VALUE1: Description of VALUE1.
VALUE2: Description of VALUE2.
"""
VALUE1 = 1
VALUE2 = 2class EnumName(Enum):
"""枚举用途的一行描述。
[对枚举使用方式的详细说明。]
参数:
VALUE1: VALUE1的描述。
VALUE2: VALUE2的描述。
"""
VALUE1 = 1
VALUE2 = 2on_speech_startedVADAnalyzerVADAnalyzeron_speech_started"""[Description].
.. deprecated:: X.X.X
`ClassName` is deprecated and will be removed in a future version.
Use `NewClassName` instead.
""""""[描述]。
.. deprecated:: X.X.X
`ClassName` 已弃用,将在未来版本中移除。
请改用 `NewClassName`。
"""__init_____init___