API reference
Every public type in ScribeKit.
Scribe
public actor Scribe: speech recognition and diarization. Holds the loaded models.
| Member | Description |
|---|---|
static let shared | Shared instance. Use it unless you need separate model memory. |
static let supportedLanguages: [String] | Language codes accepted as a hint. |
init() | A new instance with its own models. |
isSpeechModelLoaded, isDiarizationModelLoaded | Whether the models are in memory. |
prepare(diarization:progress:) | Downloads and loads the models ahead of use. |
unload() | Frees model memory. |
transcribeText(_:language:) -> String | Plain text of a file. |
words(_:language:) -> [Word] | Timed words of a file. |
transcribe(_:options:progress:) -> Transcript | One file, with speakers by default. |
transcribeConversation(microphone:system:options:progress:) -> Transcript | A call recorded as two aligned tracks. |
diarize(_:speakerCount:) -> [SegmentBuilder.Turn] | Speaker turns only. |
TranscriptionOptions
Prop
Type
Transcript
Codable, Hashable, Sendable.
Prop
Type
speaker(for id: String?) -> Speaker?mutating rename(speaker id: String, to name: String)
Segment
Prop
Type
Speaker
Prop
Type
Word
text: String, start: TimeInterval, end: TimeInterval.
TranscriptionStage
.loadingModels, .transcribing(track: String), .identifyingSpeakers, .finishing.
ModelProgress
model: Model (.speechRecognition or .speakerDiarization), fraction: Double?, detail: String.
ScribeError
.unsupportedLanguage(String): the language hint is not one ofsupportedLanguages..noAudio:transcribeConversationwas given no track.
TranscriptRenderer
| Member | Description |
|---|---|
render(_:as:markdown:) throws -> String | Any TranscriptFormat. |
markdown(_:options:) -> String | Markdown with optional front matter. |
text(_:) -> String | Name: text paragraphs. |
clock(_:), duration(_:) | Time formatting helpers. |
MarkdownOptions: title: String?, metadata: [(String, String)], includeTimestamps: Bool (default true), preamble: String?.
TranscriptFormat
.markdown (md), .text (txt), .srt, .vtt, .json. Each has fileExtension and displayName.
SegmentBuilder
Pure logic, no models. Use it with any recognizer.
| Member | Description |
|---|---|
struct Turn | speakerID, start, end: one diarizer turn. |
segments(words:turns:) -> [Segment] | Attributes words to turns, then groups them. |
group(_: [(Word, String?)]) -> [Segment] | Groups words that already carry a speaker. |
join(_: [Word]) -> String | Joins words, keeping punctuation tight. |
interleave(_: [[Segment]]) -> [Segment] | Merges tracks in time order. |
removeEcho(microphone:system:window:) -> [Word] | Drops microphone words heard from the speakers. |
PARAGRAPH_PAUSE | 2 seconds: a longer pause starts a new segment. |
MAX_SEGMENT_SECONDS | 45 seconds: a longer segment is split at the next sentence end. |