Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8681775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:35:50+00:00 2026-06-12T21:35:50+00:00

I imported the SAPI type library into Delphi. I can output speech to the

  • 0

I imported the SAPI type library into Delphi. I can output speech to the PC speakers with this code:

procedure TForm1.Button1Click(Sender: TObject);
var
  Voice: TSpVoice;
begin
  Voice := TSpVoice.Create(nil);
  Voice.Speak('Hello World!', 0);
end;

I can output speech to a .wav file with this code:

procedure TForm1.Button1Click(Sender: TObject);
var
  Voice: TSpVoice;
  Stream: TSpFileStream;
begin
  Voice := TSpVoice.Create(nil);
  Stream := TSpFileStream.Create(nil);
  Stream.Open('c:\temp\test.wav', SSFMCreateForWrite, False);
  Voice.AudioOutputStream := Stream.DefaultInterface;
  Voice.Speak('Hello World!', 0);
  Stream.Close;
end;

The problem is that when I play back the .wav file it sounds terrible, like it’s using a really low bitrate. Audacity tells me the file is mono 16-bit 22.05kHz but it sounds much worse than that.

How do I output speech to a mono 16-bit 44.1kHz .wav file that will sound exactly the same as speech output directly to the PC speakers? I could not figure out how to modify the second code sample to set the bits per sample and the bitrate.

Follup-up: Glenn’s answer solves the bitrate issue. Thanks for that. But the quality of the speech output to the .wav file is still inferior to what is output directly to the speakers. I used screen recording software to record the output from the first block of code as helloworldtospeakers.wav. The second block of code, with Glenn’s line added, produces helloworldtowav.wav. The second file clearly has some distortion to it. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:35:52+00:00Added an answer on June 12, 2026 at 9:35 pm

    See the Format attribute on your file stream object. It’s an SpAudioFormat type which has a Type property you use to set the audio format. That’s an enumerated type, which has a great many options, so you’ll need to study them to get what you want.

    This line should get it for you (at least with the version of type library I used).

    Stream.Format.Type_ := SAFT44kHz16BitMono;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have imported a SQL Server stored procedure into the .edmx file. I'm calling
I have imported the ShockWave flash Activex Control in my Delphi project. I can
I imported a table from a CSV file into MySQL using this query: LOAD
I imported the libsqlite3.0.dylib framework but this code sqlite3 *database; generates an error saying
I imported LuaInterface into a console project, referenced it, and wrote a small test
I imported system.web into my class lib project. Trying to find: system.web.httpserverutility.server.mappath But I
I imported an excel file into my database using Tasks -> Import -> Excel
Having imported an existing GWT project into Eclipse, the WEB-INF/lib directory was empty and
i imported a lot of existing values into my mongodb via the norm driver
I have imported a JSF/Facelets project from SVN into Netbeans. Any change which I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.