Text to MP3 using System.Speech.Synthesis.SpeechSynthesizer
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开发者_JAVA百科 and ends up on the HDD.
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.
I don't think there is any other way than to write it using Wav and then convert it using LAME MP3 Encoder (etc.).
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.
精彩评论