AS AgentScopeAPI 手册 / API Reference
类class agentscope.realtime

VADBase

class VADBase(ABC)
源码Source agentscope/realtime/_vad.py:15–48

语音活动检测基类,处理低延迟的实时语音与多模态交互。位于 agentscope.realtime 包,继承自 ABC。核心成员包括 push、reset。

Implementations are stateful: push is called with consecutive chunks and returns a transition only on the frame where it happens.

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
sample_rateint
`sample_rate` 字段。
—

方法摘要Method Summary

方法Method说明Description
def push(pcm: bytes) -> SpeechTransition | Noneabstractabstractmethod
设置推送。
Feed one chunk of audio and report a transition, if any.
def reset() -> Noneabstractabstractmethod
清空或重置内部状态。
Drop internal state. Called whenever the audio stream has a gap — a reconnect, or the microphone being unmuted — since the silence counters carried across it would be stale.

属性详情Attribute Detail

sample_rate

int

sample_rate 字段。声明为 int。

The sample rate field.

源码Source agentscope/realtime/_vad.py:22

方法详情Method Detail

push

def push(pcm: bytes) -> SpeechTransition | None
abstractabstractmethod

设置推送。

This is an edge detector, not a level query: it returns a value only on the chunk where speech starts or stops.

参数Parameters
名称Name类型Type说明Description
pcmbytespcm(类型 `bytes`)。PCM16 mono audio at :attr:`sample_rate`.
返回Returns SpeechTransition | None
返回SpeechTransition|None。`SpeechTransition | None`:
源码Source agentscope/realtime/_vad.py:26–42

reset

def reset() -> None
abstractabstractmethod

清空或重置内部状态。

Drop internal state.

返回Returns None
无返回值。No value is returned.
源码Source agentscope/realtime/_vad.py:45–48
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.