How to Use HCTTS Service on MVC Web Application

Download sample source code     中文版
1. Add a Service Reference on your MVC application

Let's use a .Net MVC project to explain how to add the HC text to speech functionality on your application. The first step is adding a service reference to link your project with HC cloud TTS service. To do this, right click References and choose Add Service References as bellow:

When the Add Service Reference form shown, enter


into the address box, and change the NameSpace to HCTTSServiceReference,

And click Ok to confirm. Now the screen will become as

2. Add a TextArea on View

Add the code to create a TextArea, as an example, let’s add the TextArea on the Index view:

3. Add Code on Controller

The code used to control the text to speech function could be as easy as bellow,

To see more details, click Download to get the sample project source code.