{"id":26833220,"url":"https://github.com/madcato/bl-speech-recognizer","last_synced_at":"2025-07-14T17:42:01.768Z","repository":{"id":270464711,"uuid":"910454996","full_name":"madcato/bl-speech-recognizer","owner":"madcato","description":"Some implemented use cases for SFSpeechRecognizer ","archived":false,"fork":false,"pushed_at":"2025-03-24T14:13:20.000Z","size":500,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T15:27:00.859Z","etag":null,"topics":["sfspeechrecognizer","speech","speech-recognition","speech-to-text","swift","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/madcato.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-31T10:15:25.000Z","updated_at":"2025-03-11T09:43:28.000Z","dependencies_parsed_at":"2025-03-07T11:36:03.818Z","dependency_job_id":null,"html_url":"https://github.com/madcato/bl-speech-recognizer","commit_stats":null,"previous_names":["madcato/bl-speech-recognizer"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madcato%2Fbl-speech-recognizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madcato%2Fbl-speech-recognizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madcato%2Fbl-speech-recognizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madcato%2Fbl-speech-recognizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madcato","download_url":"https://codeload.github.com/madcato/bl-speech-recognizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246337564,"owners_count":20761241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sfspeechrecognizer","speech","speech-recognition","speech-to-text","swift","xcode"],"created_at":"2025-03-30T15:28:22.784Z","updated_at":"2025-07-14T17:42:01.755Z","avatar_url":"https://github.com/madcato.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bl-speech-recognizer\n\nSome implemented use cases for SFSpeechRecognizer. \n\n## IMPORTANT\n\nFrom [Apple](https://developer.apple.com/documentation/speech/asking-permission-to-use-speech-recognition):\n\n![Apple important for speech recognition](doc/apple-important-speech-recognition.png)\n\nAdd [NSSpeechRecognitionUsageDescription](https://developer.apple.com/documentation/BundleResources/Information-Property-List/NSSpeechRecognitionUsageDescription) to your project _.plist_ file. This key is required if your app uses APIs that send user data to Apple’s speech recognition servers.\n\nAlso add [NSMicrophoneUsageDescription](https://developer.apple.com/documentation/BundleResources/Information-Property-List/NSMicrophoneUsageDescription) to run in real devices. (This is optional for iOS Simulator.)\n\n## Apple documentation\n\n- Sample code: [Recognizing speech in live audio](https://developer.apple.com/documentation/speech/recognizing-speech-in-live-audio)\n- Framework:[Speech](https://developer.apple.com/documentation/speech)\n- Article: [Asking Permission to Use Speech Recognition](https://developer.apple.com/documentation/speech/asking-permission-to-use-speech-recognition)\n\n## Sample usage\n\nSee [Example app](./examples) to learn how to use the library.\n\n### Continouos speech recognition\n\n```swift\nimport bl_speech_recognizer\n\nclass YourClassViewModel: ObservableObject { \n    // ... your properties\n    private var speechRecognizer = ContinuousSpeechRecognizer()\n    \n    @MainActor\n    func startRecording() {\n        isRecording = true\n    \n        speechRecognizer.start(inputType: .microphone, locale: .current) { result in\n            switch result {\n            case .success(let text):\n                self.recognizedText = text\n            case .failure(let error):\n                self.showError(error.localizedDescription)\n            }\n        }\n    }\n\n    @MainActor\n    func stopRecording() {\n        isRecording = false\n        speechRecognizer.stop()\n    }\n}\n```\n\nYou need to stop recognition by calling `stop()` on the recognizer.\n\n### Command speech recognition\n\n```swift\nimport bl_speech_recognizer\n\nclass YourClassViewModel: ObservableObject { \n    // ... your properties\n\n    private var speechRecognizer = CommandSpeechRecognizer()\n\n    @MainActor\n    func startRecording() {\n        isRecording = true\n        speechRecognizer.start(inputType: .microphone, locale: .current) { result in\n            switch result {\n            case .success(let text):\n                self.recognizedText = text\n                self.isRecording = false\n            case .failure(let error):\n                self.showError(error.localizedDescription)\n            }\n        }\n    }\n}\n```\n\nYou don't need to stop recognition, because the **CommandSpeechRecognizer** will do it. But you can add it to allow user to stop it.\n\n## Use cases sequence diagrams\n\n### Continuous recognition\n\n```mermaid\nsequenceDiagram\n    App-\u003e\u003ebl-speech-recognizer: start()\n    actor User\n    User--\u003e\u003ebl-speech-recognizer: \"Hello\"\n    bl-speech-recognizer-\u003e\u003eApp: recognized(\"Hello\")\n    User--\u003e\u003ebl-speech-recognizer: \"how\"\n    bl-speech-recognizer-\u003e\u003eApp: recognized(\"Hello how\")\n    User--\u003e\u003ebl-speech-recognizer: \"are\"\n    bl-speech-recognizer-\u003e\u003eApp: recognized(\"Hello how are\")\n    User--\u003e\u003ebl-speech-recognizer: \"you\"\n    bl-speech-recognizer-\u003e\u003eApp: recognized(\"Hello how are you\")\n    App-\u003e\u003ebl-speech-recognizer: stop()\n```\n\n### Command recognition\n\n```mermaid\nsequenceDiagram\n    App-\u003e\u003ebl-speech-recognizer: start()\n    actor User\n    User--\u003e\u003ebl-speech-recognizer: \"Delete\"\n    User--\u003e\u003ebl-speech-recognizer: \"all\"\n    User--\u003e\u003ebl-speech-recognizer: \"files\"\n    User--\u003e\u003ebl-speech-recognizer: (One second without speech)\n    bl-speech-recognizer-\u003e\u003eApp: recognized(\"Delete all files\")\n    bl-speech-recognizer-\u003e\u003ebl-speech-recognizer: stop()\n```\n\n### Interruptible chat\n\n```mermaid\nsequenceDiagram\n    App-\u003e\u003ebl-speech-recognizer: start()\n    App-\u003e\u003ebl-speech-recognizer: synthesize(\"My name is Chatbot)\n    actor User\n    bl-speech-recognizer--\u003e\u003eUser: \"My\"\n    bl-speech-recognizer--\u003e\u003eUser: \"name\"\n    User--\u003e\u003ebl-speech-recognizer: \"Delete\"\n    bl-speech-recognizer-\u003e\u003ebl-speech-recognizer:stopSynthesizing()\n    User--\u003e\u003ebl-speech-recognizer: \"all\"\n    User--\u003e\u003ebl-speech-recognizer: \"files\"\n    bl-speech-recognizer-\u003e\u003eApp: recognized(\"Delete all files\", isFinal: true)\n```\n\n## StackOverflow useful links\n\n- !!! [\"Domain=kAFAssistantErrorDomain Code=1101\" while setting SFSpeechAudioBufferRecognitionRequest.requiresOnDeviceRecognition = true](https://stackoverflow.com/questions/75511637/receiving-error-domain-kafassistanterrordomain-code-1101-while-setting-sfspeec)\n- [How can I specify the format of AVAudioEngine Mic-Input?](https://stackoverflow.com/questions/33484140/how-can-i-specify-the-format-of-avaudioengine-mic-input)\n- [ios speech recognition Error Domain=kAFAssistantErrorDomain Code=216 \"(null)\"](https://stackoverflow.com/questions/44767316/ios-speech-recognition-error-domain-kafassistanterrordomain-code-216-null)\n- [Is there a way to use iOS speech recognition in offline mode?](https://stackoverflow.com/questions/42900254/is-there-a-way-to-use-ios-speech-recognition-in-offline-mode)\n- [Speech Recognition got an error on iOS](https://stackoverflow.com/questions/39927727/speech-recognition-got-an-error-on-ios)\n- [iOS 10.0 Speech Recognition Error kAFAssistantErrorDomain](https://stackoverflow.com/questions/37805891/ios-10-0-speech-recognition-error-kafassistanterrordomain)\n- [SFSpeechRecognizer on MacOS not available despite successful authorization](https://stackoverflow.com/questions/59920660/sfspeechrecognizer-on-macos-not-available-despite-successful-authorization/76836073#76836073)\n- [SFSpeechRecognizer is not available](https://stackoverflow.com/questions/39741938/sfspeechrecognizer-is-not-available)\n- [SFspeechRecognizer recognize speech more than one minutes in ios 15?](https://stackoverflow.com/questions/72306390/sfspeechrecognizer-recognize-speech-more-than-one-minutes-in-ios-15)\n- [SFSpeechRecognizer isn't working properly in IOS 13.2](https://stackoverflow.com/questions/58673072/sfspeechrecognizer-isnt-working-properly-in-ios-13-2)\n- [How to increase speed of Speech-to-text transcription in iOS App?](https://stackoverflow.com/questions/71767687/how-to-increase-speed-of-speech-to-text-transcription-in-ios-app)\n- [SFSpeechRecognizer - detect end of utterance](https://stackoverflow.com/questions/42530634/sfspeechrecognizer-detect-end-of-utterance)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadcato%2Fbl-speech-recognizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadcato%2Fbl-speech-recognizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadcato%2Fbl-speech-recognizer/lists"}