logo

SAPI 5 TTS SpMemoryStream - WAVE Header?

Richard Nicholas posted on Wednesday, October 14, 2009 2: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

Richard Nicholas posted on Thursday, October 15, 2009 6: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


Didn't Find The Answer You Were Looking For?

EggHeadCafe has experts online right now that may know the answer to your question.  We pay them a bonus for answering as many questions as they can.  So, why not help them and yourself by becoming a member (free) and ask them your question right now?
Create Account & Ask Question In Live Forum





Pete's Resume  |  Robbe's Resume  |  Neado  |  Free Icons  |  Privacy  |   (c) 2010