Skip to content

Latest commit

 

History

History
165 lines (120 loc) · 6.71 KB

CLI.md

File metadata and controls

165 lines (120 loc) · 6.71 KB

Command Line Interface (CLI)

This guide collects commonly used fluidaudio CLI commands for ASR, diarization, VAD, and datasets.

TTS

TTS is built into the CLI. Run it directly:

# Default TTS backend (use --backend to select explicitly)
swift run fluidaudiocli tts "Hello from FluidAudio" --output out.wav

# Kokoro legacy seven-stage runtime (variant voices; OS-dependent routing)
swift run fluidaudiocli tts "Hello from FluidAudio" \
  --backend kokoro-ane \
  --output out-ane.wav

# Kokoro ANE v3: fixed hybrid CPU/ANE/GPU routing (v0.17.6+)
swift run -c release fluidaudiocli tts "Hello from FluidAudio" \
  --backend kokoro-ane --kokoro-version v3 --voice af_heart --output en.wav
swift run -c release fluidaudiocli tts "こんにちは、世界。" \
  --backend kokoro-ane --kokoro-version v3 --variant ja --voice jf_alpha --output ja.wav
swift run -c release fluidaudiocli tts "你好世界。" \
  --backend kokoro-ane --kokoro-version v3 --variant zh --voice zf_001 --output zh.wav

# PocketTTS (streaming, voice cloning)
swift run fluidaudiocli tts "Hello from FluidAudio" \
  --backend pocket \
  --output out-pocket.wav

# Gradium Phonon 31m on the Neural Engine (macOS 15+); --voice en_us_Easton, characters_The Snow Queen, ...
swift run -c release fluidaudiocli tts "Your order of $42.50 ships today." \
  --backend pocket-small --model phonon --voice en_gb_Maeve --output phonon.wav

# Multilingual G2P benchmark
swift run fluidaudiocli g2p-benchmark

V3 requires macOS 15 / iOS 18. It supports the fixed hybrid route, not arbitrary global compute policies. See Kokoro usage and limits and latency measurement boundaries.

ASR

# Transcribe an audio file (batch)
swift run fluidaudiocli transcribe audio.wav

# English-only run with higher accuracy
swift run fluidaudiocli transcribe audio.wav --model-version v2

# Parakeet Unified (English, punctuation and capitalization), with word timings in the JSON
swift run fluidaudiocli transcribe audio.wav --model-version unified --output-json out.json

# Streaming ASR with Parakeet EOU
swift run fluidaudiocli parakeet-eou --input audio.wav

# Transcribe multiple files in parallel
swift run fluidaudiocli multi-stream audio1.wav audio2.wav

# Benchmark ASR on LibriSpeech
swift run fluidaudiocli asr-benchmark --subset test-clean --max-files 50

# English benchmark preset (LibriSpeech)
swift run fluidaudiocli asr-benchmark --subset test-clean --max-files 50 --model-version v2

# Multilingual ASR (FLEURS) benchmark
swift run fluidaudiocli fleurs-benchmark --languages en_us,fr_fr --samples 10

# CTC keyword spotting benchmark on Earnings22
swift run fluidaudiocli ctc-earnings-benchmark

Diarization

# Run AMI benchmark (auto-download dataset)
swift run fluidaudiocli diarization-benchmark --auto-download

# Tune threshold and save results
swift run fluidaudiocli diarization-benchmark --threshold 0.7 --output results.json

# Quick test on a single AMI file
swift run fluidaudiocli diarization-benchmark --single-file ES2004a --threshold 0.8

# Real-time-ish streaming benchmark (~3s chunks with 2s overlap)
swift run fluidaudiocli diarization-benchmark --single-file ES2004a \
  --chunk-seconds 3 --overlap-seconds 2

# Balanced throughput/quality (~10s chunks with 5s overlap)
swift run fluidaudiocli diarization-benchmark --dataset ami-sdm \
  --chunk-seconds 10 --overlap-seconds 5

# Run the full VBx offline pipeline
swift run fluidaudiocli diarization-benchmark --mode offline --dataset ami-sdm --threshold 0.6

# Process a single file with streaming vs. offline inference
swift run fluidaudiocli process meeting.wav --mode streaming --threshold 0.7
swift run fluidaudiocli process meeting.wav --mode offline --threshold 0.6 --debug

# Sortformer streaming diarization
swift run fluidaudiocli sortformer audio.wav

# Sortformer benchmark on AMI dataset
swift run fluidaudiocli sortformer-benchmark
  • --mode offline switches the CLI to OfflineDiarizerManager, running the full VBx pipeline with PLDA refinement. Expect DER ≈ 18–20 % on AMI-SDM with threshold 0.6.
  • Add --rttm /path/to/ground_truth.rttm to process to compute DER/JER in-place, or --export-embeddings embeddings.json for debugging speaker vectors.
  • GitHub Actions workflow offline-pipeline.yml replays fluidaudio diarization-benchmark --mode offline --single-file ES2004a on every PR so failures in model downloads or clustering logic are caught early.

VAD

# Offline segmentation with seconds output (default mode)
swift run fluidaudiocli vad-analyze path/to/audio.wav

# Streaming only with 128 ms chunks and a custom threshold (timestamps emitted in seconds)
swift run fluidaudiocli vad-analyze path/to/audio.wav --streaming --threshold 0.65 --min-silence-ms 400

# Run VAD benchmark (mini50 dataset by default)
swift run fluidaudiocli vad-benchmark --num-files 50 --threshold 0.3

# Save benchmark results and enable debug output
swift run fluidaudiocli vad-benchmark --all-files --output vad_results.json --debug

swift run fluidaudiocli vad-analyze --help lists every tuning option (padding, negative threshold overrides, max-duration splitting, etc.).

Speech Enhancement (LocalVQE)

# Echo cancellation + noise suppression: mic capture plus what the speaker played
swift run -c release fluidaudiocli enhance mic.wav --reference speaker.wav --output clean.wav

# Noise suppression / dereverb only (silent far end)
swift run -c release fluidaudiocli enhance mic.wav --output clean.wav

# Drive the streaming API in 256-sample buffers with the 16 ms export and report per-call latency
swift run -c release fluidaudiocli enhance mic.wav -r speaker.wav --chunk 16ms --streaming --buffer-samples 256

--variant v1.2 selects the 1.3M-param checkpoint, --compute-units gpu moves the model off the CPU, and --model-dir DIR loads local .mlmodelc bundles instead of downloading.

# Near-end word recall / WER / far-end leakage on the AEC-Challenge synthetic mini set (auto-downloads)
swift run -c release fluidaudiocli enhance-benchmark
swift run -c release fluidaudiocli enhance-benchmark --max-files 50 --variants v1.3 --no-reference --output results.json
# Split the run across machines: contiguous shard i of n, then merge + verify the shard reports
swift run -c release fluidaudiocli enhance-benchmark --shard 0/5 --output shard0.json
python3 Scripts/verify_localvqe_benchmark.py shard*.json --merged results.json --expected-files 200

Datasets

# Download test sets
swift run fluidaudiocli download --dataset librispeech-test-clean
swift run fluidaudiocli download --dataset librispeech-test-other
swift run fluidaudiocli download --dataset ami-sdm
swift run fluidaudiocli download --dataset vad