Documentation

VoxLabs is a local Python desktop application (PySide6) with an optional FastAPI REST API and Model Context Protocol (MCP) server. This manual covers every feature, page, model engine, DSP stage, database table, and API endpoint in VoxLabs 3.1.0.

1. Installation & Quick Start

You can install VoxLabs using the prebuilt standalone desktop archives (no Python installation needed) or run it from source using Python 3.12–3.13 and uv.

Option A: Standalone Desktop Bundles

  1. Open the download section or GitHub Releases and download the archive for your OS.
  2. Windows (10 or later, x64): Run VoxLabs-Windows-x64-Setup.exe (no admin needed) or install VoxLabs-Windows-x64.msi. For a portable copy, extract VoxLabs-Windows-x64.zip and launch VoxLabs\VoxLabs.exe.
  3. macOS (13 Ventura or later, Apple Silicon): Open VoxLabs-macOS-arm64.dmg and drag VoxLabs.app to your Applications folder, or run VoxLabs-macOS-arm64.pkg.
  4. Linux (x86_64): Ubuntu/Debian: sudo apt install ./VoxLabs-Linux-x86_64.deb. Fedora: sudo dnf install ./VoxLabs-Linux-x86_64.rpm. Then start VoxLabs from the app menu or run voxlabs. For a portable copy, extract VoxLabs-Linux-x86_64.tar.gz and run VoxLabs/VoxLabs.
  5. Because community builds are not code-signed with a commercial certificate yet, confirm the first launch if Windows SmartScreen or macOS Gatekeeper prompts you.

Audio formats: WAV, FLAC, OGG, and MP3 work out of the box via libsndfile. Having ffmpeg on your system PATH is optional and enables M4A/AAC import and export.

Option B: Run from Source with uv

git clone https://github.com/nishanth-kj/VoxLabs.git
cd VoxLabs

# Base install (includes PySide6 UI, FastAPI, MCP, DSP enhancement, and MFCC voice profiles)
uv sync

# Recommended fast offline neural TTS engines (run well on CPU or GPU)
uv sync --extra piper --extra kokoro

# Optional heavy zero-shot cloning engines (mutually exclusive PyTorch dependencies; pick one):
uv sync --extra chatterbox       # Chatterbox TTS (MIT, zero-shot cloning + native emotion)

# Start the desktop application
uv run python -m app.main

First launch: Open the Models page and click Download All (or install Piper · en_US Lessac, 63 MB). Model weights are fetched directly from Hugging Face and stored under data/models/, even if a model's Python extra has not been installed yet. On slow connections, increase uv's timeout before syncing PyTorch wheels (e.g. in PowerShell: $env:UV_HTTP_TIMEOUT = "900"; uv sync --extra piper).

Environment Variables

VariableEffect
VOXLABS_DATA_DIRWhere the database, audio, voices, models, cache, and logs live (default ./data)
VOXLABS_DB_PATHOverride only the SQLite database file path (default data/database/voxlabs.db)
VOXLABS_API_TOKENRequire a Authorization: Bearer <token> header on the REST API and HTTP MCP server
LOG_LEVELInitial log level: DEBUG, INFO, WARNING, or ERROR (the Settings page can also change it)

2. Desktop Studio Pages & Keyboard Shortcuts

