Alexaは、単にテキストを話すほかに、意図した感じでテキストを話させることが可能です。
そのために、SSML(Speech Synthesis Markup Language)形式でテキストを書きます。
- Speech Synthesis Markup Language (SSML) Reference
例
以下のように type と speech を与えると、Alexaは “Hoge (0.5秒間を開けて..) Hoge” と話します。
var speechOutput = {
speech: '<speak> Hoge <break time=\"0.5s\" /> Hoge </speak>',
type: AlexaSkill.speechOutputType.SSML
};
また、以下のようにすることで、音楽も流すことができるみたいです。実際、流れました。
speechOutput = {
speech: "<speak>Welcome to Tide Pooler. "
+ "<audio src='https://s3.amazonaws.com/ask-storage/tidePooler/OceanWaves.mp3'/>"
+ whichCityPrompt
+ "</speak>",
type: AlexaSkill.speechOutputType.SSML
},
2016年4月9日現在、サポートされているタグは以下のようです
- audio
- break
- p
- phoneme
- s
- say-as
- speak
https://github.com/KazuCocoa/alexa-wise-guy
また、Alexaは外部に向けてHTTP通信で取得した値を使うこともできるみたいです。
参考に、以下では取得した情報を話していました。
https://github.com/KazuCocoa/alexa-tide-pooler/blob/master/src/index.js#L341
参考
ここまで調べて、やりたいことはできそう、までわかった。
1 Comment