ScribeKit

API reference

Every public type in ScribeKit.

Scribe

public actor Scribe: speech recognition and diarization. Holds the loaded models.

MemberDescription
static let sharedShared 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, isDiarizationModelLoadedWhether the models are in memory.
prepare(diarization:progress:)Downloads and loads the models ahead of use.
unload()Frees model memory.
transcribeText(_:language:) -> StringPlain text of a file.
words(_:language:) -> [Word]Timed words of a file.
transcribe(_:options:progress:) -> TranscriptOne file, with speakers by default.
transcribeConversation(microphone:system:options:progress:) -> TranscriptA 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 of supportedLanguages.
  • .noAudio: transcribeConversation was given no track.

TranscriptRenderer

MemberDescription
render(_:as:markdown:) throws -> StringAny TranscriptFormat.
markdown(_:options:) -> StringMarkdown with optional front matter.
text(_:) -> StringName: 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.

MemberDescription
struct TurnspeakerID, 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]) -> StringJoins 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_PAUSE2 seconds: a longer pause starts a new segment.
MAX_SEGMENT_SECONDS45 seconds: a longer segment is split at the next sentence end.

On this page