简体   繁体   中英

Microsoft Speech in windows service

In my windows service .NET 4.0 application I use SpeechSynthesizer to speech some text. In Windows XP works great, but on Windows 7 it doesn't play anything. Why?

(Microsoft Server Speech Platform Runtime 11.0 + Speech Text To Speech Voice Lucia)

many thanks, Riccardo

From Vista onwards, Windows services are prevented from interacting with the desktop. This includes sounds too. If you want your service to do interactive stuff, you need to run a helper app at logon that communicates with your service and can be instructed by your service to do the user interaction stuff.

Please try using System.Speech and System.Speech.Synthesize instead of Microsoft.Speech. I have developed a tool to recoganize the voice using System.Speech which is working good for me in Windows Vista, Windows 7. Please do a check whether your windows speech system is working or not.

http://visualstudiogallery.msdn.microsoft.com/f2964c90-68e2-4ddd-861a-bd66e5cd4434

To use "it-IT" culture

Private Sub CreateSpeechRecoginationEngine(culture As String)
    Dim _culture As CultureInfo
    For Each recognizer In SpeechRecognitionEngine.InstalledRecognizers
        If recognizer.Culture.Name.Equals(culture) Then
            _culture = recognizer.Culture
            Exit For
        End If
    Next
    If _culture Is Nothing Then _culture = SpeechRecognitionEngine.InstalledRecognizers()(0).Culture
    SpeechRecognitionEngine speechRecoginationEngine = New SpeechRecognitionEngine(_culture)
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM