We help IT Professionals succeed at work.

How to save SAPI text to speech into a wave format thru TMemoryStream

edeaux
edeaux asked
on
Medium Priority
1,321 Views
Last Modified: 2013-11-23
I'm working on a TTS project. I want to output it to a wave format to TMemoryStream instead of saving to a file. The reason of saving to TMemoryStream so that I can play it in bass (http://www.un4seen.com/). I added codes from a questions posted here that save to wave file. Could someone help me?
The codes below save output to wave file. I got it from http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_20642945.html.
 
procedure TForm1.Button1Click(Sender: TObject);
var SpFileStream1: TSpFileStream;
    SpVoice1: TSpVoice;
    FileName : TFileName;
begin
    Button1.Caption := 'Working';
    SpFileStream1 := TSpFilestream.Create(nil);
    FileName := 'E:\Test1.wav';
    SpFileStream1.open(FileName, SSFMCreateForWrite, false);
    SPVoice1 := TSpVoice.Create(nil);
    SpVoice1.AudioOutputStream := SPFileStream1.DefaultInterface;
    SpVoice1.Speak('this is a test', SVSFDefault);
    SPFileStream1.Close;
    SPVoice1.Free;
    SpFileStream1.Free;
    Button1.Caption := 'done';
end;

Open in new window

Comment
Watch Question

MerijnBSr. Software Engineer
CERTIFIED EXPERT

Commented:
If you can compile this code, can't you change TSpFileStream to TSpMemoryStream?

Author

Commented:
TSpMemoryStream isn't compatible with bass.
Commented:
To Moderator:

Is it possible to reclaim the points I assigned? I already find a solution with my problem.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
MerijnBSr. Software Engineer
CERTIFIED EXPERT

Commented:
You can click the 'request attention' link for these kind of things, I've already done that for you now.

If you have a solution, please post it here for future reference.

(btw, I'd expected bass not to except TSpMemoryStream, but there are probably ways around that).
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.