LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Get Wav file from Microsoft TTS

I use Microsoft TTS to speak the text, it work fine with this example. but I want to use TTS to generate the Wav file.
I found this can be achived by VB examples from Microsoft Speech SDK 5.1 which I download from Microsoft website.
the part of core code like this:

    ' create a wave stream
    Dim cpFileStream As New SpFileStream
   
    ' Set output format to selected format
    cpFileStream.Format.Type = FormatCB.ItemData(FormatCB.ListIndex)
   
    ' Open the file for write
    cpFileStream.Open ComDlg.FileName, SSFMCreateForWrite, False
   
    ' Set output stream to the file stream
    Voice.AllowAudioOutputFormatChangesOnNextSet = False
    Set Voice.AudioOutputStream = cpFileStream
   
    ' show action
    AddDebugInfo "Save to .wav file"
   
    ' speak the given text with given flags
    Voice.Speak MainTxtBox.Text, m_speakFlags
   
    ' wait until it's done speaking with a really really long timeout.
    ' the tiemout value is in unit of millisecond. -1 means forever.
    Voice.WaitUntilDone -1
   
    ' Since the output stream was set to the file stream, we need to
    ' set back to the selected audio output by calling AudioOutputCB_Click
    ' as if user just changed it through UI
    AudioOutputCB_Click
   
    ' close the file stream
    cpFileStream.Close
    Set cpFileStream = Nothing
   
    MsgBox "WAV file successfully written!", vbOKOnly, "File Saved"

From above, the red mark is no use at LabVIEW, you can see from my attachment below

So maybe I make some mistakes from the example, I hope someone can point out for me, Thanks a lot

QIA

http://www.vitst.com
Virry Test & Control
LabVIEW Certified Developer
0 Kudos
Message 1 of 7
(5,355 Views)
Hi,

cant figure out your problem as I havent installed Microsoft TTS...but if you have the VB source code: Wouldn't it be easier for you to create an activeX-Dll with Visual Basic and include it in LabVIEW? Wouldn't this solve your problem and make your LabVIEW code more easier?

Greetings,

Christian

THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 2 of 7
(5,321 Views)
Hi Cschneider
But I don't think that good solution for this problem
Does LabVIEW not fully support API of Microsoft TTS?
I really Curious about that.
http://www.vitst.com
Virry Test & Control
LabVIEW Certified Developer
0 Kudos
Message 3 of 7
(5,301 Views)
NO good solution for this problem?
http://www.vitst.com
Virry Test & Control
LabVIEW Certified Developer
0 Kudos
Message 4 of 7
(5,283 Views)
OK, just installed Microsoft TTS...the example is working. But in your file, I have a broken wire. Is this your problem?

Christian

THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 5 of 7
(5,279 Views)

Yes cschneider.

Depend on the VB example,ISpeechFileStream Reference should connect to AudioOutputStream, so TTS could convert Wav file.

But In fact, the broken wire could not let both connected. So I think there must be some mistake.

 

QIA

http://www.vitst.com
Virry Test & Control
LabVIEW Certified Developer
0 Kudos
Message 6 of 7
(5,261 Views)

I cannot find the answer yet.

Someone could give me some more hint.

Thank you very much

 

QIA

http://www.vitst.com
Virry Test & Control
LabVIEW Certified Developer
0 Kudos
Message 7 of 7
(5,142 Views)