Microsoft Speech Platform を使う
SDK をセットアップ
Voice をインストール
Download Microsoft Speech Platform - Server Runtime Languages (Version 10.2) from Official Microsoft Download Center
"MSSpeech_TTS_ja-JP_Haruka.msi" を選択
コード
こんな感じで喋らせることができる。
私の環境では直接 Speak させることができなかったので、いったん MemoryStream に入れた。
Imports System.IO Imports System.Media Imports Microsoft.Speech.Synthesis Public Class Class1 Public Shared Sub Main(ByVal args As String()) Dim synth As New SpeechSynthesizer synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (ja-JP, Haruka)") Dim o As New MemoryStream() synth.SetOutputToWaveStream(o) synth.Speak("本日は晴天なり") synth.Dispose() Dim player As New Media.SoundPlayer(New MemoryStream(o.ToArray)) player.PlaySync() player.Dispose() End Sub End Class
インストール済みの Voice から日本語を選ぶ場合は以下のようにする
For Each v As InstalledVoice In synth.GetInstalledVoices() If v.VoiceInfo.Culture.Name.Equals("ja-JP") Then synth.SelectVoice(v.VoiceInfo.Name) Exit For End If Next