想約人卻開不了口嗎?讓AVSpeechSynthesizer幫你說!
Published in
1 min readMar 25, 2019
這個作業我用了地表最強老爸的經典台詞,讓Siri小姐講一遍,聽起來有點怪怪的!!氣勢都沒有了,但是多了一點詭異感跟靈異感~~~
以下是程式碼囉!!
import AVFoundation
let TakenSpeak = AVSpeechUtterance(string:
“I will look for you,I will find you,and I will kill you.”)
let synthesizer = AVSpeechSynthesizer()
TakenSpeak.rate = 0.1
synthesizer.speak(TakenSpeak)
let TakenSpeakChinese = AVSpeechUtterance(string: “我會去找你,然後我會找到你,然後我會殺了你”)
TakenSpeakChinese.voice = AVSpeechSynthesisVoice(language: “zh-TW”)
TakenSpeakChinese.rate = 0.1
synthesizer.speak(TakenSpeakChinese)