Speak Method

Returns a string which is a URL to a wave or mp3 stream of the passed-in text being spoken in the desired language.

Request URI

URI parameters
Parameter Description


Required. A string containing "Bearer" + " " + access token.


Required. A string containing a sentence or sentences of the specified language to be spoken for the wave stream. The size of the text to speak must not exceed 2000 characters.


Required. A string representing the supported language code to speak the text in. The code must be present in the list of codes returned from the method GetLanguagesForSpeak.


Optional. A string specifying the content-type ID. Currently, “audio/wav” and “audio/mp3” are available. The default value is "audio/wav".


Optional. A string specifying the quality of the audio signals. Currently, “MaxQuality” and “MinSize” are available. With “MaxQuality”, you can get the voice(s) with the highest quality, and with “MinSize”, you can get the voices with the smallest size. If no value is provided, we default to “MinSize”.

Return value
Returns a string which is a URL to a wave or mp3 stream of the passed-in text being spoken in the desired language.

Ff512405.alert_note(en-us,MSDN.10).gif Note

Bing App ID is deprecated and is no longer supported.   Please obtain an access token to use the Microsoft Translator API. For details, go here.


Obtain an Access Token on the server-side

public static AdmAccessToken GetAccessToken()
    AdmAccessToken admToken;
    string headerValue;
    //Get Client Id and Client Secret from https://datamarket.azure.com/developer/applications/
    AdmAuthentication admAuth = new AdmAuthentication("clientid", "clientsecret");

    admToken = admAuth.GetAccessToken();
    // Create a header with the access_token property of the returned token
    headerValue = "Bearer" + " " + HttpUtility.UrlEncode(admToken.access_token);

    return admToken;
Invoke the AJAX method on the client-side

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript">
        var language = "en";
        var format = "audio/mp3";
        var option = "MinSize"
        var text = "Use pixels to express.";
        function speak() {
            PageMethods.GetAccessToken(OnSucceeded, OnFailed);
        function OnSucceeded(result, usercontext, methodName) {

            window.mycallback = function (response) { alert(response); }

            var s = document.createElement("script");
            s.src = "http://api.microsofttranslator.com/V2/Ajax.svc/Speak?oncomplete=mycallback&appId=Bearer " + encodeURIComponent(result.access_token) + "&text=" + text + "&language=" + language + "&format=" + format;
        function OnFailed(error, userContext, methodName) {
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="true" />
        <asp:Button ID="buttonSpeak" runat="server" Text="Speak" OnClientClick="speak();return false;" />
        <br />
        <asp:Label ID="lblResult" runat="server"></asp:Label>