# voicebox - Current State Overview **Last Updated:** January 25, 2026 **Status:** โœ… MVP Core Features Working - Voice generation from Tauri app successful! --- ## ๐ŸŽฏ What We Have ### โœ… **Fully Implemented & Working** #### **Backend (Python FastAPI)** - **Voice Profile Management** - Create, read, update, delete profiles - Add multiple audio samples per profile - Multi-reference voice combination (combines multiple samples) - Profile storage in SQLite + file system (`data/profiles/`) - **Voice Generation** - Qwen3-TTS model integration (1.7B and 0.6B support) - Automatic model downloading from HuggingFace Hub - Voice prompt caching for instant re-generation - Support for English and Chinese - Seed-based reproducibility - GPU/CPU/MPS device detection - **Generation History** - Full CRUD operations - Search by text content - Filter by profile - Pagination support - Statistics endpoint - Audio file storage (`data/generations/`) - **Audio Transcription** - Whisper integration for speech-to-text - Language detection/selection - Used for reference text extraction from samples - **Database** - SQLite with SQLAlchemy ORM - Tables: `profiles`, `profile_samples`, `generations`, `projects` (ready for future) - Automatic schema initialization - **API Endpoints** - RESTful API with FastAPI - OpenAPI schema generation - CORS enabled - Health check endpoint - File serving for audio files #### **Frontend (React + TypeScript + Tauri)** - **Voice Profile UI** - Profile list with cards - Create/edit profile dialog - Upload audio samples with transcription - Sample management (view/delete) - Profile detail view - **Generation UI** - Form with profile selection - Text input (up to 5000 chars) - Language selection (en/zh) - Optional seed input - Loading states and error handling - **History UI** - Table view with pagination - Search functionality - Play audio inline - Download audio files - Delete generations - **Server Settings** - Connection form (local/remote mode) - Server status display - Health check integration - **State Management** - React Query for server state - Zustand for client state (server URL, connection status) - Type-safe API client - **UI Components** - shadcn/ui component library - Tailwind CSS styling - Responsive design - Toast notifications - Form validation with Zod #### **Tauri Desktop App** - **Rust Backend** - Sidecar management for Python server - Start/stop server commands - Remote mode support (0.0.0.0 binding) - Process lifecycle management - **Build System** - Tauri v2 configuration - Platform-specific builds - Dev tools in debug mode --- ## ๐Ÿ—๏ธ Architecture ### **Project Structure** ``` voicebox/ โ”œโ”€โ”€ app/ # Shared React frontend โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”‚ โ”œโ”€โ”€ components/ # React components โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ VoiceProfiles/ โœ… Complete โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Generation/ โœ… Complete โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ History/ โœ… Complete โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ ServerSettings/ โœ… Complete โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ AudioStudio/ ๐Ÿ“ฆ Placeholder (future) โ”‚ โ”‚ โ”œโ”€โ”€ lib/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ api/ # Type-safe API client โœ… โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ hooks/ # React Query hooks โœ… โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ utils/ # Utilities โœ… โ”‚ โ”‚ โ””โ”€โ”€ stores/ # Zustand stores โœ… โ”‚ โ”œโ”€โ”€ backend/ # Python FastAPI server โ”‚ โ”œโ”€โ”€ main.py # FastAPI app + routes โœ… โ”‚ โ”œโ”€โ”€ models.py # Pydantic models โœ… โ”‚ โ”œโ”€โ”€ database.py # SQLAlchemy ORM โœ… โ”‚ โ”œโ”€โ”€ profiles.py # Profile management โœ… โ”‚ โ”œโ”€โ”€ history.py # History management โœ… โ”‚ โ”œโ”€โ”€ tts.py # Qwen3-TTS integration โœ… โ”‚ โ”œโ”€โ”€ transcribe.py # Whisper integration โœ… โ”‚ โ”œโ”€โ”€ studio.py # Audio studio (future) โ”‚ โ””โ”€โ”€ utils/ โ”‚ โ”œโ”€โ”€ audio.py # Audio processing โœ… โ”‚ โ”œโ”€โ”€ cache.py # Voice prompt caching โœ… โ”‚ โ””โ”€โ”€ validation.py # Validation helpers โœ… โ”‚ โ”œโ”€โ”€ tauri/ # Tauri desktop wrapper โ”‚ โ”œโ”€โ”€ src/ # React entry point โœ… โ”‚ โ””โ”€โ”€ src-tauri/ # Rust backend โœ… โ”‚ โ””โ”€โ”€ src/main.rs # Sidecar management โœ… โ”‚ โ”œโ”€โ”€ data/ # User data directory โ”‚ โ”œโ”€โ”€ profiles/ # Profile audio samples โ”‚ โ”œโ”€โ”€ generations/ # Generated audio files โ”‚ โ”œโ”€โ”€ cache/ # Cached voice prompts โ”‚ โ””โ”€โ”€ voicebox.db # SQLite database โ”‚ โ””โ”€โ”€ scripts/ # Build & generation scripts โ”œโ”€โ”€ generate-api.sh # OpenAPI client generation โ””โ”€โ”€ build-server.sh # Python binary build ``` ### **Data Flow** ``` User Action (Tauri App) โ†“ React Component (Form Submit) โ†“ React Query Hook (useGeneration) โ†“ API Client (apiClient.generateSpeech) โ†“ HTTP Request โ†’ FastAPI Backend โ†“ Backend Route Handler (/generate) โ†“ Business Logic: 1. Get profile from DB 2. Create voice prompt (with caching) 3. Generate audio with Qwen3-TTS 4. Save audio file 5. Create history entry โ†“ Response (GenerationResponse) โ†“ React Query Cache Update โ†“ UI Refresh (History table updates) ``` ### **Key Technologies** | Layer | Technology | Purpose | |-------|-----------|---------| | **Desktop Framework** | Tauri v2 | Native desktop app wrapper | | **Frontend Framework** | React 18 | UI components | | **Language** | TypeScript | Type safety | | **Styling** | Tailwind CSS | Utility-first CSS | | **UI Components** | shadcn/ui | Component library | | **State Management** | React Query + Zustand | Server & client state | | **Form Handling** | React Hook Form + Zod | Form validation | | **Backend Framework** | FastAPI | Async REST API | | **Database** | SQLite + SQLAlchemy | Data persistence | | **ML Models** | Qwen3-TTS + Whisper | Voice cloning + transcription | | **Audio Processing** | librosa + soundfile | Audio I/O and processing | | **Package Manager** | Bun | Fast JS/TS package management | | **Build Tool** | Vite | Frontend bundling | --- ## ๐Ÿ”‘ Key Features & Capabilities ### **1. Voice Profile System** - **Multi-sample support**: Add multiple audio samples per profile - **Automatic combination**: Multiple samples are combined for better quality - **Voice prompt caching**: Re-use voice prompts for instant re-generation - **Audio validation**: Ensures samples meet quality requirements ### **2. Generation Pipeline** - **Lazy model loading**: Model loads on first use - **Device detection**: Automatically uses GPU if available - **Caching layer**: Voice prompts cached by audio hash + text - **Error handling**: Graceful degradation and clear error messages ### **3. History & Search** - **Full-text search**: Search generations by text content - **Pagination**: Efficient loading of large histories - **Audio playback**: Inline audio player - **File management**: Download and delete operations ### **4. Server/Client Architecture** - **Local mode**: Backend runs alongside Tauri app - **Remote mode**: Connect to remote GPU machine - **One-click server**: Start server from UI - **Connection management**: Persistent server URL storage --- ## ๐Ÿ“Š Database Schema ### **Tables** ```sql -- Voice Profiles profiles - id (PK, UUID) - name (unique) - description - language (en/zh) - created_at - updated_at -- Profile Samples profile_samples - id (PK, UUID) - profile_id (FK โ†’ profiles.id) - audio_path - reference_text -- Generations generations - id (PK, UUID) - profile_id (FK โ†’ profiles.id) - text - language - audio_path - duration (seconds) - seed (optional) - created_at -- Projects (ready for future) projects - id (PK, UUID) - name - data (JSON) - created_at - updated_at ``` --- ## ๐ŸŽจ UI Components Status | Component | Status | Features | |-----------|--------|----------| | **ProfileList** | โœ… Complete | List, create, empty state | | **ProfileCard** | โœ… Complete | Display profile info | | **ProfileForm** | โœ… Complete | Create/edit dialog | | **ProfileDetail** | โœ… Complete | View samples, add samples | | **SampleUpload** | โœ… Complete | File upload + transcription | | **GenerationForm** | โœ… Complete | Full generation form | | **HistoryTable** | โœ… Complete | Table, search, pagination, play/download | | **ConnectionForm** | โœ… Complete | Server URL input | | **ServerStatus** | โœ… Complete | Health check display | | **AudioStudio** | ๐Ÿ“ฆ Placeholder | Timeline editor (future) | --- ## ๐Ÿ”Œ API Endpoints ### **Profiles** - `POST /profiles` - Create profile - `GET /profiles` - List all profiles - `GET /profiles/{id}` - Get profile - `PUT /profiles/{id}` - Update profile - `DELETE /profiles/{id}` - Delete profile - `POST /profiles/{id}/samples` - Add sample - `GET /profiles/{id}/samples` - List samples - `DELETE /profiles/samples/{id}` - Delete sample ### **Generation** - `POST /generate` - Generate speech ### **History** - `GET /history` - List generations (with filters) - `GET /history/{id}` - Get generation - `DELETE /history/{id}` - Delete generation - `GET /history/stats` - Get statistics ### **Transcription** - `POST /transcribe` - Transcribe audio ### **Audio** - `GET /audio/{id}` - Serve audio file ### **Health** - `GET /health` - Health check with model status ### **Model Management** - `POST /models/load` - Load TTS model - `POST /models/unload` - Unload TTS model --- ## ๐Ÿš€ What's Next (Planned Features) ### **Phase 2: Advanced Features** - [ ] Multi-reference voice combination UI - [ ] Batch generation (multiple variations) - [ ] Advanced audio normalization - [ ] Export options (MP3, OGG, etc.) - [ ] M3GAN voice effect ### **Phase 3: Audio Studio** - [ ] Timeline-based audio editor - [ ] Word-level timestamps - [ ] Project system (save/load sessions) - [ ] Audio effects and filters - [ ] Multi-track editing ### **Phase 4: Voice Design** - [ ] Text-to-voice (no reference needed) - [ ] Preset voices with style control - [ ] Conversation mode (multi-speaker) - [ ] Custom audio effects library --- ## ๐Ÿ“ Code Quality Standards - โœ… **Type safety**: TypeScript strict mode, Pydantic models - โœ… **Modular architecture**: No files over 500 lines - โœ… **Error handling**: Comprehensive error messages - โœ… **Caching**: Voice prompt caching for performance - โœ… **Database**: SQLAlchemy ORM with proper relationships - โœ… **API design**: RESTful with OpenAPI schema - โœ… **UI/UX**: Responsive, accessible, loading states --- ## ๐Ÿงช Testing Status - โœ… **Manual testing**: Voice generation working end-to-end - ๐Ÿ“ฆ **Unit tests**: Not yet implemented - ๐Ÿ“ฆ **Integration tests**: Not yet implemented - ๐Ÿ“ฆ **E2E tests**: Not yet implemented --- ## ๐Ÿ“ฆ Dependencies ### **Backend** - FastAPI - Web framework - SQLAlchemy - ORM - Pydantic - Validation - Qwen3-TTS - Voice cloning model - Whisper - Speech recognition - librosa - Audio processing - soundfile - Audio I/O - PyTorch - ML framework ### **Frontend** - React 18 - UI framework - TypeScript - Type safety - React Query - Server state - Zustand - Client state - React Hook Form - Forms - Zod - Schema validation - Tailwind CSS - Styling - shadcn/ui - Components - Lucide React - Icons ### **Desktop** - Tauri v2 - Desktop framework - Rust - System backend --- ## ๐ŸŽฏ Current Capabilities Summary โœ… **Working End-to-End:** 1. Create voice profiles with audio samples 2. Generate speech from text using cloned voices 3. View and manage generation history 4. Play and download generated audio 5. Search and filter history 6. Connect to local or remote backend 7. Automatic model downloading 8. Voice prompt caching for speed ๐ŸŽ‰ **You just successfully generated voice from the Tauri app!** --- ## ๐Ÿ” Key Files Reference ### **Backend Core** - `backend/main.py` - FastAPI app and routes - `backend/tts.py` - Qwen3-TTS model wrapper - `backend/profiles.py` - Profile business logic - `backend/history.py` - History business logic - `backend/database.py` - Database models ### **Frontend Core** - `app/src/App.tsx` - Main app component - `app/src/lib/api/client.ts` - API client - `app/src/lib/hooks/` - React Query hooks - `app/src/stores/` - Zustand stores ### **Tauri** - `tauri/src-tauri/src/main.rs` - Rust backend - `tauri/src/main.tsx` - React entry point --- ## ๐Ÿ’ก Development Workflow 1. **Start backend**: `bun run dev:backend` (or via Tauri) 2. **Start frontend**: `bun run dev` (Tauri) or `bun run dev:web` (web) 3. **Generate API client**: `bun run generate:api` (after backend changes) 4. **Build server binary**: `bun run build:server` (for Tauri bundling) --- **Ready to build more features! ๐Ÿš€**