練習iOS SDK — APP講話

Chiu
Sep 28, 2022

--

📌練習項目

● AVFoundation,AVSpeechSynthesizer,AVSpeechUtterance,AVSpeechSynthesisVoice

🟡Source code

import AVFoundationlet speechUtterance = AVSpeechUtterance(string:"今天,天氣晴")speechUtterance.voice = AVSpeechSynthesisVoice(language: "zh-TW")//設定語言speechUtterance.rate = 0.5//設定語速speechUtterance.pitchMultiplier = 2//設定音調let synthesizer = AVSpeechSynthesizer()synthesizer.speak(speechUtterance)

--

--