The VoxLabs window follows a modern VS Code–inspired layout:

  • Title Bar & Command Center: Displays the VoxLabs logo, the full application menu bar (File, Edit, View, Voice, Audio, Script, Tools, Help), a central search button that opens the Command Palette, and native-snapping window controls. Enable Settings → Appearance → Use the system title bar if you prefer your OS's native window frame.
  • Every Command in the Menu & Palette: Every action on every page is reachable from the top menu bar and searchable in the Command Palette (Ctrl+Shift+P or F1). Selecting a page command automatically navigates to that page and invokes its action.
  • Status Bar & Live Logs Panel: The bottom status bar shows the REST API / MCP server state (click to start or stop), active background jobs, and the Logs toggle (Ctrl+`) with live warning/error counts and source filters (ui, api, mcp, system).

Pages Reference

PageWhat It Does
Home (Ctrl+1)Quick-start workflow cards, recent generated/imported audio library, and one-click navigation into the editor or studio.
Studio (Ctrl+2)One script at a glance: section list, voice inspector, multi-take selector, interactive clip timeline over the rendered waveform, and transport controls.
Clone Voice (Ctrl+3)Guided workflow: import or record reference samples → automatic quality analysis table → attributed speaker consent form → cloning model picker → preview & save.
Generate Speech (Ctrl+4)Single or multi-sentence TTS with voice, built-in engine_voice, model, emotion, style, speed, pitch, energy, temperature, seed, inline pauses, pronunciations, and sentence regeneration.
Script to Audio (Ctrl+5)Plain-text script & lesson editor (autosaves after 0.8 s) with Structure, Speakers, Section overrides, and Script settings tabs.
Audio Editor (Ctrl+6)Non-destructive waveform editor with selection, cut/copy/paste/delete, trim, split, move, duplicate, join, silence, fade, gain, normalize, 8-stage DSP enhance, undo/redo, and loop playback.
Voices (Ctrl+7)Cloned voices plus every built-in preset: Piper Lessac (the default voice), all 54 Kokoro voices, all 9 Qwen3-TTS voices, and the Edge neural catalog. Preview, edit, export metadata, revoke, or delete.
Models (Ctrl+8)Download weights directly from Hugging Face (single model or Download All), load/unload into CPU or CUDA memory, run health checks, set defaults, and rescan data/models/.
Voice Editor (Ctrl+9)Edit a voice’s name, model, engine voice, and delivery (speed, pitch, energy, emotion, style). Preview it, then use that saved voice in Generate and script-to-audio.
Files (Ctrl+0)One place for every audio file: generated, imported, processed and edited audio, every export with its format and bitrate, and reference voice samples. Open folders, copy paths, play or re-edit.
MCPInspect the embedded Model Context Protocol server: live activity log of every tool call from AI apps, real-time duration, argument inspector, and copyable configs for Claude Desktop and Claude Code.
Settings (Ctrl+,)Configure default TTS/cloning models, compute device (auto/cpu/cuda), performance hardware presets, online engine opt-in, editor autosave, appearance/theme, native title bar, and embedded REST API + MCP server.

Keyboard Shortcuts

ShortcutCommand
Ctrl+Shift+P / F1Open the Command Palette to search and trigger any menu command
Ctrl+1 … Ctrl+0Switch between Home, Studio, Clone, Generate, Script, Editor, Voices, Models, Voice Editor, and Files (Ctrl+0)
Ctrl+0Open the Central Audio Library / Files page
Ctrl+,Open Settings
Ctrl+BCollapse or expand the navigation sidebar
Ctrl+`Toggle the bottom live Logs panel (with source filter & warning/error badges)
Ctrl+JOpen the Background Jobs monitor dialog
Ctrl+NCreate a new script on the Script to Audio page
Ctrl+O / Ctrl+IOpen an existing audio or import an audio file into the Audio Editor
SpacePlay / Pause transport in the Audio Editor
Ctrl+Z / Ctrl+Shift+ZUndo / Redo in focused text input or non-destructive Audio Editor
Ctrl+X / Ctrl+C / Ctrl+V / DelCut, Copy, Paste, or Delete selection in text box or Audio Editor
Ctrl+D / Ctrl+TDuplicate selection or Trim (crop) to selection in the Audio Editor
Ctrl+S / Ctrl+ERender pending edits as a new audio row / Export audio to WAV, FLAC, OGG, MP3, or M4A
F11 / Ctrl+QToggle Full Screen / Exit VoxLabs

3. Architecture, Packages & Background Work

VoxLabs is organized into a single Python package, app/, with strict separation of concerns. The PySide6 UI, the FastAPI REST routes, and the MCP tools all call the same service singletons—never touching SQLite or AI model backends directly.

PySide6 UI (app/ui)     REST API + MCP (app/api)   ← optional interfaces
          \                     /
           Services (app/services)                 ← all application logic & transactions
           /                    \
   Models (app/models)       Utils (app/utils)
           \                    /
          SQLite + files under data/

Package Map

PackageResponsibilities
app/main.pyDesktop entry point: initialize services, create QApplication and MainWindow, optionally start the embedded REST API + MCP server.
app/services/One service per domain: user, voice, clone, consent, tts, script, audio, model, job, system. Each exposes a module singleton (tts_service, …).
app/models/SQLAlchemy 2.0 tables (one file per table, no commits or workflow logic). models/request/ and models/response/ hold Pydantic request classes and ApiResponse.
app/utils/Technical infrastructure: database (engine, transaction(), serialize()), audio (I/O and DSP), ffmpeg, files, device, validation (Validation), model (AI backends), hashing, time, logger.
app/constants/Fixed values and BaseEnum classes: base_enum, status, consent_status, response_status, error_code, error_message, audio_source, model_type, model_backend, audio, jobs, models.
app/exceptions/AppError and subclasses (ValidationError, NotFoundError, ConsentError, VoiceError, AudioError, ModelError, JobError, AuthError, InternalError) + service_error().
app/api/FastAPI app (app.py), thin routers in routes/, and MCP server in mcp/ (tools.py, served over streamable HTTP at /mcp and over stdio with --stdio).
app/ui/main_window.py, 10 pages, shared widgets (title_bar, nav_bar, command_palette, player, waveform, timeline, log_panel, job_status), app_menu.py, theme.py, and icons.py.

How a Request Flows

  1. Clicking Generate on the Generate page builds a TTSRequest and calls tts_service.generate_async(body) (or POST /api/tts / MCP generate_speech calls tts_service.generate(body)).
  2. JobService.submit() records a jobs row (status = Pending) and dispatches the work on a background thread pool.
  3. TTSService.generate() validates input, resolves the voice via VoiceService.voice_ref() (checking consent), resolves the model via ModelService.resolve_speech_model(), loads the backend, synthesizes chunk-by-chunk, applies prosody and DSP clean-up, and registers an audios row inside a single transaction.
  4. Job progress and completion are written to SQLite and pushed to listeners. JobBridge turns updates into Qt signals so BasePage.follow() updates the progress bar on the UI thread without ever blocking Qt.

Errors & Logging: Every public service method wraps its body in try: ... except Exception as exc: raise service_error(exc, "<service>.<method>"). Known AppError subclasses pass through; unexpected exceptions are logged once with their traceback and converted into InternalError. app/utils/logger.py writes to stderr (keeping stdout clean for MCP stdio), the memory buffer for the bottom Logs panel, and rotating files in data/logs/voxlabs.log. Audio content, file bytes, and credentials are never logged.

4. Voice Cloning & Consent Lifecycle

Voice cloning is managed by CloneService, ConsentService, and VoiceService. Explicit, attributed consent is verified before any sample is processed.

samples → validate files → validate consent → select model
        → analyze + prepare samples (staging folder) → build profile
        → [one transaction: create voice → record consent → move samples in → store profile]
        → voice ready for TTS → preview
  1. Validate files (require_audio_file): Verifies each file exists, is non-empty, and has a supported extension (wav, mp3, flac, ogg, m4a, aac, opus).
  2. Validate consent (ConsentService.validate): Requires confirmed is True, plus non-empty granted_by and speaker_name. Runs before any audio work; nothing can bypass it.
  3. Select model: Uses the requested model_key or default_clone_model from Settings (must be an installed CLONE or EMBED model).
  4. Analyze (analyze_sample): Runs AudioService.analyze and blocks on samples shorter than 1 s or longer than 5 min, sample rates under 16 kHz, or more than 90% silence. Clipping, high noise floor, and low level are reported as warnings.
  5. Prepare samples: Resamples each file to 24 kHz mono, trims leading/trailing silence, peak-normalizes to −1 dBFS, and writes to a staging folder. Combined samples must provide at least 3 seconds of speech.
  6. Build profile (build_profile): Computes 13-band MFCC mean/std vectors and median fundamental frequency (pYIN) across all prepared samples.
  7. Atomic transaction: Creates the voices row, records the voice_consents row, moves prepared samples into data/voices/<voices_id>/samples/, and stores the profile. On any error, the database transaction rolls back and both staging and voice folders are removed.

Zero-Shot vs. Profile vs. Preset

Chatterbox, Chatterbox Turbo, Qwen3-TTS: Receive stored reference WAV paths for true zero-shot voice cloning (params.cloned = true).
Voice Profile (MFCC): Speaks through the default TTS model and shifts output pitch to match the speaker's median pitch (params.pitch_matched = true).
Preset Voices: Built-in engine speakers (e.g. Kokoro, Qwen3-TTS or Edge engine_voice, or the Chatterbox models' own voice); nobody is cloned, so consent_status = NotRequired.

Revoking vs. Deleting a Voice

Revoke (voice_service.revoke): (1) Deletes all sample files and the profile from disk, (2) marks consent rows Inactive with revoked_at, (3) sets voices.status = Inactive and consent_status = Revoked, and (4) blocks the voice from synthesis while keeping the row as an audit trail.
Delete (voice_service.delete): Removes the voice row, sample rows, consent rows, and disk folder completely.

5. Text to Speech (TTS) & Model Engines

text → validate → pronunciations → resolve voice → resolve model → load backend
     → chunk (sentence-aligned, [pause] tags; ≤ 400 chars, or the engine's own limit)
     → synthesize each chunk (one generation at a time per engine)
     → join with pauses → pitch-match (profile voices) → prosody DSP
     → save original WAV → clean-up steps → processed WAV → audios row (ai_generated)
  • Deterministic Cache (cache: true): Hashes text, speech parameters, resolved model, and voice update timestamp; returns the newest matching generated audio whose file still exists on disk with cached: true.
  • GPU OOM → CPU Fallback: When a model runs out of CUDA memory while loading (e.g. when a local LLM is running), VoxLabs frees CUDA cache and reloads the model on CPU automatically.
  • Fallback Models: When no model is explicitly requested and default_tts_model is not installed, VoxLabs uses the first installed model in FALLBACK_TTS_MODELS (chatterbox → chatterbox-turbo → qwen3-tts-0.6b → kokoro-82m → piper-en-us-lessac-medium).
  • Sentence-Level Regeneration: generate_sentences(text) creates one audio per sentence plus a joined result; regenerate_sentence(audios_ids, index) re-synthesizes a single sentence and rebuilds the joined audio.

TTS Parameters

ParameterRange / TypeNotes
voices_idint | nullCloned or preset voice ID. Omit it to use the engine's default voice.
engine_voiceshort idOne of the engine's built-in voices, e.g. Kokoro af_heart / af_bella / bm_george, Qwen3-TTS ryan / aiden / vivian / serena, or an Edge short name. Overrides the voice's own engine_voice.
model_keystring | nullResolved in order: explicit key → voice's own cloning model (if installed) → default_tts_model → first installed fallback model.
speed, pitch0.5 – 2.0Passed to the engine when supported natively; otherwise applied with float64 phase-vocoder DSP.
energy0.1 – 2.0Output gain multiplier with automatic peak protection.
emotion8 presetsneutral, happy, sad, angry, calm, excited, fearful, confident. Preset multiplier on speed/pitch/energy; Chatterbox handles emotion natively.
style6 presetsdefault, narration, conversational, lecture, news, storytelling. Adjusts speed and inter-sentence pause.
pause_ms≥ 0 msGap between chunks. You can also write [pause 800ms] or [pause 2s] inline in the text.
pronunciations{word: spoken}Whole-word case-insensitive replacement applied before synthesis.
temperature0.1 – 1.5Sampling temperature (Chatterbox, Chatterbox Turbo and Qwen3-TTS only).
seedintDeterministic generation seed (Chatterbox, Chatterbox Turbo and Qwen3-TTS only).
post / presetsteps | nameClean-up DSP steps or preset name. Default is trim_silence + normalize; {} means raw output.
cacheboolWhen true, returns an identical earlier generation matching text + settings + model + voice hash without re-synthesizing.

Engines Reference

BackendInstallExecutionNative Capabilities
Piperuv sync --extra piper + install on Models pageLocal CPU / GPU (63 MB)speed; direct ONNX weight download
Kokoro 82Muv sync --extra kokoro + install on Models pageLocal CPU / GPU (330 MB)speed; built-in voices via engine_voice (default af_heart)
Chatterboxuv sync --extra chatterbox (MIT)Local GPU rec. / CPU fallback (3.20 GB)emotion, temperature, seed; zero-shot cloning or built-in voice
Chatterbox Turbouv sync --extra chatterbox (MIT, same package)Local GPU rec. / CPU fallback (2.99 GB)temperature, seed; faster zero-shot cloning (sample over 5 s) or built-in voice
Qwen3-TTS 0.6BInstall on Models page (Apache-2.0; sets up its own engine environment with uv)Local helper process (4.15 GB: Base + CustomVoice)temperature, seed; zero-shot cloning or 9 built-in voices via engine_voice (default ryan), 10 languages
Voice Profile (MFCC)Built into base install (librosa)Local CPUExtracts MFCC + pYIN median pitch; pitch-matches default TTS output
Emotional (gTTS)Built into base installOnline (Google), opt-in onlyShaped with local prosody DSP afterwards
Edge NeuralBuilt into base installOnline (Microsoft), opt-in onlyspeed, pitch; preset voices via engine_voice (default en-US-AriaNeural)

6. Script & Lesson to Audio

ScriptService turns scripts, lessons, and multi-speaker dialogues into narrated audio with automatic chapter/section structure and per-section take management.

Lesson 1                       ← chapter  (Lesson/Chapter/Part/Unit/Module …, or "# Title")

Introduction                   ← heading  (Section/Topic/Scene/Introduction/Summary/Example …,
                                            "## Title", or a short Title Case line)
Welcome to today's lesson.     ← paragraph → one section

Teacher: What is a wave?       ← speaker line → one section (speaker "Teacher")
Student: I'm not sure.
It sounds hard.                ← continues the Student line

[pause 2s]                     ← a line on its own adds pause after the previous section
  • Automatic Pauses: parse_script(body, speak_headings=False) inserts 600 ms between paragraphs, 1200 ms at chapter/heading boundaries, plus any manual [pause …] lines. With speak_headings=True, headings are spoken aloud as sections.
  • 5-Step Voice Resolution Order: (1) Section's own voices_id → (2) speaker_map[speaker] → (3) speaker_map["*"] (narrator) → (4) default_voices_id setting → (5) Engine's default voice. Use auto_map_speakers() to assign available voices round-robin.
  • Script Settings: Stored in scripts.settings: model_key, speed, emotion, style, final mastering preset, speak_headings, intro_text, and outro_text.
  • Smart Takes & Rendering: Editing the script body re-parses it while keeping existing takes for any section whose (speaker, text) did not change. render(scripts_id) joins all selected takes with each section's pause, adds optional intro/outro, applies the final clean-up preset (e.g. Lesson at −16 LUFS), and stores the result as scripts.final_audios_id.

7. Audio Engine, DSP Pipeline & Waveform Editor

AudioService and app/utils/audio.py process audio as mono float32 and store working copies as 16-bit WAV. No operation ever overwrites an existing file:

  • Import: Copies the source file to audios.original_path and writes a WAV working copy to audios.path.
  • Processing & Rendered Edits: Create a new audios row with parent_audios_id pointing to the source audio.
  • Editor Autosave: Stores the pending non-destructive operation list directly on the audio row (audios.edit_ops via audio_service.save_edit_ops), so edits persist for every audio file.
  • Export & AI Labelling: export(audios_id, dest, fmt, sample_rate) writes WAV, FLAC, OGG, or MP3 via libsndfile and M4A via FFmpeg. AI-generated audio is tagged with comment="AI-generated by VoxLabs" and software="VoxLabs".

8-Stage Enhancement Pipeline

Steps always execute in this fixed order: trim_silence → denoise → eq → compress → deess → normalize → limit → loudness. Passing {"step": null} disables a step from a preset.

StepImplementationOptions
1. trim_silenceFrame RMS threshold with leading/trailing paddingthreshold_db, pad_ms
2. denoiseSTFT spectral gating against the quietest 15% of framesstrength (0 – 1)
3. eqRBJ biquad high-pass, presence peak (3 kHz), low peak, high shelfhighpass_hz, presence_db, low_db, high_db
4. compressRMS envelope follower with static compression curvethreshold_db, ratio, makeup_db
5. deessHigh-band (6 kHz) dynamic sibilance reductionfrequency, threshold_db, ratio
6. normalizePeak amplitude normalizationpeak_db
7. limit5 ms peak-hold gain envelope followed by hard ceilingceiling_db
8. loudnessK-weighted BS.1770-style gated loudness gain, then limitertarget_lufs, ceiling_db

Built-In Enhancement Presets

PresetProcessing Chain
RawNo DSP steps applied; preserves the exact raw waveform.
Voice CleanTrims silence, applies gentle spectral denoise, high-pass filter, and peak normalization.
PodcastDenoise, presence EQ boost, vocal compression, de-esser, limiter, and −16 LUFS broadcast loudness.
NarrationWarm EQ, smooth compression, de-esser, and −18 LUFS audiobook/narration loudness.
LessonClear speech intelligibility EQ, compression, and −16 LUFS loudness for educational content.
StudioFull 8-stage vocal mastering chain targeting −14 LUFS.

Non-Destructive Editor Operations (apply_edit_ops)

opFields (seconds)Description
delete / cutstart, endRemove the selected time range (cut also saves the selection to a clip).
crop / trimstart, endKeep only the selected time range and discard the rest.
insert / pasteat, clipInsert a saved WAV clip from save_clip() at the cursor timestamp.
appendclip, gapJoin another audio file onto the end with an optional silence gap.
silenceat, durationInsert pure silence of duration seconds at the cursor.
duplicatestart, endCopy the selected region immediately after itself.
movestart, end, toCut the selected region and insert it at timestamp to.
gain / volumestart, end, dbApply decibel gain adjustment over the selected region.
fade_in / fade_outstart, endApply a smooth fade-in or fade-out ramp over the selection.
normalizestart, end, peak_dbPeak-normalize the selected region to peak_db.
enhancestart, end, steps | presetRun any DSP preset or custom step dictionary on the selected region.

8. Database Schema, Status Enum & Transactions

VoxLabs uses SQLite through SQLAlchemy 2.0 (data/database/voxlabs.db) with WAL journaling and foreign keys enabled. Every table uses a plural name, an explicit <table>_id integer primary key, an integer status column backed by BaseEnum (Status.ACTIVE.code == 1, INACTIVE == 2, PENDING == 3, IN_PROGRESS == 4, COMPLETED == 5, FAILED == 6, CANCELLED == 7, DELETED == 8), plus timezone-aware UTC created_at and updated_at timestamps.

In-place upgrades: init_db() runs create_all() followed by idempotent steps in _upgrade(engine) (such as adding audios.edit_ops and removing the old projects table and columns).

TablePurposeColumns
usersLocal operator profilesusers_id, name, email, status, created_at, updated_at
voicesCloned or preset voicesvoices_id, users_id, name, language, model_key, source (clone/preset), engine_voice, consent_status, profile (JSON), storage_dir, sample_count
voice_samplesReference recordingsvoice_samples_id, voices_id, path, duration, sample_rate, quality (JSON), sha256
voice_consentsConsent audit trailvoice_consents_id, voices_id, granted_by, speaker_name, statement, granted_at, revoked_at
audiosEvery audio fileaudios_id, parent_audios_id, path, original_path, source, ai_generated, duration, sample_rate, channels, format, codec, file_size, loudness, params (JSON), edit_ops (JSON)
scriptsScripts and lessonsscripts_id, title, body, speaker_map, settings, final_audios_id
script_sectionsGeneratable script unitsscript_sections_id, scripts_id, position, chapter, heading, speaker, text, voice/speed/pitch/emotion/style overrides, pause_after_ms
takesRenditions of a sectiontakes_id, script_sections_id, audios_id, take_number, selected
jobsBackground work recordsjobs_id, users_id, job_type, title, progress, error, params, result, started_at, finished_at
modelsModel catalog statemodels_id, key, name, model_type, backend, version, size_mb, vram_mb, capabilities, online, installed_path
exportsExported files registryexports_id, audios_id, path, format, duration, file_size, status, created_at, updated_at
mcp_callsMCP tool invocation audit logmcp_calls_id, tool_name, arguments (JSON), result (JSON), error, duration_ms, source, status, created_at, updated_at

9. REST API & Model Context Protocol (MCP) Server

The REST API and MCP server expose the exact same services as the desktop app. Start them from Settings → REST API (or Tools → Run REST API and MCP Server) inside the desktop app, or run them from the command line:

uv run python -m app.api.app                   # REST + MCP over HTTP on 127.0.0.1:8942 (Swagger at /docs, MCP at /mcp)
uv run python -m app.api.app --stdio           # Same HTTP server + MCP over stdin/stdout for local MCP clients
uv run uvicorn app.api.app:app --reload        # Development server on 127.0.0.1:8000

Response Envelope, Single Save Endpoint & Error Codes

Every API response—including errors—returns HTTP 200 with the uniform ApiResponse JSON envelope (status: 1 for success, 0 for error). Each CRUD resource has a single POST /api/<resource> save endpoint: omit <table>_id to create, pass <table>_id to update, or pass <table>_id + "status": 8 (Status.DELETED.code) to delete.

{ "status": 1, "data": { ... }, "error": null }

{ "status": 0, "data": null, "error": {
    "error_code": 404,
    "error_message": "The requested item was not found.",
    "field": { "voices_id": "Voice 42 not found" }
} }
error_codeException ClassMeaning
400AppError, AudioErrorBad request or invalid domain operation
401AuthErrorMissing or invalid bearer API token
403ConsentErrorMissing, invalid, or revoked speaker consent
404NotFoundErrorRequested record or route was not found
409VoiceError, JobErrorConflict with current voice or job state
422ValidationErrorInvalid request field(s); field maps each field name to its message
500InternalErrorUnexpected exception (logged once via service_error(); stack traces are never returned)
503ModelErrorModel not installed, online engines disabled, or model load failure

All REST Endpoints

Method & PathRequest ClassService Call
GET /api/health, GET /api/presets—system_service.health() / presets()
POST /api/performance/presetPerformancePresetRequestsystem_service.apply_preset(name)
GET /api/users, GET /api/users/{id}—user_service.list_users() / get_user()
POST /api/usersUserRequestuser_service.save(body) (create / update / delete)
GET /api/voices, GET /api/voices/{id}—voice_service.list_voices() / get()
POST /api/voicesVoiceRequestvoice_service.save(body) (creates/updates/deletes preset voices)
POST /api/voices/cloneCloneRequest (multipart)clone_service.clone_upload(body)
POST /api/voices/analyzemultipart sampleclone_service.analyze_upload()
POST /api/voices/{id}/revoke, GET .../export—voice_service.revoke() / export_metadata()
POST /api/voices/{id}/samples, POST .../samples/{sid}/removemultipart audiovoice_service.attach_upload() / remove_sample()
POST /api/ttsTTSRequesttts_service.generate(body) / generate_async(body)
POST /api/tts/regenerateRegenerateRequesttts_service.regenerate(body)
GET /api/scripts, GET /api/scripts/{id}—script_service.list_scripts() / get()
POST /api/scriptsScriptRequestscript_service.save(body)
POST /api/scripts/{id}/generateGenerateScriptRequestscript_service.generate(id, body) / generate_async(id, body)
POST /api/scripts/sectionsSectionRequestscript_service.update_section(body)
POST /api/scripts/sections/{id}/generate, POST .../takes/{id}/select—script_service.generate_section() / select_take()
GET /api/audio, GET /api/audio/{id}, GET /api/audio/{id}/file—audio_service.list_audios() / get() / file download
GET /api/library—audio_service.list_library() (all audios, exports, samples)
POST /api/audio/importAudioImportRequest (multipart)audio_service.import_upload(body)
POST /api/audio/processAudioProcessRequestaudio_service.process(body) (steps/preset or editor ops list)
POST /api/audio/exportAudioExportRequestaudio_service.export(body), returns the exported file
GET /api/exports—export_service.list_exports()
GET /api/models, GET /api/models/{id}, GET .../health—model_service.list_models() / get() / health()
POST /api/models/install-all—model_service.install_all_async()
POST /api/models/{id}/install | load | unload—model_service.install_async() / load_async() / unload()
GET /api/jobs, GET /api/jobs/{id}, POST /api/jobs/{id}/cancel—job_service.list_jobs() / get_job() / cancel()

MCP Server Tools & Client Configuration

MCP tools in app/api/mcp/tools.py take the same Pydantic request classes and return the same {status, data, error} envelope. Voice cloning is intentionally omitted from MCP so consent always comes directly from a human speaker.

DomainMCP Tool Names
System & Usershealth, presets, apply_performance_preset, list_users, save_user
Voices & Speechlist_voices, get_voice, save_voice, generate_speech, regenerate_speech
Audio, Library & Exportslist_audio, get_audio, process_audio, export_audio, list_library, list_exports
Scriptslist_scripts, get_script, save_script, update_section, generate_script
Models & Jobslist_models, list_jobs, get_job, cancel_job
// MCP Client Config (Claude Desktop / Cursor / Windsurf / VS Code)
{
  "mcpServers": {
    "voxlabs": {
      "command": "uv",
      "args": ["run", "--directory", "C:/Projects/VoxLabs", "python", "-m", "app.api.app", "--stdio"]
    }
  }
}

# cURL Examples:
# 1. Create, update, and delete a user with the single save endpoint
curl -s -X POST 127.0.0.1:8942/api/users -H 'Content-Type: application/json' -d '{"name": "Ada"}'
curl -s -X POST 127.0.0.1:8942/api/users -H 'Content-Type: application/json' -d '{"users_id": 1, "email": "ada@example.com"}'
curl -s -X POST 127.0.0.1:8942/api/users -H 'Content-Type: application/json' -d '{"users_id": 1, "status": 8}'

# 2. Generate speech with emotion and built-in Kokoro voice
curl -s -X POST 127.0.0.1:8942/api/tts -H 'Content-Type: application/json' \
  -d '{"text": "Hello from VoxLabs.", "emotion": "calm", "engine_voice": "af_heart"}'

# 3. Clone a voice (consent fields are mandatory)
curl -s -X POST 127.0.0.1:8942/api/voices/clone \
  -F name="Narrator" -F consent=true -F granted_by="Jane Doe" -F speaker_name="Jane Doe" \
  -F samples=@jane.wav

# 4. Render a script in the background and poll the job
curl -s -X POST 127.0.0.1:8942/api/scripts/1/generate -H 'Content-Type: application/json' -d '{}'
curl -s 127.0.0.1:8942/api/jobs/12

10. Development, Testing & Adding Engines

uv run pytest                                     # Full suite (offscreen Qt + API + MCP + DSP, 0 warnings enforced)
uv run pytest tests/test_script_service.py -k render
uv run python scripts/build.py                    # Build standalone PyInstaller bundle into dist/VoxLabs/
docker build -t voxlabs-api --build-arg EXTRAS="piper kokoro" .

Adding a Feature

  1. Put logic in the service, validate with Validation, raise AppError subclasses, and wrap in service_error().
  2. Wrap multi-row writes in one with transaction() as session: block.
  3. Add a *_async wrapper using job_service.submit() for slow operations.
  4. Wire to UI via BasePage.run() / follow(), REST via app/api/routes/ returning ApiResponse(data).success(), and MCP via app/api/mcp/tools.py.

Adding a Model Engine

  1. Add an entry to MODEL_CATALOG in app/constants/models.py (with direct Hugging Face files URLs if applicable).
  2. Subclass ModelBackend in app/utils/model.py (lazy import inside load(), implement synthesize()).
  3. Register the class in _BACKENDS.
  4. Add the optional dependency extra in pyproject.toml and run uv lock.

Safety & Privacy Guarantees

Processing is local. Voice samples are never silently uploaded to external servers, online engines are opt-in only, every generated file is tagged AI-generated by VoxLabs, and revoking consent deletes voice data immediately. Read our Privacy Policy and Ethical AI Guidelines.