语音02_Delphi

网址 :http://www.exceletel.com/support/whtpapers/speech/delphi.htm

 

 

Installing the Microsoft SAPI speech SDK in Delphi

After you install the SAPI 5.1 SDK available from Microsoft by clicking HERE, you will find that it gives you most of the important methods, events, types and constants through a registered type library.  This means that you can access SAPI 5.1 functionality through late bound or early bound Automation. 

From the Delphi menu select "Project | Import Type Library" and select "Microsoft Speech Object Library (Version 5.1) from the list of type libraries.

Check the "Generate Component Wrapper" checkbox.  This will give you component wrapper classes for the Automation objects listed in the file.  Create a new page called "SAPI 5.1" so that the created components will go on their own Component Palette.

Click on the Install button to automatically import the library and place the components on your SAPI 5.1 palette.

You will now have a file called SpeechLib_TLB.pas that you can reference to see all the classes and definitions which will be of help when you need to see how to convert types or see how a function is implemented.  You can create a new package for the resulting new components or use the default, "Borland User Components".


Here is the Install dialog showing the default.  You can click on the "into new package" tab and insert your own filename if you like.

Next click on the "Component | Install Packages" menu item and you will see the dialog box to the right.  Find your package, in this case the default where we added the SAPI 5.1 components to the Borland User Components Package.  Make sure your package is checked and press the "OK" button.


When you are done, you will see 19 new components on your SAPI 5.1 palette page!  Each of these components makes it easy to drop on your forms and access the interface associate with it.  You will see the TSpVoice component which we use in the sample programs to do the speaking with SpVoice events, methods and properties.  There are also the SpMMAudioOut component that lets us link a speech stream to a windows audio output device and SpAudioFormat which lets us control wave formats.  They don't seem to come with unique icons, which makes it hard to tell them apart from each other without getting hover help or memorizing their position in the list, but it sure is nice to have them componentized.

If you look in the Delphi 5, 6 and 7 folders under SAPI 5.1 you will find the component packages for each of these versions.  NOTE:  Delphi 6 had a bug that causes it to not to be able to import the type library properly, so you will have to create it in another version of Delphi and copy it in yourself.

Back to speech page...

 

X

转载于:https://www.cnblogs.com/CodeSkill/p/5851820.html

Delphi中英文语音朗读程序(控件及源码)调试OK 先安装Microsoft Speech SDK 5.1,这是微软的声音支持控件 前面安装不多做介绍,一步一步安装即可 安装完成后,需要加载Delphi控件 在Delphi IDE中选择菜单Project,Import Type Library—点击按钮Add(C:\Program Files\Common Files\Microsoft Shared\Speech\ sapi.dll)—点击按钮Install-在Install对话框中点击按钮OK—在Confirm对话框中点击按钮Yes—在对话框中点击按钮OK。至此,共19个控件被添加到Delphi组件板ActiveX页上。其中spvoice控件是我们要使用的 Microsoft Speech SDK 5.1下载地址:http://intraweb.5d6d.com/thread-280-1-1.html SpVoice详解 属性 描述 AlertBoundary 取得或设置停顿分界线。 AllowAudioOutputFormatChangesOnNextSet 设置是否允许声音自动调整到合适状态以适应其音频输出。 AudioOutput .取得或设置当前声音使用的的音频输出对象 AudioOutputStream 取得或设置当前声音使用的的音频输出流对象。 EventInterests 取得或设置当前声音返回的事件类型。 Priority 取得或设置声音的优先级。 Rate 取得或设置阅读的速度。 Status 返回一个ISpeechVoiceStatus 对象用于显示当前阅读和事件的状态 SynchronousSpeakTimeout 取得或设置一个时间间隔,用于标识多久未获得一个输出设备后,一个同步的Speak 和SpeakStream将终止,以毫秒计算。 Voice 取得或设置发音对象。 Volume 取得或设置声音的大小 。 方法 描述 DisplayUI 是否在控制面板中展示详细设置。 GetAudioOutputs 返回一个可用的音频输出标记。 GetVoices 返回一个可用的发音对象。 IsUISupported 决定是否能通过控制棉板的音频设置来控制。 Pause 暂停朗读。. Resume 恢复暂停,继续播放。 Skip 在当前输入的文本流中向前或向后跳一定距离再播放。 Speak 阅读一个字符串。 SpeakCompleteEvent 得到一个朗读完毕的时间句柄 SpeakStream 朗读一个文本流或一个声音文件。 WaitUntilDone 阻塞进程,直到声音播放完毕或者超时。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值