Imports Microsoft.Speech.Synthesis
Private synth As SpeechSynthesizer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
synth = New SpeechSynthesizer
synth.SetOutputToDefaultAudioDevice()
synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (fr-FR, Hortense)")
synth.Rate = 0
synth.SpeakAsync("Bonjour je parle chinois")
end sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPublic Sub InstallVoice(Optional ByVal args As String() = Nothing) ' Initialize a new instance of the SpeechSynthesizer. Using synth As New SpeechSynthesizer() ' Output information about all of the installed voices. Console.WriteLine("Installed voices -") For Each voice As InstalledVoice In synth.GetInstalledVoices() Dim info As VoiceInfo = voice.VoiceInfo Dim AudioFormats As String = "" For Each fmt As SpeechAudioFormatInfo In info.SupportedAudioFormats AudioFormats += [String].Format("{0}" & Chr(10) & "", fmt.EncodingFormat.ToString()) Next Console.WriteLine(" Name: " + info.Name) Console.WriteLine(" Culture: " & info.Culture.ToString) Console.WriteLine(" Age: " + info.Age.ToString) Console.WriteLine(" Gender: " + info.Gender.ToString) Console.WriteLine(" Description: " + info.Description) Console.WriteLine(" ID: " + info.Id) Console.WriteLine(" Enabled: " + voice.Enabled.ToString) If info.SupportedAudioFormats.Count <> 0 Then Console.WriteLine(" Audio formats: " + AudioFormats) Else Console.WriteLine(" No supported audio formats found") End If Dim AdditionalInfo As String = "" For Each key As String In info.AdditionalInfo.Keys AdditionalInfo += [String].Format(" {0}: {1}" & Chr(10) & "", key, info.AdditionalInfo(key)) Next Console.WriteLine(" Additional Info - " + AdditionalInfo) Console.WriteLine() Next End Using Console.WriteLine("end of Voice exit...") End Sub
Imports System.Speechou
Imports System.Speech.Synthesis
Imports Microsoft.Speech.Synthesis
Imports Microsoft.Speech Imports Microsoft.Speech.Synthesis Public Class Form2 Private Sub Form2_DoubleClick(sender As Object, e As EventArgs) Handles Me.DoubleClick Dim synth As Microsoft.Speech.Synthesis.SpeechSynthesizer synth = New SpeechSynthesizer synth.SetOutputToDefaultAudioDevice() synth.SelectVoice("ScanSoft Virginie_Dri40_16kHz") 'synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (fr-CA, Harmonie)") synth.Rate = 0 synth.SpeakAsync("Bonjour je suis virginie") End Sub End Class
Imports System.Speech
Imports System.Speech.Synthesis
Private synth As SpeechSynthesizer
Public Class Form2
Private Sub Form2_DoubleClick(sender As Object, e As EventArgs) Handles Me.DoubleClick
synth = New SpeechSynthesizer
synth.SelectVoice("ScanSoft Virginie_Dri40_16kHz")
synth.Rate = 0
synth.SpeakAsync("Bonjour je suis virginie")
End Sub
Imports Microsoft.Speech.Synthesis
Private synth As SpeechSynthesizer
Private Sub Form2_DoubleClick(sender As Object, e As EventArgs) Handles Me.DoubleClick
synth = New SpeechSynthesizer
synth.SetOutputToDefaultAudioDevice()
synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (fr-FR, Hortense)")
synth.Rate = 0
synth.SpeakAsync("Bonjour je suis Hortense")
End Sub
Public Shared Sub VoiceList(Optional ByVal args As String() = Nothing) ' Initialize a new instance of the SpeechSynthesizer. Using synth As New System.Speech.Synthesis.SpeechSynthesizer ' Output information about all of the installed voices. Console.WriteLine("Installed voices -") For Each voice As InstalledVoice In synth.GetInstalledVoices() Dim info As VoiceInfo = voice.VoiceInfo Dim AudioFormats As String = "" For Each fmt As System.Speech.AudioFormat.SpeechAudioFormatInfo In info.SupportedAudioFormats AudioFormats += [String].Format("{0}" & Chr(10) & "", fmt.EncodingFormat.ToString()) Next Console.WriteLine(" Name: " + info.Name) Console.WriteLine(" Culture: " & info.Culture.ToString) Console.WriteLine(" Age: " + info.Age.ToString) Console.WriteLine(" Gender: " + info.Gender.ToString) Console.WriteLine(" Description: " + info.Description) Console.WriteLine(" ID: " + info.Id) Console.WriteLine(" Enabled: " + voice.Enabled.ToString) If info.SupportedAudioFormats.Count <> 0 Then Console.WriteLine(" Audio formats: " + AudioFormats) Else Console.WriteLine(" No supported audio formats found") End If Dim AdditionalInfo As String = "" For Each key As String In info.AdditionalInfo.Keys AdditionalInfo += [String].Format(" {0}: {1}" & Chr(10) & "", key, info.AdditionalInfo(key)) Next Console.WriteLine(" Additional Info - " + AdditionalInfo) Console.WriteLine() Next End Using Console.WriteLine("end of Voice exit...") End Sub
Imports System.Speech
Imports System.Speech.Synthesis
Imports System.Speech.AudioFormat
Public Sub InstallVoice(Optional ByVal args As String() = Nothing)
' Initialize a new instance of the SpeechSynthesizer.
Using synth As New SpeechSynthesizer()
' Output information about all of the installed voices.
Console.WriteLine("Installed voices -")
For Each voice As InstalledVoice In synth.GetInstalledVoices()
Dim info As VoiceInfo = voice.VoiceInfo
Dim AudioFormats As String = ""
For Each fmt As SpeechAudioFormatInfo In info.SupportedAudioFormats
AudioFormats += [String].Format("{0}" & Convert.ToChar(10) & "", fmt.EncodingFormat.ToString())
Next
Console.WriteLine(" Name: " + info.Name)
Console.WriteLine(" Culture: " & info.Culture.ToString)
Console.WriteLine(" Age: " + info.Age.ToString)
Console.WriteLine(" Gender: " + info.Gender.ToString)
Console.WriteLine(" Description: " + info.Description)
Console.WriteLine(" ID: " + info.Id)
Console.WriteLine(" Enabled: " + voice.Enabled.ToString)
If info.SupportedAudioFormats.Count <> 0 Then
Console.WriteLine(" Audio formats: " + AudioFormats)
Else
Console.WriteLine(" No supported audio formats found")
End If
Dim AdditionalInfo As String = ""
For Each key As String In info.AdditionalInfo.Keys
AdditionalInfo += [String].Format(" {0}: {1}" & Convert.ToChar(10) & "", key, info.AdditionalInfo(key))
Next
Console.WriteLine(" Additional Info - " + AdditionalInfo)
Console.WriteLine()
Next
End Using
Console.WriteLine("end of Voice exit...")
End Sub