Add audio generation config, refactor rep_announcer

- AudioConfig now includes rep_max_count and rep_audio_dir
- app/audio/generate.py uses config instead of hardcoded constants
- RepAnnouncer rewrote with pre-generated audio cache
- Supports Windows winsound, macOS afplay, Linux paplay/aplay
- Pin requirements back to mediapipe==0.10.21 with numpy<2
This commit is contained in:
2026-06-10 11:42:40 +08:00
parent 1f6c3f3de8
commit b45a8e2e85
5 changed files with 337 additions and 56 deletions
+9
View File
@@ -46,6 +46,15 @@ class AudioConfig:
rep_announcer_enabled: bool = True
rep_announcer_rate: int = 185
rep_announcer_volume: float = 1.0
rep_max_count: int = 200
rep_audio_dir: str = ""
@property
def resolved_audio_dir(self) -> Path:
"""返回语音文件目录的绝对路径"""
if self.rep_audio_dir:
return Path(self.rep_audio_dir)
return Path(__file__).resolve().parent.parent / "app" / "audio" / "reps"
@dataclass