Complete implementation of the real-time Chinese-to-French translation system: Architecture: - 3-threaded pipeline: Audio capture → AI processing → UI rendering - Thread-safe queues for inter-thread communication - Configurable audio chunk sizes for latency tuning Core Features: - Audio capture with PortAudio (configurable sample rate/channels) - Whisper API integration for Chinese speech-to-text - Claude API integration for Chinese-to-French translation - ImGui real-time display with stop button - Full recording saved to WAV on stop Modules Implemented: - audio/: AudioCapture (PortAudio wrapper) + AudioBuffer (WAV export) - api/: WhisperClient + ClaudeClient (HTTP API wrappers) - ui/: TranslationUI (ImGui interface) - core/: Pipeline (orchestrates all threads) - utils/: Config (JSON/.env loader) + ThreadSafeQueue (template) Build System: - CMake with vcpkg for dependency management - vcpkg.json manifest for reproducible builds - build.sh helper script Configuration: - config.json: Audio settings, API parameters, UI config - .env: API keys (OpenAI + Anthropic) Documentation: - README.md: Setup instructions, usage, architecture - docs/implementation_plan.md: Technical design document - docs/SecondVoice.md: Project vision and motivation Next Steps: - Test build with vcpkg dependencies - Test audio capture on real hardware - Validate API integrations - Tune chunk size for optimal latency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
658 B
JSON
30 lines
658 B
JSON
{
|
|
"audio": {
|
|
"sample_rate": 16000,
|
|
"channels": 1,
|
|
"chunk_duration_seconds": 10,
|
|
"format": "wav"
|
|
},
|
|
"whisper": {
|
|
"model": "whisper-1",
|
|
"language": "zh",
|
|
"temperature": 0.0
|
|
},
|
|
"claude": {
|
|
"model": "claude-haiku-4-20250514",
|
|
"max_tokens": 1024,
|
|
"temperature": 0.3,
|
|
"system_prompt": "Tu es un traducteur professionnel chinois-français. Traduis le texte suivant de manière naturelle et contextuelle."
|
|
},
|
|
"ui": {
|
|
"window_width": 800,
|
|
"window_height": 600,
|
|
"font_size": 16,
|
|
"max_display_lines": 50
|
|
},
|
|
"recording": {
|
|
"save_audio": true,
|
|
"output_directory": "./recordings"
|
|
}
|
|
}
|