Quickstart: Setup development environment

Choose your target environment

This guide shows how to install the Speech SDK for .NET Framework (Windows). If you just want the package name to get started on your own, run Install-Package Microsoft.CognitiveServices.Speech in the NuGet console.

Important

By downloading any of the Azure Cognitive Services Speech SDKs, you acknowledge its license. For more information, see:

Prerequisites

This quickstart requires:

Create a Visual Studio project and install the Speech SDK

You'll need to install the Speech SDK NuGet package so you can reference it in your code. To do that, you may first need to create a helloworld project. If you already have a project with the .NET desktop development workload available, you can use that project and skip to Use NuGet Package Manager to install the Speech SDK.

Create helloworld project

  1. Open Visual Studio 2019.

  2. In the Start window, select Create a new project.

  3. In the Create a new project window, choose Console App (.NET Framework), and then select Next.

  4. In the Configure your new project window, enter helloworld in Project name, choose or create the directory path in Location, and then select Create.

  5. From the Visual Studio menu bar, select Tools > Get Tools and Features, which opens Visual Studio Installer and displays the Modifying dialog box.

  6. Check whether the .NET desktop development workload is available. If the workload hasn't been installed, select the check box next to it, and then select Modify to start the installation. It may take a few minutes to download and install.

    If the check box next to .NET desktop development is already selected, select Close to exit the dialog box.

    Enable .NET desktop development

  7. Close Visual Studio Installer.

Use NuGet Package Manager to install the Speech SDK

  1. In the Solution Explorer, right-click the helloworld project, and then select Manage NuGet Packages to show the NuGet Package Manager.

    NuGet Package Manager

  2. In the upper-right corner, find the Package Source drop-down box, and make sure that nuget.org is selected.

  3. In the upper-left corner, select Browse.

  4. In the search box, type Microsoft.CognitiveServices.Speech and select Enter.

  5. From the search results, select the Microsoft.CognitiveServices.Speech package, and then select Install to install the latest stable version.

    Install Microsoft.CognitiveServices.Speech NuGet package

  6. Accept all agreements and licenses to start the installation.

    After the package is installed, a confirmation appears in the Package Manager Console window.

Choose target architecture

To build and run the console application, create a platform configuration matching your computer's architecture.

  1. From the menu bar, select Build > Configuration Manager. The Configuration Manager dialog box appears.

    Configuration Manager dialog box

  2. In the Active solution platform drop-down box, select New. The New Solution Platform dialog box appears.

  3. In the Type or select the new platform drop-down box:

    • If you're running 64-bit Windows, select x64.
    • If you're running 32-bit Windows, select x86.
  4. Select OK and then Close.

Next steps

Choose your target environment

This guide shows how to install the Speech SDK for Linux

Important

By downloading any of the Azure Cognitive Services Speech SDKs, you acknowledge its license. For more information, see:

System requirements

Linux; see the list of supported Linux distributions and target architectures.

Prerequisites

To complete this quickstart, you'll need:

  • Visual Studio 2019

  • Supported Linux platforms will require certain libraries installed (libssl for secure sockets layer support and libasound2 for sound support). Refer to your distribution below for the commands needed to install the correct versions of these libraries.

    • On Ubuntu/Debian:

      sudo apt-get update
      sudo apt-get install build-essential libssl1.0.0 libasound2 wget
      

      If libssl1.0.0 is not available, install libssl1.0.x (where x is greater than 0) or libssl1.1 instead.

    • On RHEL/CentOS:

      sudo yum update
      sudo yum groupinstall "Development tools"
      sudo yum install alsa-lib openssl wget
      

Note

Install Speech SDK

The Speech SDK for Linux can be used to build both 64-bit and 32-bit applications. The required libraries and header files can be downloaded as a tar file from https://aka.ms/csspeech/linuxbinary.

Download and install the SDK as follows:

  1. Choose a directory to which the Speech SDK files should be extracted, and set the SPEECHSDK_ROOT environment variable to point to that directory. This variable makes it easy to refer to the directory in future commands. For example, if you want to use the directory speechsdk in your home directory, use a command like the following:

    export SPEECHSDK_ROOT="$HOME/speechsdk"
    
  2. Create the directory if it doesn't exist yet.

    mkdir -p "$SPEECHSDK_ROOT"
    
  3. Download and extract the .tar.gz archive containing the Speech SDK binaries:

    wget -O SpeechSDK-Linux.tar.gz https://aka.ms/csspeech/linuxbinary
    tar --strip 1 -xzf SpeechSDK-Linux.tar.gz -C "$SPEECHSDK_ROOT"
    
  4. Validate the contents of the top-level directory of the extracted package:

    ls -l "$SPEECHSDK_ROOT"
    

    The directory listing should contain the third-party notice and license files, as well as an include directory containing header (.h) files and a lib directory containing libraries.

    Path Description
    license.md License
    ThirdPartyNotices.md Third-party notices.
    REDIST.txt Redistribution notice.
    include The required header files for C and C++
    lib/x64 Native library for x64 required to link your application
    lib/x86 Native library for x86 required to link your application

Next steps

Choose your target environment

