views:

449

answers:

3

I am trying to get a text-to-speech to save to an MP3. Currently I have the System.Speech.Synthesis speaking to a WAV file nicely.

    With New System.Speech.Synthesis.SpeechSynthesizer
        '.SetOutputToWaveFile(pOutputPath)    This works fine 
        .SetOutputToWaveStream(<<Problem bit>>)
        .Speak(pTextToSpeak)
        .SetOutputToNull()
        .Dispose()
    End With

Now the first line commented out produces a WAV file which is nice. Currently I am trying to replace that with an MP3 output stream and not having much success.

I have tried the Yeti.MMedia converter but either it isn't going to work or I haven't got it to work successfully. I have to admit here I don't know much about encodings, speeds etc.

So the question I have is, does anyone know of a nice way I can say something like the following:

.SetOutputToWaveStream(New MP3WriteStream(pOutputPath))

and have the SpeechSynthesizer write to the WAV which then gets converted to the MP3 and ends up on the HDD.

A: 

I don't think there is any other way than to write it using Wav and then convert it using LAME MP3 Encoder (etc.).

Priyank Bolia
Yeah, ok I will give this a bash, though I was hoping for a slightly more elegant solution so I will leave it open for now.
Rob
A: 

Just fiddle around with Yeti, it does work, I used it on a pretty big web app and it's been running without issue for about 2 years.

Doobi
A: 

First, get the Yeti classes to provide a writable stream, with the appropriate compression factor. Then, use SpeechSynthesizer.SetOutputToAudioStream - to tell the TTS engine about the speech quality.

Eric Brown