SpeechKit

main

A lightweight Swift package for speech recognition and synthesis on iOS.
michaelborgmann/SpeechKit

SpeechKit

Swift iOS SPM License Version Tests

๐ŸŽ™ A lightweight Swift package for speech recognition and synthesis on iOS.
Built for modern Swift apps, tested with Swift Testing, and ready for SwiftUI.


Features

  • โœ… SpeechRecognizer โ€” handles speech-to-text with configurable language support and UI callbacks
  • โœ… SpeechSynthesizer โ€” speaks text aloud with adjustable pitch, rate, and language
  • โœ… Child-friendly defaults for storytelling apps
  • โœ… Modern @Observable state management (no delegates!)
  • โœ… Safe fallback behavior and clear error reporting
  • โœ… Fully documented with DocC-style comments
  • โœ… Tested using Swift's native import Testing framework

Installation

Use Swift Package Manager to add the library:

.package(url: "https://github.com/michaelborgmann/SpeechKit.git", from: "0.1.0")

Then import it in your code:

import SpeechKit

Usage

๐Ÿ—ฃ Speech Recognition

let recognizer = SpeechRecognizer()
recognizer.language = Locale(identifier: "en-US")
recognizer.onTranscriptUpdate = { print("Partial: \($0)") }
recognizer.onStop = { print("Final result: \($0 ?? "")") }

recognizer.startRecording()
// ...
recognizer.stopRecording()

๐Ÿ”Š Speech Synthesis

let speaker = SpeechSynthesizer()
speaker.language = "pt-PT"
speaker.pitch = 1.2
speaker.speak(text: "Olรก! Bem-vindo ao nosso app.")

Requirements

  • iOS 17+ (due to @Observable macro support)
  • Swift 5.9 or Swift 6
  • Swift Concurrency-compatible
  • Swift Package Manager (SPM)

License

MIT License โ€” see LICENSE

Please credit this project if you use it in commercial or open-source apps.


About

Created by Michael Borgmann for the Wonder Tales storytelling engine. Part of the Vicentina Studios toolchain for creative, language-rich experiences.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Jul 10 2025 06:37:23 GMT-0900 (Hawaii-Aleutian Daylight Time)