This guide shows how to install the Speech SDK for 64-bit Java 8 JRE. If you just want the package name to get started on your own, the Java SDK is not available in the Maven central repository. Whether you're using Gradle or a pom.xml dependency file, you need to add a custom repository pointing to https://csspeechstorage.blob.core.windows.net/maven/ (see below for package name).

Note

For the Speech Devices SDK and the Roobo device, see Speech Devices SDK.

Important

By downloading any of the Azure Cognitive Services Speech SDKs, you acknowledge its license. For more information, see:

Supported operating systems

Prerequisites

  • Java 8 or JDK 8

  • Eclipse Java IDE (requires Java already installed)

  • Supported Linux platforms will require certain libraries installed (libssl for secure sockets layer support and libasound2 for sound support). Refer to your distribution below for the commands needed to install the correct versions of these libraries.

    • On Ubuntu/Debian, run the following commands to install the required packages:

      sudo apt-get update
      sudo apt-get install build-essential libssl1.0.0 libasound2
      

      If libssl1.0.0 is not available, install libssl1.0.x (where x is greater than 0) or libssl1.1 instead.

    • On RHEL/CentOS, run the following commands to install the required packages:

      sudo yum update
      sudo yum install alsa-lib java-1.8.0-openjdk-devel openssl
      

Note

Create an Eclipse project and install the Speech SDK

  1. Start Eclipse.

  2. In the Eclipse Launcher, in the Workspace field, enter the name of a new workspace directory. Then select Launch.

    Screenshot of Eclipse Launcher

  3. In a moment, the main window of the Eclipse IDE appears. Close the Welcome screen if one is present.

  4. From the Eclipse menu bar, create a new project by choosing File > New > Project.

  5. The New Project dialog box appears. Select Java Project, and select Next.

    Screenshot of New Project dialog box, with Java Project highlighted

  6. The New Java Project wizard starts. In the Project name field, enter quickstart, and choose JavaSE-1.8 as the execution environment. Select Finish.

    Screenshot of New Java Project wizard

  7. If the Open Associated Perspective? window appears, select Open Perspective.

  8. In the Package explorer, right-click the quickstart project. Choose Configure > Convert to Maven Project from the context menu.

    Screenshot of Package explorer

  9. The Create new POM window appears. In the Group Id field, enter com.microsoft.cognitiveservices.speech.samples, and in the Artifact Id field, enter quickstart. Then select Finish.

    Screenshot of Create new POM window

  10. Open the pom.xml file and edit it.

    • At the end of the file, before the closing tag </project>, create a repositories element with a reference to the Maven repository for the Speech SDK, as shown here:

      <repositories>
        <repository>
          <id>maven-cognitiveservices-speech</id>
          <name>Microsoft Cognitive Services Speech Maven Repository</name>
          <url>https://csspeechstorage.blob.core.windows.net/maven/</url>
        </repository>
      </repositories>
      
    • Also add a dependencies element, with the Speech SDK version 1.13.0 as a dependency:

      <dependencies>
        <dependency>
          <groupId>com.microsoft.cognitiveservices.speech</groupId>
          <artifactId>client-sdk</artifactId>
          <version>1.12.1</version>
        </dependency>
      </dependencies>
      
    • Save the changes.

Next steps

This guide shows how to install the Speech SDK for Python. If you just want the package name to get started on your own, run pip install azure-cognitiveservices-speech.

Important

By downloading any of the Azure Cognitive Services Speech SDKs, you acknowledge its license. For more information, see:

Supported operating systems

Prerequisites

  • Supported Linux platforms will require certain libraries installed (libssl for secure sockets layer support and libasound2 for sound support). Refer to your distribution below for the commands needed to install the correct versions of these libraries.

    • On Ubuntu/Debian, run the following commands to install the required packages:

      sudo apt-get update
      sudo apt-get install build-essential libssl1.0.0 libasound2
      

      If libssl1.0.0 is not available, install libssl1.0.x (where x is greater than 0) or libssl1.1 instead.

    • On RHEL/CentOS, run the following commands to install the required packages:

      sudo yum update
      sudo yum install alsa-lib openssl python3
      

Note

  • On Windows, you need the Microsoft Visual C++ Redistributable for Visual Studio 2019 for your platform. Note that installing this for the first time may require you to restart Windows before continuing with this guide.
  • And finally, you'll need Python 3.5 to 3.8. To check your installation, open a command prompt and type the command python --version and check the result. If it's installed properly, you'll get a response "Python 3.5.1" or similar.

Install the Speech SDK from PyPI

If you're using your own environment or build tools, run the following command to install the Speech SDK from PyPI. For users of Visual Studio Code, skip to the next sub-section for guided installation.

pip install azure-cognitiveservices-speech

If you are on macOS, you may need to run the following command to get the pip command above to work:

python3 -m pip install --upgrade pip

Once you've successfully used pip to install azure-cognitiveservices-speech, you can use the Speech SDK by importing the namespace into your Python projects.

import azure.cognitiveservices.speech as speechsdk

