GetTTSInMP3
Use this method to convert text into a sound file encoded in MP3 format. Returns an MP3 encoded in 32,64, or 128. Requires additional License Key. Call 1-800-984-3710 or log in at www.esendex.us to activate the TTS License Key. This key allows you to use the direct download TTS from webservices like Notify. This only allows for TTS to Sound Files. Phone Notify allows use of TTS in the notification call without this key.
Syntax
GetTTSInMP3(TextToSay, VoiceID, BitRate, TTSrate, TTSvolume, LicenseKey)
Request Parameters
Parameter Name | Description | Data Type | Required | Sample Value |
---|---|---|---|---|
TextToSay |
The text-to-speech text or combination of text-to-speech and script to be read to the receiving party. |
String
|
Hello, this is a sample call from Phone Notify. | |
VoiceID |
The text-to-speech voice ID. |
Integer
|
2 | |
BitRate |
The bitrate for returned MP3 file. 128 is common for bandwidth reasons while 192 and 256 are utilized for higher quality larger file sizes. |
Integer
|
128 | |
TTSrate |
The speed that text-to-speech (TTS) will use when speaking the text. The value ranges from 0 to 20 (10 being normal). This can also be controlled within the |
UnsignedByte
|
7 | |
TTSvolume |
The volume that text-to-speech (TTS) will use when speaking the text. The value ranges from 0 to 100 (100 is the default). This can also be controlled within the |
UnsignedByte
|
90 | |
LicenseKey |
Your license key, which is required to invoke this web service. |
String
|
F01d89fd-5155-5455-5585-e84ab8de8591 |
Response
Returns: Base64Binary
Description: The result of the text-to-speech file request in MP3 format.
Code Samples
/* https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl was added as a Web Reference and given the name WSDL */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GetTTSInMP3.WSDL;
namespace GetTTSInMP3
{
class Program
{
static void Main(string[] args)
{
WSDL.PhoneNotify PN = new WSDL.PhoneNotify();
WSDL.NotifyReturn NR = new WSDL.NotifyReturn();
byte[] MP3 = PN.GetTTSInMP3("Hello this phone notify TTS to MP3 test.", 2, 128, 6, 100, "YOUR LICENSE KEY");
System.IO.FileStream FS = new System.IO.FileStream(@"C:\Users\Desktop\TTS-MP3.mp3", System.IO.FileMode.Create, System.IO.FileAccess.Write);
FS.Write(MP3, 0, MP3.Length);
FS.Close();
Console.WriteLine("File saved to: " + @"C:\Users\Desktop\TTS-MP3.mp3");
Console.ReadLine();
}
}
}
' https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl was added as a Web Reference and given the name WSDL
Imports GetTTSInMP3.WSDL
Module Module1
Sub Main()
Dim PN As New WSDL.PhoneNotify
Dim NR As New WSDL.NotifyReturn
Dim MP3 As Array
Dim FS As System.IO.FileStream
MP3 = PN.GetTTSInMP3("Hello this phone notify TTS to MP3 test.", 2, 128, 6, 100, "YOUR LICENSE KEY")
FS = New System.IO.FileStream("C:\Users\Desktop\TTS-MP3.mp3", System.IO.FileMode.Create, System.IO.FileAccess.Write)
FS.Write(MP3, 0, MP3.Length)
FS.Close()
Console.WriteLine("File saved to: " & "C:\Users\Desktop\TTS-MP3.mp3")
Console.ReadLine()
End Sub
End Module
GET /NotifyWS/PhoneNotify.asmx/GetTTSInMP3?TextToSay=string&VoiceID=string&BitRate=string&TTSrate=string&TTSvolume=string&LicenseKey=string HTTP/1.1
Host: ws.esendex.us
POST /NotifyWS/PhoneNotify.asmx/GetTTSInMP3 HTTP/1.1
Host: ws.esendex.us
Content-Type: application/x-www-form-urlencoded
Content-Length: length
TextToSay=string&VoiceID=string&BitRate=string&TTSrate=string&TTSvolume=string&LicenseKey=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<base64Binary xmlns="http://ws.esendex.us/NotifyWS/">base64Binary</base64Binary>
POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://ws.esendex.us/NotifyWS/GetTTSInMP3"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetTTSInMP3 xmlns="http://ws.esendex.us/NotifyWS/">
<TextToSay>string</TextToSay>
<VoiceID>int</VoiceID>
<BitRate>int</BitRate>
<TTSrate>unsignedByte</TTSrate>
<TTSvolume>unsignedByte</TTSvolume>
<LicenseKey>string</LicenseKey>
</GetTTSInMP3>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetTTSInMP3Response xmlns="http://ws.esendex.us/NotifyWS/">
<GetTTSInMP3Result>base64Binary</GetTTSInMP3Result>
</GetTTSInMP3Response>
</soap:Body>
</soap:Envelope>
POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetTTSInMP3 xmlns="http://ws.esendex.us/NotifyWS/">
<TextToSay>string</TextToSay>
<VoiceID>int</VoiceID>
<BitRate>int</BitRate>
<TTSrate>unsignedByte</TTSrate>
<TTSvolume>unsignedByte</TTSvolume>
<LicenseKey>string</LicenseKey>
</GetTTSInMP3>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetTTSInMP3Response xmlns="http://ws.esendex.us/NotifyWS/">
<GetTTSInMP3Result>base64Binary</GetTTSInMP3Result>
</GetTTSInMP3Response>
</soap12:Body>
</soap12:Envelope>