Click here to Skip to main content
15,886,060 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having an issue creating a working wav file from a web server using speechlib. I have tried multiple ways. I have tried creating a web service that creates the wav file as well as creating the wav file directly in the code behind of the web from.

The following code creates the file but it is 0 bytes and will not play.
C#
try
       {

           SpVoice voice = new SpVoice();

           SpFileStream fileStream = new SpFileStream();

           fileStream.Open(speechWavPath, SpeechStreamFileMode.SSFMCreateForWrite, false);

           voice.AudioOutputStream = fileStream;

           voice.Speak(currentWord, SpeechVoiceSpeakFlags.SVSFDefault);

           fileStream.Close();
       }
       catch
       {
           throw;
       }


I have also created a web service and it did the same thing. please help
Posted
Comments
Dave Kreskowiak 18-Nov-15 0:45am    
Why would you want to do this in a web server application? Considering there's usually no audio in a web server and nobody around to listen to it, why would you want the server speaking anything at all?
philyphil54 19-Nov-15 13:18pm    
I want to be able to take the text and convert to wav file to be played back on the clients computer. the server it self will not speak anything.
Dave Kreskowiak 19-Nov-15 20:20pm    
Web applications, by default, don't have write permissions to their folders. This is for security reasons. You need to give the account running your application NTFS permissions to write to the folder that you're trying to save the .WAV file to.
philyphil54 20-Nov-15 9:07am    
The the directory that it is pointed to is on the same machine and the directory has everyone access.

It also is able to create the file but it is a 0 byte file.
Dave Kreskowiak 20-Nov-15 10:09am    
In that case, I have no idea why it's not working. I've never had any purpose to use the speech API's.

Well, unless "currentWord" doesn't contain a string. If that variable is empty or null that would probably make a 0 byte file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900