mlboydaisuke commited on
Commit
0cbf395
·
verified ·
1 Parent(s): adad084

gen-cards: regenerate Use-it block

Browse files
Files changed (1) hide show
  1. README.md +40 -0
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