Downloads · 30 days
0
simonlesaumon/voice-protection-gateway-private
voice-protection-gateway-private is a machine learning model from simonlesaumon. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Voice Protection Gateway is a CPU-first V0 for creators who want to process a voice recording before publishing it.
Downloads · 30 days
0
Access
Public
Updated Jun 14, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py146 KB · 39%
From the Hugging Face model README
Voice Protection Gateway is a CPU-first V0 for creators who want to process a voice recording before publishing it.
Reduce voice cloning risk and add traceable evidence before publishing.
This system does not make a voice impossible to clone. It provides layered risk reduction, fallback watermark evidence, non-consent metadata, reports, and local red-team checks. It must not be presented as perfect protection.
The V0 flow is:
.wav, .mp3, .m4a, and .flac
files and creates a local job.protected.wav receives a deterministic HMAC-based PCM
fallback watermark. Verification compares uploaded audio against known report
watermark messages.AUDIOSEAL_BACKEND=audioseal is explicitly set. The fallback watermark
remains active either way.c2patool to create real Content Credentials when
explicitly configured.mock
backend exists for tests, and the Phase 12 speechbrain backend supports
real ECAPA-TDNN scoring only when explicitly enabled. No model is downloaded
automatically.ffmpeg exists,
resampling, trimming, and fallback watermark re-verification.Outputs are written locally under data/, outputs/, reports/, and logs/.
Linux CPU-only prerequisites:
ffmpegSetup:
cp .env.example .env
cd backend
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
cd ../frontend
npm ci
Optional SpeechBrain/ECAPA dependencies:
cd backend
source .venv/bin/activate
python -m pip install -r requirements-ml.txt
The real SpeechBrain and AudioSeal backends remain opt-in. Keep
ALLOW_MODEL_DOWNLOADS=false unless you intentionally want to download
configured models, or point model variables at local paths.
Run from the repository root:
cd backend
source .venv/bin/activate
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000
Health check:
curl http://localhost:8000/health
Main API:
GET /readyGET /api/configPOST /api/uploadPOST /api/jobs/{id}/processGET /api/jobs/{id}GET /api/jobs/{id}/downloadGET /api/jobs/{id}/report.jsonGET /api/jobs/{id}/report.htmlPOST /api/verifyRun from the repository root:
cd frontend
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000 npm run dev -- --port 3000
Open:
http://localhost:3000
Build check:
cd frontend
npm run build
cp .env.example .env
docker compose up --build
Ports:
http://localhost:8000http://localhost:3000The backend image installs ffmpeg. Compose mounts local data/, outputs/,
logs/, and reports/ into the backend container.
Cloud deployment notes are in docs/deploy_cloud.md.
Run commands from backend/ with the virtualenv activated.
Protect:
python -m app.cli.protect ./sample.wav --profile fast --out ./out
Verify:
python -m app.cli.verify ./out/protected.wav --report ./out/report.json
Benchmark:
python -m app.cli.benchmark ./data/benchmark/input --profile fast --out ./outputs/benchmark
The benchmark writes benchmark_results.json and benchmark_results.csv.
From the repository root:
./scripts/run_dev.sh
./scripts/test_all.sh
./scripts/smoke_cli.sh
./scripts/clean_outputs.sh
clean_outputs.sh removes known temporary output folders, temporary logs,
benchmark caches, frontend build cache, and pytest cache. It does not remove
data/ uploads, the SQLite database, or normal generated reports/outputs.
Core:
BACKEND_PORT=8000
FRONTEND_PORT=3000
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
NO_RETENTION=true
VPG_DATA_DIR=data
VPG_OUTPUTS_DIR=outputs
VPG_REPORTS_DIR=reports
VPG_DATABASE_PATH=data/jobs.sqlite3
MAX_UPLOAD_MB=250
CORS_ALLOW_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
CORS_ALLOW_ORIGIN_REGEX=https://.*\.(loca\.lt|trycloudflare\.com)
Speaker similarity:
SPEAKER_EMBEDDING_BACKEND=disabled
SPEAKER_MODEL_NAME=speechbrain/spkrec-ecapa-voxceleb
SPEAKER_MODEL_DIR=models/speaker-ecapa
ALLOW_MODEL_DOWNLOADS=false
DEVICE=auto
Red-team:
REDTEAM_MODE=basic
RVC_BENCHMARK_COMMAND=
RVC_BENCHMARK_TIMEOUT_SECONDS=300
NEURAL_CODEC_BENCHMARK_COMMAND=
NEURAL_CODEC_BENCHMARK_TIMEOUT_SECONDS=300
AudioSeal:
AUDIOSEAL_BACKEND=disabled
AUDIOSEAL_GENERATOR_NAME=audioseal_wm_16bits
AUDIOSEAL_DETECTOR_NAME=audioseal_detector_16bits
AUDIOSEAL_ALPHA=1.0
AUDIOSEAL_MAX_WAV_MB=40
C2PA:
C2PA_BACKEND=disabled
C2PA_TOOL_PATH=c2patool
C2PA_SIDECAR=true
C2PA_SIGNER_PATH=
Allowed SPEAKER_EMBEDDING_BACKEND values:
disabled: default, no speaker model is loaded.mock: deterministic local proxy for tests and demos.speechbrain: explicit opt-in real ECAPA/SpeechBrain backend. It lazy-loads
and caches the model, resolves DEVICE=auto to CUDA when available and CPU
otherwise, and retries on CPU after CUDA out-of-memory. Keep
ALLOW_MODEL_DOWNLOADS=false unless you intentionally want model downloads,
or point SPEAKER_MODEL_NAME at a local model path.Allowed AUDIOSEAL_BACKEND values:
disabled: default, no AudioSeal model is loaded.audioseal: explicit opt-in real AudioSeal backend. It lazy-loads the
generator and detector, uses DEVICE=auto|cpu|cuda, refuses remote model
loading while ALLOW_MODEL_DOWNLOADS=false, and skips very large WAV files
above AUDIOSEAL_MAX_WAV_MB to keep public demos responsive.Allowed C2PA_BACKEND values:
disabled: default, writes c2pa_manifest.json as sidecar evidence only.c2patool: explicit opt-in real C2PA backend. Requires c2patool available
through C2PA_TOOL_PATH. Set C2PA_SIGNER_PATH when delegating claim signing
to an external signer. Trust validation depends on the verifier trust list and
signer configuration.Allowed REDTEAM_MODE values:
basic: MP3 roundtrip if ffmpeg exists, resampling, trimming, watermark
re-checks.rvc: runs the basic checks plus an optional external benchmark command from
RVC_BENCHMARK_COMMAND. The command must include {input} and {output}
placeholders and produce a WAV. No RVC model is bundled or downloaded.neural_codec: runs the basic checks plus an optional external benchmark
command from NEURAL_CODEC_BENCHMARK_COMMAND. The command must include
{input} and {output} placeholders and produce a WAV. No codec model is
bundled or downloaded.off: skip red-team checks.evidence_only: watermark and evidence metadata only.fast: very light masked noise and subtle timbre jitter on voiced regions.balanced_cpu: moderate CPU-safe perturbation on voiced regions.high_protection_cpu: stronger CPU-safe perturbation with explicit quality
warnings.report.json includes:
metricswatermarkaudiosealc2paspeaker_embeddingadversarial_protectionredteamwarningspipeline_versionhashesmetadatareport.html displays:
c2patool, a supported asset/signing setup, and verifier trust configuration.Backend:
cd backend
source .venv/bin/activate
python -m pytest
Frontend:
cd frontend
npm run build
npm audit --audit-level=moderate
Full local suite:
./scripts/test_all.sh
./scripts/smoke_cli.sh