sfspeechrecognizer

How to make SFSpeechRecognizer available on macOS?

柔情痞子 提交于 2020-06-26 05:25:31
问题 I am trying to use Apple's Speech framework to do speech recognition on macOS 10.15.1. Before macOS 10.15, speech recognition was only available on iOS, but according to the documentation and this talk, should now be available on macOS as well. However, all my my attempts to use it have resulted in the SFSpeechRecognizer 's isAvailable property being set to false. Per that talk and the documentation I've enabled Siri and made sure that my app has the "Privacy - Speech Recognition Usage

SFSpeechRecognizer on MacOS not available despite successful authorization

与世无争的帅哥 提交于 2020-06-17 01:48:52
问题 I am trying to get a clumsy Objective-C proof-of-concept example to run with SFSpeechRecognizer on Catalina transcribing a local audio file. After some googling I have managed to get the authorization to work by adding an Info.plist with NSSpeechRecognitionUsageDescription and I get the authorization dialog and the correct SFSpeechRecognizerAuthorizationStatus (SFSpeechRecognizerAuthorizationStatusAuthorized). However, my SFSpeechRecognizer instance still is unavailable. I suspect, I must be

recording and speech recognition at the same time with SpeechRecognizer and MediaRecorder

会有一股神秘感。 提交于 2020-05-28 04:45:21
问题 I'm trying to record audio and do speech recognition at the same time. Each of them works separately, but together only the recording works. The code looks like that: private SpeechRecognizer sr; private MediaRecorder recorder; private void startRecording() throws IOException { recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setOutputFile("/dev/null"); recorder.setAudioEncoder

How to select audio input device (mic) in AVAudioEngine on macOS / swift?

空扰寡人 提交于 2020-01-25 08:03:45
问题 Is it possible to select the input device in AVAudioEngine using Swift on macOS? Use case: I am using SFSpeechRecognizer on macOS. To feed microphone data into it I am using private let audioEngine = AVAudioEngine() : let inputNode = audioEngine.inputNode let recordingFormat = inputNode.outputFormat(forBus: 0) inputNode.installTap( onBus: 0, bufferSize: 1024, format: recordingFormat ) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in self.recognitionRequest?.append( buffer ) } audioEngine

Unwanted callback from `SFSpeechRecognizer` `recognitionTask` at ~30s mark

和自甴很熟 提交于 2020-01-25 00:19:09
问题 If I inspected the stamps for callbacks from the SFSpeechRecognizer recognitionTask callback (on macOS): recognitionTask = speechRecognizer.recognitionTask( with: recognitionRequest ) { result, error in // if more than two seconds elapsed since the last update, we send a notification NSLog( "speechRecognizer.recognitionTask callback" ) : ... I observe: : 2019-11-08 14:51:00.35 ... speechRecognizer.recognitionTask callback 2019-11-08 14:51:00.45 ... speechRecognizer.recognitionTask callback

Bypass/disable macOS security measures for efficient development cycle of SFSpeechRecognizer project

落花浮王杯 提交于 2020-01-16 09:01:23
问题 I am building a macOS project that makes use of SFSpeechRecognizer , which in turn makes use of the microphone. Each time I modify the code and rebuild, I have to: Preferences -> Security & Privacy -> Accessibility Then I have to: - click the padlock - use my fingerprint to authorise - uncheck and recheck my app Now I can run. This is because I am tapping keyboard events. But on the first run, I am additionally, as I'm using speech recognition, presented with two dialogs: - Authorise this

Bypass/disable macOS security measures for efficient development cycle of SFSpeechRecognizer project

一曲冷凌霜 提交于 2020-01-16 09:00:49
问题 I am building a macOS project that makes use of SFSpeechRecognizer , which in turn makes use of the microphone. Each time I modify the code and rebuild, I have to: Preferences -> Security & Privacy -> Accessibility Then I have to: - click the padlock - use my fingerprint to authorise - uncheck and recheck my app Now I can run. This is because I am tapping keyboard events. But on the first run, I am additionally, as I'm using speech recognition, presented with two dialogs: - Authorise this

Swift SFSpeechRecognitionTask is not canceled

陌路散爱 提交于 2020-01-15 07:18:09
问题 I am working with Speech Recognition in Swift and have a problem with canceling SFSpeechRecognitionTask . I have implemented the following logic: I have a mic button Speech is being recognized while button is pressed When the mic button is released I need to finish the speech recognition, to get the results in completion block ( recognitionTask is used for it). So I use stopRecording() function for this purpose. This function works properly. I also need to cancel recognitionTask when I do

Error Domain=kAFAssistantErrorDomain Code=209 “(null)”

跟風遠走 提交于 2020-01-02 01:14:06
问题 I am facing an issue with the SFSpeechRecognizer . After few seconds of starting the application I start getting the error Error Domain=kAFAssistantErrorDomain Code=209 "(null)"" and "Error Domain=kAFAssistantErrorDomain Code=203 "Timeout" UserInfo={NSLocalizedDescription=Timeout, NSUnderlyingError=0x170049990 {Error Domain=SiriSpeechErrorDomain Code=100 "(null)"}} and the application stops recognization. I am trying to endAudio() and then again start it every 20 seconds as Apple does not

SFSpeechRecognizer multiple languages

北城以北 提交于 2019-12-24 12:35:04
问题 I am building a search that supports voice recognition and transforms speech to text so I am using SFSpeechRecognizer . But the problem is that I need to support multiple languages at the same time such as (" en_US ", " fr ", vi , ar ). The main idea is that the user can speak for example 1 word in English and the other in French and I want the engine to detect this. Currently, I am using this to set my main language ENGLISH: private let speechRecognizer = SFSpeechRecognizer(locale: Locale