类class
agentscope.realtimeVADBase
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_rate | int | `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
intsample_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 |
|---|---|---|
pcm | bytes | pcm(类型 `bytes`)。PCM16 mono audio at :attr:`sample_rate`. |
SpeechTransition | None
返回SpeechTransition|None。`SpeechTransition | None`:
源码Source
agentscope/realtime/_vad.py:26–42reset
def reset() -> None
abstractabstractmethod
清空或重置内部状态。
Drop internal state.
None
无返回值。No value is returned.
源码Source
agentscope/realtime/_vad.py:45–48