Instructions to use mlboydaisuke/VoxCPM2-CoreAI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- VoxCPM
How to use mlboydaisuke/VoxCPM2-CoreAI with VoxCPM:
import soundfile as sf from voxcpm import VoxCPM model = VoxCPM.from_pretrained("mlboydaisuke/VoxCPM2-CoreAI") wav = model.generate( text="VoxCPM is an innovative end-to-end TTS model from ModelBest, designed to generate highly expressive speech.", prompt_wav_path=None, # optional: path to a prompt speech for voice cloning prompt_text=None, # optional: reference text cfg_value=2.0, # LM guidance on LocDiT, higher for better adherence to the prompt, but maybe worse inference_timesteps=10, # LocDiT inference timesteps, higher for better result, lower for fast speed normalize=True, # enable external TN tool denoise=True, # enable external Denoise tool retry_badcase=True, # enable retrying mode for some bad cases (unstoppable) retry_badcase_max_times=3, # maximum retrying times retry_badcase_ratio_threshold=6.0, # maximum length restriction for bad case detection (simple but effective), it could be adjusted for slow pace speech ) sf.write("output.wav", wav, 16000) print("saved: output.wav") - Notebooks
- Google Colab
- Kaggle
gen-cards: regenerate Use-it block
Browse files
README.md
CHANGED
|
@@ -25,6 +25,46 @@ LM drive a **12-layer LocDiT** flow-matching diffusion head, decoded by a **48 k
|
|
| 25 |
bundles + a few host-side projections.
|
| 26 |
|
| 27 |
<!-- gen-cards:use-it begin id=voxcpm2-2b (managed by scripts/gen-cards — edit cards.json / QuickStart.swift, not this block) -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
<!-- gen-cards:use-it end -->
|
| 29 |
|
| 30 |
## What's inside
|
|
|
|
| 25 |
bundles + a few host-side projections.
|
| 26 |
|
| 27 |
<!-- gen-cards:use-it begin id=voxcpm2-2b (managed by scripts/gen-cards — edit cards.json / QuickStart.swift, not this block) -->
|
| 28 |
+
## Use it
|
| 29 |
+
|
| 30 |
+
▶️ **Run it (source)** — the [Speak runner](https://github.com/john-rocky/coreai-kit/tree/main/Examples/Speak)
|
| 31 |
+
(GUI + CLI, one app for every text-to-speech model in the catalog):
|
| 32 |
+
|
| 33 |
+
```bash
|
| 34 |
+
git clone https://github.com/john-rocky/coreai-kit
|
| 35 |
+
open coreai-kit/Examples/Speak/Speak.xcodeproj
|
| 36 |
+
# → Run, then pick "VoxCPM2 2B" in the model picker
|
| 37 |
+
|
| 38 |
+
# agents / headless (macOS):
|
| 39 |
+
cd coreai-kit/Examples/Speak
|
| 40 |
+
swift run speak-cli --model voxcpm2-2b --text "Hello from Core AI." --output hello.wav
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
💻 **Build with it** — complete; the glue is kit API, copy-paste runs:
|
| 44 |
+
|
| 45 |
+
```swift
|
| 46 |
+
import CoreAIKit
|
| 47 |
+
|
| 48 |
+
let speaker = try await KitSpeaker(catalog: "voxcpm2-2b")
|
| 49 |
+
let audio = try await speaker.synthesize(text)
|
| 50 |
+
// audio.samples: 48 kHz mono PCM in [-1, 1] — play it or write a WAV
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
The take-home is [`Examples/Speak/Sources/QuickStart.swift`](https://github.com/john-rocky/coreai-kit/blob/main/Examples/Speak/Sources/QuickStart.swift)
|
| 54 |
+
— this exact code as one typed function, no UI; the CLI is an argument shell over it, and
|
| 55 |
+
the GUI drives the same `KitSpeaker(catalog:)` and plays the samples.
|
| 56 |
+
Live playback? `synthesizeStreaming(_:onChunk:)` hands you ~0.5 s chunks as they decode,
|
| 57 |
+
so audio starts before the whole clip exists. The WAV container is your app's territory
|
| 58 |
+
(the runner ships a 20-line writer).
|
| 59 |
+
|
| 60 |
+
**Integration checklist**
|
| 61 |
+
|
| 62 |
+
- SPM: `https://github.com/john-rocky/coreai-kit` → product **CoreAIKit**
|
| 63 |
+
- Info.plist: none needed
|
| 64 |
+
- Entitlements: none needed
|
| 65 |
+
- First run downloads the model — 4.7 GB (Mac) / 5.7 GB (iPhone) — then it loads from the
|
| 66 |
+
local cache (Application Support; progress via the `downloadProgress` callback)
|
| 67 |
+
- Measure in Release — Debug is ~3× slower on per-token host work
|
| 68 |
<!-- gen-cards:use-it end -->
|
| 69 |
|
| 70 |
## What's inside
|