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>
51 lines
1.1 KiB
Bash
51 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# Build script for SecondVoice
|
|
|
|
set -e
|
|
|
|
# Colors
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo "SecondVoice Build Script"
|
|
echo "======================="
|
|
echo ""
|
|
|
|
# Check if vcpkg is set
|
|
if [ -z "$VCPKG_ROOT" ]; then
|
|
echo -e "${RED}Error: VCPKG_ROOT not set${NC}"
|
|
echo "Please install vcpkg and set VCPKG_ROOT environment variable:"
|
|
echo " git clone https://github.com/microsoft/vcpkg.git"
|
|
echo " cd vcpkg && ./bootstrap-vcpkg.sh"
|
|
echo " export VCPKG_ROOT=\$(pwd)"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "${GREEN}vcpkg found at: $VCPKG_ROOT${NC}"
|
|
echo ""
|
|
|
|
# Check if .env exists
|
|
if [ ! -f ".env" ]; then
|
|
echo -e "${RED}Warning: .env file not found${NC}"
|
|
echo "Please create .env from .env.example and add your API keys"
|
|
echo " cp .env.example .env"
|
|
echo ""
|
|
fi
|
|
|
|
# Configure
|
|
echo "Configuring CMake..."
|
|
cmake -B build -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
|
|
|
|
# Build
|
|
echo ""
|
|
echo "Building..."
|
|
cmake --build build -j$(nproc)
|
|
|
|
echo ""
|
|
echo -e "${GREEN}Build successful!${NC}"
|
|
echo ""
|
|
echo "To run the application:"
|
|
echo " cd build"
|
|
echo " ./SecondVoice"
|