feat: establish voice assistant V1 baseline
This commit is contained in:
63
src/voice_assistant/audio/models.py
Normal file
63
src/voice_assistant/audio/models.py
Normal file
@@ -0,0 +1,63 @@
|
||||
"""
|
||||
Canonical audio models for the Voice Assistant.
|
||||
|
||||
Purpose:
|
||||
Define the provider-independent audio format used internally by
|
||||
the Voice Core.
|
||||
|
||||
Responsibilities:
|
||||
- Describe an audio format in a typed structure.
|
||||
- Define the canonical audio format used by the Voice Core.
|
||||
- Provide a shared audio contract for transports and providers.
|
||||
|
||||
Non-responsibilities:
|
||||
- Encoding or decoding audio.
|
||||
- Resampling audio.
|
||||
- Converting provider-specific audio formats.
|
||||
- Managing WebSocket audio frames.
|
||||
- Performing STT or TTS operations.
|
||||
|
||||
Architecture:
|
||||
Client / Transport
|
||||
|
|
||||
v
|
||||
Canonical Audio
|
||||
PCM S16LE / 16 kHz / mono
|
||||
|
|
||||
v
|
||||
Voice Core
|
||||
|
|
||||
+-----+-----+
|
||||
| |
|
||||
v v
|
||||
STT TTS
|
||||
Adapter Adapter
|
||||
|
||||
Provider-specific format conversion, when required, belongs
|
||||
inside the corresponding provider adapter.
|
||||
"""
|
||||
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class AudioFormat(BaseModel):
|
||||
"""
|
||||
Describe one PCM audio format.
|
||||
|
||||
This model is independent from WebSocket, STT, TTS, or any
|
||||
concrete provider.
|
||||
"""
|
||||
|
||||
encoding: Literal["pcm_s16le"]
|
||||
sample_rate: int
|
||||
channels: int
|
||||
|
||||
|
||||
CANONICAL_AUDIO_FORMAT = AudioFormat(
|
||||
encoding="pcm_s16le",
|
||||
sample_rate=16000,
|
||||
channels=1,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user