File size: 4,660 Bytes
c86b10b 1e453ae 188f3a0 c86b10b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | ---
license: apache-2.0
library_name: coreml
tags:
- speaker-verification
- speaker-embedding
- apple-silicon
- on-device
- coreml
- ios
- macos
- thestage-apple-sdk
---
# ReDimNet2 Speaker Embedding (Apple Silicon)

[TheStage Apple SDK](https://github.com/TheStageAI/AppleSDK)
**Original model:** [ReDimNet2](https://github.com/PalabraAI/redimnet2) (Palabra AI) · [paper](https://arxiv.org/abs/2603.11841)
On-device **speaker embedding** for enrollment and cosine verification, packaged by **TheStage AI** for Apple Silicon. Produces a **192-d L2-normalized** vector from 16 kHz mono audio.
| | |
| --- | --- |
| Runtime | TheStage Apple SDK (`SpeakerEmbedding`) |
| Embedding dim | **192** (L2-normalized) |
| Window | **2.0 s** (32 000 samples @ 16 kHz) |
| Default device | **CPU** |
| HF engines | `TheStageAI/redimnet2` |
## Overview
---
Used by `TheStageVoiceAgent` for speaker ID (`config.speaker_id = "TheStageAI/redimnet2"`).
## System Requirements
---
| **Property** | **Value** |
| --- | --- |
| **Hardware** | Apple Silicon Mac, or physical iPhone / iPad |
| **macOS** | 15.0+ |
| **iOS** | 18.0+ |
| **Xcode** | 16.0+ |
| **Swift** | 6.0+ |
| **Flutter** (optional) | 3.24+ |
> Simulator is **not** supported — run on real Apple Silicon hardware.
## TheStage AI Access Token
---
Create a token at [app.thestage.ai](https://app.thestage.ai) and pass it to the SDK:
```swift
try await TheStageAI.shared.initialize(apiToken: "th_…")
```
```dart
await TheStageFlutterSDK.initialize(api_token: 'th_…');
```
Token is checked online in `initialize` (once per app process when reachable). Inference runs fully on-device. Offline initialize fails — reconnect and call `initialize` again.
## TheStage Apple SDK
---
Docs: [TheStage Apple SDK · Speaker embedding](https://docs.thestage.ai)
### Installation (SwiftPM)
In Xcode: **File → Add Package Dependencies…**, paste `https://github.com/TheStageAI/AppleSDK.git`, and add the `TheStageSDK` product. Or in `Package.swift`:
```swift
.package(
url: "https://github.com/TheStageAI/AppleSDK.git",
exact: Version(1, 1, 0)
)
```
### Installation (Flutter / iOS)
```yaml
# pubspec.yaml
dependencies:
thestage_apple_sdk:
git:
url: https://github.com/TheStageAI/AppleSDK.git
path: plugin/thestage_apple_sdk
ref: 1.1.0
```
### Swift
```swift
import TheStageSDK
try await TheStageAI.shared.initialize(apiToken: "th_…")
let sid = try await SpeakerEmbedding(
engines_path: "TheStageAI/redimnet2"
)
// Enroll
let enroll = try sid.infer(audio: pcm_16k_mono)
// enroll.embedding: [Float] length 192
// Or via singleton JSON (same shape as Flutter):
try await TheStageAI.shared.start_model(
model_name: "speaker_id",
engines_path: "TheStageAI/redimnet2",
model_type: "thestage_speaker_embedding"
)
let out = try TheStageAI.shared.infer(
model_name: "speaker_id",
input_json: ["audio": pcm_16k_mono]
)
```
### Flutter (iOS)
```dart
await TheStageFlutterSDK.start_model(
model_name: 'speaker_id',
engines_path: 'TheStageAI/redimnet2',
);
final enrolled = await TheStageFlutterSDK.infer(
model_name: 'speaker_id',
input_json: {'audio': pcm16k},
);
final embedding = (enrolled[0]['embedding'] as List).cast<double>();
final check = await TheStageFlutterSDK.infer(
model_name: 'speaker_id',
input_json: {
'audio': pcm16k,
'embedding': embedding,
},
);
final similarity = check[0]['similarity'] as double;
```
### Audio contract
| | |
| --- | --- |
| Sample rate | **16 kHz** mono Float |
| Window | **2.0 s** — pad/trim trailing |
| Output | 192-d L2-normalized embedding; optional cosine `similarity` when a reference embedding is passed |
## Acknowledgments
---
This work builds on **ReDimNet2** by Palabra AI: [https://github.com/PalabraAI/redimnet2](https://github.com/PalabraAI/redimnet2).
Paper: [https://arxiv.org/abs/2603.11841](https://arxiv.org/abs/2603.11841).
Based on ReDimNet2 (Palabra AI). This Apple Silicon package is produced by TheStage AI; it is not an official Palabra AI release.
## Links
---
* __Original model (GitHub)__: [PalabraAI/redimnet2](https://github.com/PalabraAI/redimnet2)
* __Paper__: [https://arxiv.org/abs/2603.11841](https://arxiv.org/abs/2603.11841)
* __Platform__: [app.thestage.ai](https://app.thestage.ai)
* __TheStage Apple SDK__: [github.com/TheStageAI/AppleSDK](https://github.com/TheStageAI/AppleSDK)
* __Docs__: [docs.thestage.ai](https://docs.thestage.ai)
* __Subscribe for updates__: [TheStageAI X](https://x.com/TheStageAI)
* __Contact email__: contact@thestage.ai
|