同じアクセントの中で他人の声を使うことはできますか?
たとえば、AVSpeechSynthesisVoice(language: "en-US")を実行すると、自動的に女性の声が使用されますが、代わりに同じアクセントの男性が必要でした。
同じアクセントの中で声を変更することは可能ですか、または唯一の方法は別のアクセントの別の声を試すことです(例:us-AU)
(ピッチや速度などのプロパティではなく、声全体を変更したいことに注意してください)
ありがとうございました
AVSpeechSynthesisVoice(identifier: "com.Apple.ttsbundle.siri_male_en-GB_compact")
を使用できます
識別子は、印刷時に見つけることができますAVSpeechSynthesisVoice.speechVoices()
[AVSpeechSynthesisVoice 0x6080000097d0] Language: ar-SA, Name: Maged, Quality: Default [com.Apple.ttsbundle.Maged-compact]
[AVSpeechSynthesisVoice 0x608000009780] Language: cs-CZ, Name: Zuzana, Quality: Default [com.Apple.ttsbundle.Zuzana-compact]
[AVSpeechSynthesisVoice 0x608000009440] Language: da-DK, Name: Sara, Quality: Default [com.Apple.ttsbundle.Sara-compact]
[AVSpeechSynthesisVoice 0x608000009670] Language: de-DE, Name: Anna, Quality: Default [com.Apple.ttsbundle.Anna-compact]
[AVSpeechSynthesisVoice 0x6080000092e0] Language: el-GR, Name: Melina, Quality: Default [com.Apple.ttsbundle.Melina-compact]
[AVSpeechSynthesisVoice 0x608000009310] Language: en-AU, Name: Karen, Quality: Default [com.Apple.ttsbundle.Karen-compact]
[AVSpeechSynthesisVoice 0x6080000098d0] Language: en-GB, Name: Daniel, Quality: Default [com.Apple.ttsbundle.Daniel-compact]
[AVSpeechSynthesisVoice 0x6080000094e0] Language: en-IE, Name: Moira, Quality: Default [com.Apple.ttsbundle.Moira-compact]
[AVSpeechSynthesisVoice 0x6080000096b0] Language: en-US, Name: Samantha, Quality: Default [com.Apple.ttsbundle.Samantha-compact]
[AVSpeechSynthesisVoice 0x608000009480] Language: en-ZA, Name: Tessa, Quality: Default [com.Apple.ttsbundle.Tessa-compact]
[AVSpeechSynthesisVoice 0x6080000093d0] Language: es-ES, Name: Monica, Quality: Default [com.Apple.ttsbundle.Monica-compact]
[AVSpeechSynthesisVoice 0x6080000096c0] Language: es-MX, Name: Paulina, Quality: Default [com.Apple.ttsbundle.Paulina-compact]
[AVSpeechSynthesisVoice 0x608000009550] Language: fi-FI, Name: Satu, Quality: Default [com.Apple.ttsbundle.Satu-compact]
[AVSpeechSynthesisVoice 0x6080000094f0] Language: fr-CA, Name: Amelie, Quality: Default [com.Apple.ttsbundle.Amelie-compact]
[AVSpeechSynthesisVoice 0x608000009880] Language: fr-FR, Name: Thomas, Quality: Default [com.Apple.ttsbundle.Thomas-compact]
[AVSpeechSynthesisVoice 0x608000009290] Language: he-IL, Name: Carmit, Quality: Default [com.Apple.ttsbundle.Carmit-compact]
[AVSpeechSynthesisVoice 0x608000009570] Language: hi-IN, Name: Lekha, Quality: Default [com.Apple.ttsbundle.Lekha-compact]
[AVSpeechSynthesisVoice 0x608000009510] Language: hu-HU, Name: Mariska, Quality: Default [com.Apple.ttsbundle.Mariska-compact]
[AVSpeechSynthesisVoice 0x608000009040] Language: id-ID, Name: Damayanti, Quality: Default [com.Apple.ttsbundle.Damayanti-compact]
[AVSpeechSynthesisVoice 0x6080000096a0] Language: it-IT, Name: Alice, Quality: Default [com.Apple.ttsbundle.Alice-compact]
[AVSpeechSynthesisVoice 0x6080000092b0] Language: ja-JP, Name: Kyoko, Quality: Default [com.Apple.ttsbundle.Kyoko-compact]
[AVSpeechSynthesisVoice 0x608000009540] Language: ko-KR, Name: Yuna, Quality: Default [com.Apple.ttsbundle.Yuna-compact]
[AVSpeechSynthesisVoice 0x6080000090e0] Language: nl-BE, Name: Ellen, Quality: Default [com.Apple.ttsbundle.Ellen-compact]
[AVSpeechSynthesisVoice 0x608000009380] Language: nl-NL, Name: Xander, Quality: Default [com.Apple.ttsbundle.Xander-compact]
[AVSpeechSynthesisVoice 0x608000009240] Language: no-NO, Name: Nora, Quality: Default [com.Apple.ttsbundle.Nora-compact]
[AVSpeechSynthesisVoice 0x6080000090f0] Language: pl-PL, Name: Zosia, Quality: Default [com.Apple.ttsbundle.Zosia-compact]
[AVSpeechSynthesisVoice 0x608000009250] Language: pt-BR, Name: Luciana, Quality: Default [com.Apple.ttsbundle.Luciana-compact]
[AVSpeechSynthesisVoice 0x6080000094d0] Language: pt-PT, Name: Joana, Quality: Default [com.Apple.ttsbundle.Joana-compact]
[AVSpeechSynthesisVoice 0x608000009210] Language: ro-RO, Name: Ioana, Quality: Default [com.Apple.ttsbundle.Ioana-compact]
[AVSpeechSynthesisVoice 0x608000009130] Language: ru-RU, Name: Milena, Quality: Default [com.Apple.ttsbundle.Milena-compact]
[AVSpeechSynthesisVoice 0x608000009620] Language: sk-SK, Name: Laura, Quality: Default [com.Apple.ttsbundle.Laura-compact]
[AVSpeechSynthesisVoice 0x608000009730] Language: sv-SE, Name: Alva, Quality: Default [com.Apple.ttsbundle.Alva-compact]
[AVSpeechSynthesisVoice 0x608000009740] Language: th-TH, Name: Kanya, Quality: Default [com.Apple.ttsbundle.Kanya-compact]
[AVSpeechSynthesisVoice 0x6080000095e0] Language: tr-TR, Name: Yelda, Quality: Default [com.Apple.ttsbundle.Yelda-compact]
[AVSpeechSynthesisVoice 0x608000009010] Language: zh-CN, Name: Ting-Ting, Quality: Default [com.Apple.ttsbundle.Ting-Ting-compact]
[AVSpeechSynthesisVoice 0x608000009660] Language: zh-HK, Name: Sin-Ji, Quality: Default [com.Apple.ttsbundle.Sin-Ji-compact]
[AVSpeechSynthesisVoice 0x608000009860] Language: zh-TW, Name: Mei-Jia, Quality: Default [com.Apple.ttsbundle.Mei-Jia-compact]
Xcodee 8.3.2以降、男性の声が利用できるようになりました
import UIKit
import AVFoundation
class ViewController: UIViewController {
let speaker = AVSpeechSynthesizer()
let dialogue = AVSpeechUtterance(string: "Hello I am clearly a man")
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func speakText(sender: AnyObject) {
dialogue.rate = AVSpeechUtteranceDefaultSpeechRate;
dialogue.voice = AVSpeechSynthesisVoice(language: "en-gb")
guard speaker.isSpeaking else
{
speaker.speak(dialogue)
return
}
}
}
言語en-gbは男性の声で話します
乾杯
いいえ、ここで音声AVSpeechSynthesisVoice(language: "en-US")を変更することはできません。 Appleで使用されるBCP-47コードは事前に定義されているため、操作できません。参考のために iOS 7.0のAVSpeechSynthesizerには米国の男性の声がありますか?
そして、それはios8とios9で変わりません
さて、以下のように識別子名を直接使って音声を設定できます。
func speak(say: String) {
let utterance = AVSpeechUtterance(string: say)
utterance.voice = AVSpeechSynthesisVoice(identifier: "Karen")
utterance.rate = 0.4
utterance.pitchMultiplier = 0.5
utterance.preUtteranceDelay = 0
utterance.volume = 1
synth.speak(utterance)
}