Install the Speech SDK using Visual Studio Code

  1. Download and install the latest supported version of Python for your platform, 3.5 to 3.8.

    • Windows users make sure to select "Add Python to your PATH" during the installation process.
  2. Download and install Visual Studio Code.

  3. Open Visual Studio Code and install the Python extension. Select File > Preferences > Extensions from the menu. Search for Python and click Install.

    Install the Python extension

  4. Also from within Visual Studio Code, install the Speech SDK Python package from the integrated command line:

    1. Open a terminal (from the drop-down menus, Terminal > New Terminal)
    2. In the terminal that opens, enter the command python -m pip install azure-cognitiveservices-speech

If you are new to Visual Studio Code, refer to the more extensive Visual Studio Code Documentation. For more information about Visual Studio Code and Python, see Visual Studio Code Python tutorial.

Support and updates

Updates to the Speech SDK Python package are distributed via PyPI and announced in the Release notes. If a new version is available, you can update to it with the command pip install --upgrade azure-cognitiveservices-speech. Check which version is currently installed by inspecting the azure.cognitiveservices.speech.__version__ variable.

If you have a problem, or you're missing a feature, see Support and help options.

Next steps

This guide shows how to install the Speech SDK for Linux

Important

By downloading any of the Azure Cognitive Services Speech SDKs, you acknowledge its license. For more information, see:

System requirements

Linux; see the list of supported Linux distributions and target architectures.

Prerequisites

To complete this quickstart, you'll need:

  • gcc

  • Go binary (1.13 or later)

  • Supported Linux platforms will require certain libraries installed (libssl for secure sockets layer support and libasound2 for sound support). Refer to your distribution below for the commands needed to install the correct versions of these libraries.

    • On Ubuntu/Debian:

      sudo apt-get update
      sudo apt-get install build-essential libssl1.0.0 libasound2 wget
      

      If libssl1.0.0 is not available, install libssl1.0.x (where x is greater than 0) or libssl1.1 instead.

    • On RHEL/CentOS:

      sudo yum update
      sudo yum groupinstall "Development tools"
      sudo yum install alsa-lib openssl wget
      

Note

Install Speech SDK

The Speech SDK for Linux can be used to build both 64-bit and 32-bit applications. The required libraries and header files can be downloaded as a tar file from https://aka.ms/csspeech/linuxbinary.

Download and install the SDK as follows:

  1. Choose a directory to which the Speech SDK files should be extracted, and set the SPEECHSDK_ROOT environment variable to point to that directory. This variable makes it easy to refer to the directory in future commands. For example, if you want to use the directory speechsdk in your home directory, use a command like the following:

    export SPEECHSDK_ROOT="$HOME/speechsdk"
    
  2. Create the directory if it doesn't exist yet.

    mkdir -p "$SPEECHSDK_ROOT"
    
  3. Download and extract the .tar.gz archive containing the Speech SDK binaries:

    wget -O SpeechSDK-Linux.tar.gz https://aka.ms/csspeech/linuxbinary
    tar --strip 1 -xzf SpeechSDK-Linux.tar.gz -C "$SPEECHSDK_ROOT"
    
  4. Validate the contents of the top-level directory of the extracted package:

    ls -l "$SPEECHSDK_ROOT"
    

    The directory listing should contain the third-party notice and license files, as well as an include directory containing header (.h) files and a lib directory containing libraries.

    Path Description
    license.md License
    ThirdPartyNotices.md Third-party notices.
    REDIST.txt Redistribution notice.
    include The required header files for C and C++
    lib/x64 Native library for x64 required to link your application
    lib/x86 Native library for x86 required to link your application

Configure Go environment

  1. Since the bindings rely on cgo, you need to set the environment variables so Go can find the SDK:

    export CGO_CFLAGS="-I$SPEECHSDK_ROOT/include/c_api"
    export CGO_LDFLAGS="-L$SPEECHSDK_ROOT/lib -lMicrosoft.CognitiveServices.Speech.core"
    
  2. Additionally, to run applications including the SDK, we need to tell the OS where to find the libs:

    export LD_LIBRARY_PATH="$SPEECHSDK_ROOT/lib/<arch>:$LD_LIBRARY_PATH"
    

Next steps


Choose your target environment

This guide shows how to install the Speech SDK for JavaScript for use with a web page.

Important

By downloading any of the Azure Cognitive Services Speech SDKs, you acknowledge its license. For more information, see:

Create a new Website folder

Create a new, empty folder. In case you want to host the sample on a web server, make sure that the web server can access the folder.

Unpack the Speech SDK for JavaScript into that folder

Download the Speech SDK as a .zip package and unpack it into the newly created folder. This results in five files being unpacked:

  • microsoft.cognitiveservices.speech.sdk.bundle.js A human readable version of the Speech SDK.
  • microsoft.cognitiveservices.speech.sdk.bundle.js.map A map file used for debugging SDK code.
  • microsoft.cognitiveservices.speech.sdk.bundle.d.ts Object definitions for use with TypeScript
  • microsoft.cognitiveservices.speech.sdk.bundle-min.js A minified version of the Speech SDK.
  • speech-processor.js Code to improve performance on some browsers.

Create an index.html page

Create a new file in the folder, named index.html and open this file with a text editor.

Next steps