TTS的總結 (轉)
這幾天在用TTS,有了好多網友的幫助,才有了這篇文章!
MSTTS的地址:
.sohu.com/disk2/it/new/update/0514/MSTTS.EXE">
關於庫的匯入:
1:(c++ builder)
開啟選單項PROJECT->Import Type Library...,在彈出的對話方塊中單擊Add,選擇
speech目錄下的Vtxtauto.tlb,加入VtxtAuto[Version 1.0]一項。單擊OK,
就會自動生成一個VtxtAuto_TLB.pas。這個檔案包含了TTS引擎的COM類介面,可以用來與DLL檔案通訊。新建一個工程,將這個檔案包含進來:
uses VtxtAuto_TLB;
執行透過,不過小弟的音效卡剛好壞掉。那位兄弟幫我試試看效果如何。有問題的話請告訴我。
#ifndef Unit1H
#define Unit1H
#include
#include
#include
#include
class TForm1 : public TForm
{
__published: // -managed Components
TEdit *Edit1;
TButton *Button1;
void __fastcall FormCreate(T *Sender);
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
extern PACKAGE TForm1 *Form1;
#endif
#include
#pragma hdrstop
#include "Unit1.h"
#include "wstring.h"
#include "VTxtAuto_TLB.h"
#pragma package(smart_init)
#pragma re "*.dfm"
TForm1 *Form1;
IVTxtAuto *IVTxtAuto1;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
WideString a = "Demo1";
WideString b = "Project1.exe";
WideString c= "Hi,I am trying to speak to you,Do you hear me?";
IVTxtAuto1 = NULL;
CoInitialize(NULL);
OleCheck(CoCreateInstance(CLSID_VTxtAuto_,0,CLSCTX_ALL,IID_IVTxtAuto, (LPVOID*)&IVTxtAuto1));
IVTxtAuto1->Register(a,b);
IVTxtAuto1->set_Enabled(1);
IVTxtAuto1->set_Speed(150);
IVTxtAuto1->Speak(c,vtxtsp_VERYHIGH);
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(IVTxtAuto1 != NULL)
{
IVTxtAuto1->Speak((WideString)Edit1->Text,vtxtsp_VERYHIGH);
ShowMessage("OK");//我的語句(沒音效卡)
}else{
ShowMessage("沒有初始化成功");
}
}
#include
#pragma hdrstop
USERES("Project1.res");
USEFORM("Unit1.cpp", Form1);
USEUNIT("D:BorlandCBuilder5ImportsVTxtAuto_TLB.CPP");
WIN WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
2.從中匯入vtext.dll(compent-import control);
生成texttospeech
Project1.cpp
#include
#pragma hdrstop
USERES("Project1.res");
USEFORM("Unit1.cpp", Form1);
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
unit1.cpp
#include
#pragma hdrstop
#include "Unit1.h"
#pragma package(smart_init)
#pragma link "HTTSLib_OCX"
#pragma resource "*.dfm"
TForm1 *Form1;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString c;
c="good";
TextToSpeech1->Speak((WideString)c);
}
unit1.h
#ifndef Unit1H
#define Unit1H
#include
#include
#include
#include
#include "HTTSLib_OCX.h"
#include
class TForm1 : public TForm
{
__published: // IDE-managed Components
TTextToSpeech *TextToSpeech1;
TButton *Button1;
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
extern PACKAGE TForm1 *Form1;
#endif
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-996068/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- javaSE總結(轉+總結)Java
- C# TTS-文字轉語音C#TTS
- 轉:Git 總結Git
- SmartForms總結(轉)ORM
- 在C++Builder使用TTS(Text To Speech) (轉)C++UITTS
- oracle可傳輸表空間TTS小結OracleTTS
- IOCP模型總結(轉)模型
- Enqueue整理總結(轉)ENQ
- iOS RAC 的使用總結 (轉載)iOS
- Oracle常用的轉儲方法總結Oracle
- 一年工作的總結 (轉)
- 自己總結的V$檢視(轉)
- CCNA的SimulatorLab命令總結(轉)
- 讓你的Windows XP系統開口說話(TTS)(轉)WindowsTTS
- TTS 擂臺: 文字轉語音模型的自由搏擊場TTS模型
- TTS技術TTS
- 再次接觸tts的特性TTS
- ANT命令總結(轉載)
- Oracle 行列轉換總結Oracle
- oracle 轉義字元 總結Oracle字元
- ORACLE壞塊總結(轉)Oracle
- 個人工作總結(轉)
- Oracle 9.2.0.4 DataGuard 總結(轉)Oracle
- Oracle行列轉換總結Oracle
- RMAN 總結篇 1 - (轉)
- RMAN 總結篇 2 - (轉)
- RMAN 總結篇 3 - (轉)
- android WebView總結(轉)AndroidWebView
- GeoTiff探索成果總結 (轉)
- TTS朗讀中文(using sapi sdk5) (轉)TTSAPI
- oracle 體系 & hints的用法總結(轉)Oracle
- 讀egyle的sga調整總結(轉)
- data buffer cache的一點總結 -- 轉
- DW屬性設定的總結 (轉)
- 軟體工程師的年終總結 (轉)軟體工程工程師
- TTS 演算法對比:DNN 結果和 HMM 演算法結果TTS演算法DNNHMM
- SAP轉儲單全面總結
- 【轉】Qt資料庫總結QT資料庫