# Phase 2: 로컬 STT 연동 (Whisper) + 핫키 ## 목표 마이크 캡처된 오디오를 로컬 Whisper 모델로 전사하고, 글로벌 핫키로 녹음을 제어할 수 있는 상태. ## 태스크 ### 2.1 LocalSTTService - `src/main/services/LocalSTTService.ts` - faster-whisper Python sidecar 관리 (spawn/kill) - 또는 whisper.cpp Node addon 직접 호출 - PCM 16kHz mono → Whisper → 텍스트 - Speakly 패턴: 이중 조건 플러시 (모델 로딩 + 오디오 버퍼링 병렬) - EventEmitter: 'transcription-delta', 'transcription-complete' ### 2.2 VoiceModeService (오케스트레이터) - `src/main/services/VoiceModeService.ts` - Speakly 패턴 적용: - RecognitionState 상태 머신 (IDLE→PREPARING→READY→RECOGNIZING→COMPLETED) - AudioState 별도 추적 - _isInTerminalState() 체크 - errorEmitted 플래그 - 오디오 무손실 버퍼링 (STT 준비 전 버퍼) - 모드: dictation (hold-to-talk), hands-free (toggle) ### 2.3 글로벌 핫키 - uiohook-napi로 글로벌 키보드 후킹 - 기본 트리거: Right Alt (Windows) - Speakly 패턴: pressed/released 이벤트, 더블프레스 감지 (300ms), 최소 700ms - HotkeyService + HotkeyConfig ### 2.4 IPC 채널 추가 - `voice:startRecording`, `voice:stopRecording` - `stt:getStatus`, `stt:getModels` - `hotkey:getDictationShortcut`, `hotkey:setDictationShortcut` ## Speakly RE 참조 - VoiceRecognitionService: 상태 머신, 이중 조건 플러시, 재연결 3계층 - VoiceModeService: 오케스트레이션, 모드별 핫키 처리 - HotkeyConfig: 키코드 맵, 시스템 예약 단축키 블랙리스트 ## 완료 조건 - [ ] 핫키로 녹음 시작/종료 가능 - [ ] Whisper로 한국어 음성 전사 작동 - [ ] 상태 머신 정상 전이 - [ ] 오디오 버퍼링/플러시 정상 작동