Internet Explorer 8
(1)
MemoryStream
(1)
SpWaveFormatEx
(1)
Thread
(1)
Header
(1)
SpMemoryStream
(1)
SpFileStream
(1)
Choice
(1)

SAPI 5 TTS SpMemoryStream - WAVE Header?

Asked By Richard Nicholas
14-Oct-09 02:15 AM
The SAPI SDK is quite useful in providing simple TTS examples to create a WAV file (Using SpFileStream automation object) however I need to convert text to an MP3 file.

I can successfully convert the resulting WAV file created from the SpFileStream to MP3 however I want to skip the step of writing a wav file simply to convert it to mp3.

To avoid the step of creating the file I can create the audio to a memorystream from the text using SAPI's SpFileStream object however this does not create the WAVE/RIFF header required by the compression process.

Peter Bromberg's articles on TTS using SAPI & MemoryStream all confirm that no WAV header is provided with the raw audio so am I really stuck with this in-between process of writing to the filestream in order to access the header?? Seems silly... Anybody?? Peter??

thx in advance

EggHeadCafe - Software Developer Portal of Choice
Document Compatibility in Internet Explorer 8
http://www.eggheadcafe.com/tutorials/aspnet/5eac37f9-f8a4-40bf-a26b-a7cd299b73c9/document-compatibility-in.aspx

SOLVED

Asked By Richard Nicholas
15-Oct-09 06:12 PM
I resolved this by manually creating the RIFF header - see this article for details regarding the header requirements:

http://www.codeproject.com/KB/audio-video/MP3Compressor.aspx?fid=32144&fr=1&df=90&mpp=25&noise=3&sort=Position&view=Quick#xx0xx

I collected the various values required for the header from the SpWaveFormatEx object - see SAPI5 SDK.




SAPI 5 TTS SpMemoryStream - WAVE Header?
14-Oct-09

The SAPI SDK is quite useful in providing simple TTS examples to create a WAV file (Using SpFileStream automation object) however I need to convert text to an MP3 file.

I can successfully convert the resulting WAV file created from the SpFileStream to MP3 however I want to skip the step of writing a wav file simply to convert it to mp3.

To avoid the step of creating the file I can create the audio to a memorystream from the text using SAPI's SpFileStream object however this does not create the WAVE/RIFF header required by the compression process.

Peter Bromberg's articles on TTS using SAPI & MemoryStream all confirm that no WAV header is provided with the raw audio so am I really stuck with this in-between process of writing to the filestream in order to access the header?? Seems silly... Anybody?? Peter??

thx in advance

Previous Posts In This Thread:

EggHeadCafe - Software Developer Portal of Choice
A Brief Review of Generic Collection Classes
http://www.eggheadcafe.com/tutorials/aspnet/91ebf47b-fd8d-4bc9-a715-40421048a450/a-brief-review-of-generic.aspx
Post Question To EggHeadCafe