-1
나는 내 Mac에서 신속하게 작동하는 텍스트로 말하기를 얻으려고합니다. 몇 가지 기사를 찾았지만 모두 iOS 용입니다. 나는 따라 시도하고이 하나 http://www.appcoda.com/siri-speech-framework/text to speech macOS 스위프트 놀이터
지금까지이 놀이터에서 내 코드입니다 :
//: Playground - noun: a place where people can play
import Cocoa
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
import Speech
while true {
microphoneButton.isEnabled = false //2
speechRecognizer.delegate = self //3
SFSpeechRecognizer.requestAuthorization { (authStatus) in //4
var isButtonEnabled = false
switch authStatus { //5
case .authorized:
isButtonEnabled = true
case .denied:
isButtonEnabled = false
print("User denied access to speech recognition")
case .restricted:
isButtonEnabled = false
print("Speech recognition restricted on this device")
case .notDetermined:
isButtonEnabled = false
print("Speech recognition not yet authorized")
}
OperationQueue.main.addOperation() {
self.microphoneButton.isEnabled = isButtonEnabled
}
}
}
그것은 오류 "그런 모듈 연설"
내 질문에 온다가 MacOS에서 가능합니까? 놀이터에서 가능합니까? 당신이 SFSpeechRecognizer와 운이있어, 그래서 그것은 Speech library 것 같아 사전에
감사합니다, Jersh
[음성 라이브러리] (https://developer.apple.com/reference/speech)는 iOS에서만 사용할 수 있으므로 SFSpeechRecognizer에서 벗어났습니다. – TheAmateurProgrammer
그 대답, 감사합니다 작동합니다! – Jersh