添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge

Reference documentation | Package (NuGet) | Additional Samples on GitHub

This guide shows how to install the Speech SDK for C#.

Code samples in the documentation are written in C# 8 and run on .NET standard 2.0.

Platform requirements

The Speech SDK for C# is compatible with Windows, Linux, and macOS.

Windows Linux macOS

On Windows, you must use the 64-bit target architecture. Windows 10 or later is required.

You must install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, 2019, and 2022 for your platform. Installing this package for the first time might require a restart.

The Speech SDK for C# only supports Ubuntu 18.04/20.04/22.04 , Debian 10/11 , Red Hat Enterprise Linux (RHEL) 7/8 , and CentOS 7/8 on the following architectures when used with Linux: x64, ARM32 (Debian/Ubuntu), and ARM64 (Debian/Ubuntu)

Important

Use the most recent LTS release of the Linux distribution. For example, if you are using Ubuntu 20.04 LTS, use the latest release of Ubuntu 20.04.X.

The Speech SDK depends on the following Linux system libraries:

  • The shared libraries of the GNU C library, including the POSIX Threads Programming library, libpthreads
  • The OpenSSL library ( libssl ) version 1.x and certificates ( ca-certificates )
  • The shared library for ALSA applications ( libasound )
  • You should also install ca-certificates to establish a secure websocket and avoid the WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED error.
  • Important

    The Speech SDK does not yet support OpenSSL 3.0, which is the default in Ubuntu 22.04 and Debian 12.

    To install OpenSSL 1.x from sources on Debian/Ubuntu based systems that don't have it, do:

    wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf -
    cd openssl-1.1.1u
    ./config --prefix=/usr/local
    make -j $(nproc)
    sudo make install_sw install_ssldirs
    sudo ldconfig -v
    export SSL_CERT_DIR=/etc/ssl/certs
    

    Notes on installation:

  • Check https://www.openssl.org/source/ for the latest OpenSSL 1.x version to use.
  • The setting of SSL_CERT_DIR must be in effect systemwide or at least in the console where applications that use the Speech SDK are launched from, otherwise OpenSSL 1.x installed in /usr/local may not find certificates.
  • Ensure that the console output from ldconfig -v includes /usr/local/lib as it should on modern systems by default. If this isn't the case, set LD_LIBRARY_PATH (with the same scope as SSL_CERT_DIR) to add /usr/local/lib to the library path:
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    

    To use the Speech SDK in Alpine Linux, create a Debian chroot environment as documented in the Alpine Linux Wiki on running glibc programs. Then follow the Debian instructions here.

    sudo apt-get update
    sudo apt-get install build-essential libssl-dev ca-certificates libasound2 wget
    

    Install the development tools and libraries:

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

    Important

  • On RHEL/CentOS 7, follow the instructions on how to configure RHEL/CentOS 7 for Speech SDK.
  • On RHEL/CentOS 8, follow the instructions on how to configure OpenSSL for Linux.
  • The Speech SDK for C# can be installed from the .NET CLI with the following dotnet add command:

    dotnet add package Microsoft.CognitiveServices.Speech
    

    This guide shows how to install the Speech SDK for a .NET Framework (Windows) console app.

    Prerequisites

    This guide requires:

  • Microsoft Visual C++ Redistributable for Visual Studio 2019 for the Windows platform. Installing it for the first time might require a restart.
  • Visual Studio 2019.
  • Create a Visual Studio project and install the Speech SDK

    You need to install the Speech SDK NuGet package so you can reference it in your code. To do that, you might 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 a helloworld project

  • Open Visual Studio 2019.

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

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

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

  • From the Visual Studio menu bar, select Tools > Get Tools and Features. This step opens Visual Studio Installer and displays the Modifying dialog.

  • 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 might take a few minutes to download and install.

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

  • Close Visual Studio Installer.

    Use NuGet Package Manager to install the Speech SDK

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

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

  • In the upper-left corner, select Browse.

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

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

  • 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 that matches your computer's architecture.

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

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

  • 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.
  • Select OK and then Close.

    This guide shows how to install the Speech SDK for a .NET Core console app. .NET Core is an open-source, cross-platform .NET platform that implements the .NET Standard specification.

    Prerequisites

    This guide requires:

  • Microsoft Visual C++ Redistributable for Visual Studio 2019 for the Windows platform. Installing it for the first time might require a restart.
  • .NET Core SDK.
  • Visual Studio 2017 or later.
  • Create a Visual Studio project and install the Speech SDK

  • Start Visual Studio 2019.

  • Make sure the .NET cross-platform development workload is available. Select Tools > Get Tools and Features from the Visual Studio menu bar to open the Visual Studio installer. If this workload is already enabled, close the dialog.

    Otherwise, select the box next to .NET Core cross-platform development, and select Modify at the lower-right corner of the dialog. Installation of the new feature will take a moment.

  • Create a new Visual C# .NET Core console app. In the New Project dialog, from the left pane, expand Installed > Visual C# > .NET Core. Then select Console App (.NET Core). For the project name, enter helloworld.

  • Install and reference the Speech SDK NuGet package. In Solution Explorer, right-click the solution and select Manage NuGet Packages for Solution.

  • In the upper-right corner, in the Package Source box, select nuget.org. Search for the Microsoft.CognitiveServices.Speech package, and install it into the helloworld project.

  • Accept the displayed license to begin installation of the NuGet package.

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

    This guide shows how to install the Speech SDK for Unity.

    For Unity development, the Speech SDK supports Windows Desktop (x86 and x64) or Universal Windows Platform (x86, x64, ARM/ARM64), Android (x86, ARM32/64), iOS (x64 simulator and ARM64), and Mac (x64).

    Prerequisites

    This guide requires:

  • Microsoft Visual C++ Redistributable for Visual Studio 2019 for the Windows platform. Installing it for the first time might require a restart.
  • Unity 2018.3 or later with Unity 2019.1 adding support for UWP ARM64.
  • Visual Studio 2019. Version 15.9 or later of Visual Studio 2017 is also acceptable.
  • For Windows ARM64 support, installation of the optional build tools for ARM64 and the Windows 10 SDK for ARM64.
  • On Android, an ARM-based Android device (API 23: Android 6.0 Marshmallow or later) enabled for development with a working microphone.
  • On iOS, an iOS device (ARM64) enabled for development with a working microphone.
  • On macOS, a Mac device (x64) and the latest LTS version of Unity 2019 (or later) for integrated support for microphone access in Unity Player settings.
  • Install the Speech SDK for Unity

    To install the Speech SDK for Unity, follow these steps:

  • Download and open the Speech SDK for Unity. It's packaged as a Unity asset package (.unitypackage) and should already be associated with Unity. When the asset package is opened, the Import Unity Package dialog appears. You might need to create and open an empty project for this step to work.

  • Ensure that all files are selected, and then select Import. After a few moments, the Unity asset package is imported into your project.

    For more information about importing asset packages into Unity, see the Unity documentation.

    This guide shows how to create a Universal Windows Platform (UWP) project and install the Speech SDK for C#. The Universal Windows Platform lets you develop apps that run on any device that supports Windows 10, including PCs, Xbox, Surface Hub, and other devices.

    Prerequisites

    This guide requires:

  • Microsoft Visual C++ Redistributable for Visual Studio 2019 for the Windows platform. Installing this for the first time might require a restart.
  • Visual Studio 2019 (any edition).
  • Create a Visual Studio project and install the Speech SDK

    To create a Visual Studio project for UWP development, you need to:

  • Set up Visual Studio development options.
  • Create the project and select the target architecture.
  • Set up audio capture.
  • Install the Speech SDK.
  • Set up Visual Studio development options

    To start, make sure you're set up correctly in Visual Studio for UWP development:

  • Open Visual Studio 2019 to display the start window.

  • Select Continue without code to go to the Visual Studio IDE.

  • From the Visual Studio menu bar, select Tools > Get Tools and Features to open Visual Studio Installer and view the Modifying dialog.

  • On the Workloads tab, under Windows, find the Universal Windows Platform development workload. If the check box next to that workload is already selected, close the Modifying dialog and go to step 7.

  • Select the Universal Windows Platform development check box, and then select Modify.

  • In the Before we get started dialog, select Continue to install the UWP development workload. Installation of the new feature might take a while.

  • Close Visual Studio Installer.

    Create the project

    Next, create your project and select the target architecture:

  • On the Visual Studio menu bar, select File > New > Project to display the Create a new project window.

  • Find and select Blank App (Universal Windows). Make sure that you select the C# version of this project type (as opposed to Visual Basic).

  • Select Next.

  • In the Configure your new project dialog, in Project name, enter helloworld.

  • In Location, go to and select (or create) the folder where you want to save your project.

  • Select Create.

  • In the New Universal Windows Platform Project window, in Minimum version (the second drop-down box), select Windows 10 Fall Creators Update (10.0; Build 16299). That's the minimum requirement for the Speech SDK.

  • In Target version (the first drop-down box), choose a value identical to or later than the value in Minimum version.

  • Select OK. You're returned to the Visual Studio IDE, with the new project created and visible on the Solution Explorer pane.

  • Select your target platform architecture. On the Visual Studio toolbar, find the Solution Platforms drop-down box. If you don't see it, select View > Toolbars > Standard to display the toolbar that contains Solution Platforms.

    If you're running 64-bit Windows, select x64 in the drop-down box. 64-bit Windows can also run 32-bit applications, so you can choose x86 if you prefer.

    The Speech SDK supports all Intel-compatible processors, but only x64 versions of ARM processors.

    Set up audio capture

    Allow the project to capture audio input:

  • In Solution Explorer, double-select Package.appxmanifest to open the package application manifest.

  • Select the Capabilities tab.

  • Select the box for the Microphone capability.

  • From the menu bar, select File > Save Package.appxmanifest to save your changes.

    Install the Speech SDK for UWP

    Finally, install the Speech SDK NuGet package, and reference the Speech SDK in your project:

  • In Solution Explorer, right-click your solution, and select Manage NuGet Packages for Solution to go to the NuGet - Solution window.

  • Select Browse.

  • In Package source, select nuget.org.

  • In the Search box, enter Microsoft.CognitiveServices.Speech. Choose that package after it appears in the search results.

  • In the package status pane next to the search results, select your helloworld project.

  • Select Install.

  • In the Preview Changes dialog, select OK.

  • In the License Acceptance dialog, view the license, and then select I Accept. The package installation begins. When installation is complete, the Output pane displays a message that's similar to the following text: Successfully installed 'Microsoft.CognitiveServices.Speech 1.15.0' to helloworld.

    This guide shows how to create a Xamarin forms project and install the Speech SDK. Xamarin is an open-source platform for building modern and performant applications for iOS, Android, and Windows by using .NET.

    For Xamarin development, the Speech SDK supports Windows Desktop (x86 and x64) or Universal Windows Platform (x86, x64, ARM/ARM64), Android (x86, ARM32/64), and iOS (x64 simulator and ARM64).

    Prerequisites

    This guide requires:

  • Microsoft Visual C++ Redistributable for Visual Studio 2019 for the Windows platform. Installing it for the first time might require a restart.
  • Visual Studio 2019.
  • Create a Visual Studio project and install the Speech SDK

    To create a Visual Studio project for cross-platform mobile app development with .NET and Xamarin, you need to:

  • Set up Visual Studio development options.
  • Create the project and select the target architecture.
  • Install the Speech SDK.
  • Set up Visual Studio development options

    To start, make sure you're set up correctly in Visual Studio for cross-platform mobile development with .NET:

  • Open Visual Studio 2019.

  • From the Visual Studio menu bar, select Tools > Get Tools and Features to open Visual Studio Installer and view the Modifying dialog.

  • On the Workloads tab, under Windows, find the Mobile development with .NET workload. If the check box next to that workload is already selected, close the Modifying dialog and go to step 6.

  • Select the Mobile development with .NET check box, and then select Modify.

  • In the Before we get started dialog, select Continue to install the workload for mobile development with .NET. Installation of the new feature might take a while.

  • Close Visual Studio Installer.

    Create the project

    Next, create your project and select the target architecture:

  • On the Visual Studio menu bar, select File > New > Project to display the Create a new project window.

  • Find and select Mobile App (Xamarin.Forms).

  • Select Next.

  • In the Configure your new project dialog, in Project name, enter helloworld.

  • In Location, go to and select or create the folder where you want to save your project.

  • Select Create.

  • In the New Cross Platform App window, select the Blank template, and then select OK.

  • In Platform, select the boxes for Android, iOS, and Windows (UWP).

  • Select OK. You're returned to the Visual Studio IDE, with the new project created and visible in the Solution Explorer pane.

  • Select your target platform architecture and startup project. On the Visual Studio toolbar, find the Solution Platforms drop-down box. If you don't see it, select View > Toolbars > Standard to display the toolbar that contains Solution Platforms.

    If you're running 64-bit Windows, select x64 in the drop-down box. You can select x86 if you want because 64-bit Windows also can run 32-bit applications.

    In the Start-up Projects drop-down box, select helloworld.UWP (Universal Windows).

    Install the Speech SDK for Xamarin

    Install the Speech SDK NuGet package, and reference the Speech SDK in your project:

  • In Solution Explorer, right-click your solution. Select Manage NuGet Packages for Solution to go to the NuGet - Solution window.

  • Select Browse.

  • In Package source, select nuget.org.

  • In the Search box, enter Microsoft.CognitiveServices.Speech. Then select that package after it appears in the search results.

    The iOS library inside Microsoft.CognitiveServices.Speech NuGet doesn't have bitcode enabled. If you need the bitcode library enabled for your application, use Microsoft.CognitiveServices.Speech.Xamarin.iOS NuGet for the iOS project specifically.

  • In the package status pane next to the search results, select all projects: helloworld, helloworld.Android, helloworld.iOS, and helloworld.UWP.

  • Select Install.

  • In the Preview Changes dialog, select OK.

  • In the License Acceptance dialog, view the license, and then select I Accept. Install the Speech SDK package reference to all projects.

    After installation finishes successfully, you might see the following warning for helloworld.iOS. This is a known issue and should not affect your app's functionality.

    Could not resolve reference "C:\Users\Default\.nuget\packages\microsoft.cognitiveservices.speech\1.7.0\build\Xamarin.iOS\libMicrosoft.CognitiveServices.Speech.core.a". If this reference is required by your code, you may get compilation errors.

    The Speech SDK is now installed. You can now delete or reuse the helloworld project that you created in the previous steps.

    Reference documentation | Package (NuGet) | Additional Samples on GitHub

    This guide shows how to install the Speech SDK for C++.

    Platform requirements

    The Speech SDK for C++ is compatible with Windows, Linux, and macOS.

    Windows Linux macOS

    On Windows, you must use the 64-bit target architecture. Windows 10 or later is required.

    You must install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, 2019, and 2022 for your platform. Installing this package for the first time might require a restart.

    The Speech SDK for C++ only supports Ubuntu 18.04/20.04/22.04, Debian 10/11, Red Hat Enterprise Linux (RHEL) 7/8, and CentOS 7/8 on the following architectures when used with Linux: x86 (Debian/Ubuntu), x64, ARM32 (Debian/Ubuntu), and ARM64 (Debian/Ubuntu)

    Important

    Use the most recent LTS release of the Linux distribution. For example, if you are using Ubuntu 20.04 LTS, use the latest release of Ubuntu 20.04.X.

    The Speech SDK depends on the following Linux system libraries:

  • The shared libraries of the GNU C library, including the POSIX Threads Programming library, libpthreads
  • The OpenSSL library (libssl) version 1.x and certificates (ca-certificates)
  • The shared library for ALSA applications (libasound)
  • You should also install ca-certificates to establish a secure websocket and avoid the WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED error.
  • Important

    The Speech SDK does not yet support OpenSSL 3.0, which is the default in Ubuntu 22.04 and Debian 12.

    To install OpenSSL 1.x from sources on Debian/Ubuntu based systems that don't have it, do:

    wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf -
    cd openssl-1.1.1u
    ./config --prefix=/usr/local
    make -j $(nproc)
    sudo make install_sw install_ssldirs
    sudo ldconfig -v
    export SSL_CERT_DIR=/etc/ssl/certs
    

    Notes on installation:

  • Check https://www.openssl.org/source/ for the latest OpenSSL 1.x version to use.
  • The setting of SSL_CERT_DIR must be in effect systemwide or at least in the console where applications that use the Speech SDK are launched from, otherwise OpenSSL 1.x installed in /usr/local may not find certificates.
  • Ensure that the console output from ldconfig -v includes /usr/local/lib as it should on modern systems by default. If this isn't the case, set LD_LIBRARY_PATH (with the same scope as SSL_CERT_DIR) to add /usr/local/lib to the library path:
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    

    To use the Speech SDK in Alpine Linux, create a Debian chroot environment as documented in the Alpine Linux Wiki on running glibc programs. Then follow the Debian instructions here.

    sudo apt-get update
    sudo apt-get install build-essential libssl-dev ca-certificates libasound2 wget
    

    Install the development tools and libraries:

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

    Important

  • On RHEL/CentOS 7, follow the instructions on how to configure RHEL/CentOS 7 for Speech SDK.
  • On RHEL/CentOS 8, follow the instructions on how to configure OpenSSL for Linux.
  • The Speech SDK for C# can be installed from the .NET CLI with the following dotnet add command:

    dotnet add package Microsoft.CognitiveServices.Speech
    

    This guide shows how to install the Speech SDK for Linux.

    Use the following procedure to download and install the SDK. The steps include downloading the required libraries and header files as a .tar file from https://aka.ms/csspeech/linuxbinary.

  • 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"
    
  • Create the directory if it doesn't exist yet:

    mkdir -p "$SPEECHSDK_ROOT"
    
  • Download and extract the .tar.gz archive that contains 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"
    
  • 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. The listing should also contain an include directory that holds header (.h) files and a lib directory that holds libraries for arm32, arm64, x64, and x86.

    Description

    This guide shows how to install the Speech SDK for C++ on macOS 10.14 or later. The steps include downloading the required libraries and header files as a .zip file from https://aka.ms/csspeech/macosbinary.

  • 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"
    
  • Create the directory if it doesn't exist yet:

    mkdir -p "$SPEECHSDK_ROOT"
    
  • Download and extract the .zip archive that contains the Speech SDK XCFramework:

    wget -O SpeechSDK-macOS.zip https://aka.ms/csspeech/macosbinary
    unzip SpeechSDK-macOS.zip -d "$SPEECHSDK_ROOT"
    
  • 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, license files, and a MicrosoftCognitiveServicesSpeech.xcframework directory.

    This guide shows how to install the Speech SDK for C++ on Windows desktop operating systems.

    This setup guide requires:

  • Microsoft Visual C++ Redistributable for Visual Studio 2019 for the Windows platform. Installing it for the first time might require a restart.
  • Visual Studio 2019.
  • Create a project in Visual Studio and install the Speech SDK

    To create a Visual Studio project for C++ desktop development, you need to:

  • Set up Visual Studio development options.
  • Create the project.
  • Select the target architecture.
  • Install the Speech SDK.
  • Set up Visual Studio development options

    To start, make sure you're set up correctly in Visual Studio for C++ desktop development:

  • Open Visual Studio 2019 to display the start window.

  • Select Continue without code to go to the Visual Studio IDE.

  • From the Visual Studio menu bar, select Tools > Get Tools and Features to open Visual Studio Installer and view the Modifying dialog.

  • On the Workloads tab, under Windows, find the Desktop development with C++ workload. If the check box next to that workload isn't already selected, select it.

  • On the Individual components tab, find the NuGet package manager check box. If the check box isn't already selected, select it.

  • In the corner, select the button labeled either Close or Modify. The button name varies depending on whether you selected any features for installation.

    If you select Modify, installation begins. The process might take a while.

  • Close Visual Studio Installer.

    Create the project

    Next, create your project and select the target architecture:

  • On the Visual Studio menu bar, select File > New > Project to display the Create a new project window.

  • Find and select Console App. Make sure that you select the C++ version of this project type, as opposed to C# or Visual Basic.

  • Select Next.

  • In the Configure your new project dialog, in Project name, enter helloworld.

  • In Location, go to and select (or create) the folder where you want to save your project, and then select Create.

  • Select your target platform architecture. On the Visual Studio toolbar, find the Solution Platforms drop-down box. If you don't see it, select View > Toolbars > Standard to display the toolbar that contains Solution Platforms.

    If you're running 64-bit Windows, select x64 in the drop-down box. 64-bit Windows can also run 32-bit applications, so you can choose x86 if you prefer.

    Install the Speech SDK by using Visual Studio

    Finally, install the Speech SDK NuGet package and reference the Speech SDK in your project:

  • In Solution Explorer, right-click your solution, and then select Manage NuGet Packages for Solution to go to the NuGet - Solution window.

  • Select Browse.

  • In Package source, select nuget.org.

  • In the Search box, enter Microsoft.CognitiveServices.Speech. Choose that package after it appears in the search results.

  • In the package status pane next to the search results, select your helloworld project.

  • Select Install.

  • In the Preview Changes dialog, select OK.

  • In the License Acceptance dialog, view the license, and then select I Accept. The package installation begins. When installation is complete, the Output pane displays a message that's similar to the following text: Successfully installed 'Microsoft.CognitiveServices.Speech 1.15.0' to helloworld.

    Reference documentation | Package (Go) | Additional Samples on GitHub

    This guide shows how to install the Speech SDK for Go.

    Platform requirements

    The Speech SDK for Go only supports Ubuntu 18.04/20.04/22.04, Debian 10/11, Red Hat Enterprise Linux (RHEL) 8, and CentOS 8 on the x64 architecture when used with Linux.

    Important

    Use the most recent LTS release of the Linux distribution. For example, if you are using Ubuntu 20.04 LTS, use the latest release of Ubuntu 20.04.X.

    The Speech SDK depends on the following Linux system libraries:

  • The shared libraries of the GNU C library, including the POSIX Threads Programming library, libpthreads
  • The OpenSSL library (libssl) version 1.x and certificates (ca-certificates)
  • The shared library for ALSA applications (libasound)
  • You should also install ca-certificates to establish a secure websocket and avoid the WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED error.
  • Important

    The Speech SDK does not yet support OpenSSL 3.0, which is the default in Ubuntu 22.04 and Debian 12.

    To install OpenSSL 1.x from sources on Debian/Ubuntu based systems that don't have it, do:

    wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf -
    cd openssl-1.1.1u
    ./config --prefix=/usr/local
    make -j $(nproc)
    sudo make install_sw install_ssldirs
    sudo ldconfig -v
    export SSL_CERT_DIR=/etc/ssl/certs
    

    Notes on installation:

  • Check https://www.openssl.org/source/ for the latest OpenSSL 1.x version to use.
  • The setting of SSL_CERT_DIR must be in effect systemwide or at least in the console where applications that use the Speech SDK are launched from, otherwise OpenSSL 1.x installed in /usr/local may not find certificates.
  • Ensure that the console output from ldconfig -v includes /usr/local/lib as it should on modern systems by default. If this isn't the case, set LD_LIBRARY_PATH (with the same scope as SSL_CERT_DIR) to add /usr/local/lib to the library path:
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    

    To use the Speech SDK in Alpine Linux, create a Debian chroot environment as documented in the Alpine Linux Wiki on running glibc programs. Then follow the Debian instructions here.

    sudo apt-get update
    sudo apt-get install build-essential libssl-dev ca-certificates libasound2 wget
    

    Install the development tools and libraries:

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

    Important

  • On RHEL/CentOS 7, follow the instructions on how to configure RHEL/CentOS 7 for Speech SDK.
  • On RHEL/CentOS 8, follow the instructions on how to configure OpenSSL for Linux.
  • You must install the Go binary version 1.13 or later.

    Install the Speech SDK for Go

    Use the following procedure to download and install the SDK. The steps include downloading the required libraries and header files as a .tar file from https://aka.ms/csspeech/linuxbinary.

  • 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"
    
  • Create the directory if it doesn't exist yet:

    mkdir -p "$SPEECHSDK_ROOT"
    
  • Download and extract the .tar.gz archive that contains 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"
    
  • 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. The listing should also contain an include directory that holds header (.h) files and a lib directory that holds libraries for arm32, arm64, x64, and x86.

    Description

    Configure the Go environment

    The following steps enable your Go environment to find the Speech SDK. In both steps, replace <architecture> with the processor architecture of your CPU. This will be x86, x64, arm32, or arm64.

  • Because 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/<architecture> -lMicrosoft.CognitiveServices.Speech.core"
    
  • To run applications and the SDK, you need to tell the operating system where to find the libraries.

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

    Reference documentation | Additional Samples on GitHub

    This guide shows how to install the Speech SDK for Java.

    Platform requirements

    Choose your target environment

    Java Runtime Android

    On Windows, you must use the 64-bit target architecture. Windows 10 or later is required.

    You must install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, 2019, and 2022 for your platform. Installing this package for the first time might require a restart.

    The Speech SDK for Java doesn't support Windows on ARM64.

    The Speech SDK for Java only supports Ubuntu 18.04/20.04/22.04, Debian 10/11, Red Hat Enterprise Linux (RHEL) 7/8, and CentOS 7/8 on the following architectures when used with Linux: x64, ARM32 (Debian/Ubuntu), and ARM64 (Debian/Ubuntu)

    Important

    Use the most recent LTS release of the Linux distribution. For example, if you are using Ubuntu 20.04 LTS, use the latest release of Ubuntu 20.04.X.

    The Speech SDK depends on the following Linux system libraries:

  • The shared libraries of the GNU C library, including the POSIX Threads Programming library, libpthreads
  • The OpenSSL library (libssl) version 1.x and certificates (ca-certificates)
  • The shared library for ALSA applications (libasound)
  • You should also install ca-certificates to establish a secure websocket and avoid the WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED error.
  • Important

    The Speech SDK does not yet support OpenSSL 3.0, which is the default in Ubuntu 22.04 and Debian 12.

    To install OpenSSL 1.x from sources on Debian/Ubuntu based systems that don't have it, do:

    wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf -
    cd openssl-1.1.1u
    ./config --prefix=/usr/local
    make -j $(nproc)
    sudo make install_sw install_ssldirs
    sudo ldconfig -v
    export SSL_CERT_DIR=/etc/ssl/certs
    

    Notes on installation:

  • Check https://www.openssl.org/source/ for the latest OpenSSL 1.x version to use.
  • The setting of SSL_CERT_DIR must be in effect systemwide or at least in the console where applications that use the Speech SDK are launched from, otherwise OpenSSL 1.x installed in /usr/local may not find certificates.
  • Ensure that the console output from ldconfig -v includes /usr/local/lib as it should on modern systems by default. If this isn't the case, set LD_LIBRARY_PATH (with the same scope as SSL_CERT_DIR) to add /usr/local/lib to the library path:
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    

    To use the Speech SDK in Alpine Linux, create a Debian chroot environment as documented in the Alpine Linux Wiki on running glibc programs. Then follow the Debian instructions here.

    sudo apt-get update
    sudo apt-get install build-essential libssl-dev ca-certificates libasound2 wget
    

    Install the development tools and libraries:

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

    Important

  • On RHEL/CentOS 7, follow the instructions on how to configure RHEL/CentOS 7 for Speech SDK.
  • On RHEL/CentOS 8, follow the instructions on how to configure OpenSSL for Linux.
  • You must install a Java Development Kit such as Azul Zulu OpenJDK. The Microsoft Build of OpenJDK or your preferred JDK should also work.

    Install the Speech SDK for Java

    Some of the instructions use a specific SDK version such as 1.24.2. You can check the latest version by searching our GitHub repo.

    Choose your target environment

    Java Runtime Android

    This guide shows how to install the Speech SDK for Java on the Java Runtime.

    Supported operating systems

    The Speech SDK for Java package is available for these operating systems:

  • Windows: 64-bit only.
  • Mac: macOS X version 10.14 or later.
  • Linux: See the list of supported Linux distributions and target architectures.
  • Follow these steps to install the Speech SDK for Java using Apache Maven:

  • Install Apache Maven.
  • Open a command prompt where you want the new project, and create a new pom.xml file.
  • Copy the following XML content into pom.xml:
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.microsoft.cognitiveservices.speech.samples</groupId>
        <artifactId>quickstart-eclipse</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <build>
            <sourceDirectory>src</sourceDirectory>
            <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                <source>1.8</source>
                <target>1.8</target>
                </configuration>
            </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
            <groupId>com.microsoft.cognitiveservices.speech</groupId>
            <artifactId>client-sdk</artifactId>
            <version>1.31.0</version>
            </dependency>
        </dependencies>
    </project>
    
  • Run the following Maven command to install the Speech SDK and dependencies.
    mvn clean dependency:copy-dependencies
    

    Create an Eclipse project and install the Speech SDK

  • Install the Eclipse Java IDE. This IDE requires Java to already be installed.

  • Start Eclipse.

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

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

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

  • The New Project dialog appears. Select Java Project, and then select Next.

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

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

  • In Package Explorer, right-click the quickstart project. Select Configure > Convert to Maven Project from the shortcut menu.

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

  • Open the pom.xml file and edit it:

  • Add a dependencies element at the end of the file, before the closing tag </project>, with the Speech SDK as a dependency:
  • <dependencies>
      <dependency>
        <groupId>com.microsoft.cognitiveservices.speech</groupId>
        <artifactId>client-sdk</artifactId>
        <version>1.31.0</version>
      </dependency>
    </dependencies>
    
  • Save the changes.
  • Gradle configurations

    Gradle configurations require an explicit reference to the .jar dependency extension:

    // build.gradle
    dependencies {
        implementation group: 'com.microsoft.cognitiveservices.speech', name: 'client-sdk', version: "1.31.0", ext: "jar"
    

    This guide shows how to install the Speech SDK for Java on Android.

    The Speech SDK for Android is packaged as an Android Archive (AAR) file, which includes the necessary libraries and required Android permissions.

    Install the Speech SDK by using Android Studio

    Create a new project in Android Studio and add the Speech SDK for Java as a library dependency. The setup is based on the Speech SDK Maven Package and Android Studio Chipmunk 2021.2.1.

    Create an empty project

  • Open Android Studio, and select New project.

  • Enter samples.speech.cognitiveservices.microsoft.com in the Package name text box.

  • Select a project directory in the Save location selection box.

  • Select Java in the Language selection box.

  • Select API 23: Android 6.0 (Marshmallow) in the Minimum API level selection box.

  • Select Finish.

    Android Studio takes some moments to prepare your new project. If this is your first time using Android Studio, it may take a few minutes to set preferences, accept licenses, and complete the wizard.

    Install the Speech SDK for Java on Android

    Add the Speech SDK as a dependency in your project.

  • Select File > Project structure > Dependencies > app.
  • Select the plus symbol (+) to add a dependency under Declared Dependencies. Then select Library dependency from the drop-down menu.
  • In the Add Library Dependency window that appears, enter the name and version of the Speech SDK for Java: com.microsoft.cognitiveservices.speech:client-sdk:1.31.0. Then select Search.
  • Make sure that the selected Group ID is com.microsoft.cognitiveservices.speech, and then select OK.
  • Select OK to close the Project Structure window and apply your changes to the project.
  • Reference documentation | Package (npm) | Additional Samples on GitHub | Library source code

    This guide shows how to install the Speech SDK for JavaScript.

    The Speech SDK for JavaScript is available as an npm package. See microsoft-cognitiveservices-speech-sdk and its companion GitHub repository cognitive-services-speech-sdk-js.

    Platform requirements

    Make sure to consider the various architectural implications between Node.js and client web browsers. For example, the document object model (DOM) isn't available for server-side applications just as the Node.js file system isn't available to client-side applications.

    Install the Speech SDK for JavaScript

    Depending on the target environment, use one of the following guides:

    Choose your target environment

    Node.js Browser-based

    This guide shows how to install the Speech SDK for JavaScript for use with Node.js. If you just want the package name to get started on your own, run npm install microsoft-cognitiveservices-speech-sdk from your existing project.

    Prerequisites

    This quickstart requires Node.js.

    Create an npm project

    Create a new directory, run npm init, and walk through the prompts.

    Add the Speech SDK package

    Run npm install microsoft-cognitiveservices-speech-sdk.

    This guide shows how to install the Speech SDK for JavaScript for use with Node.js.

  • Install Node.js.

  • Create a new directory, run npm init, and walk through the prompts.

  • To install the Speech SDK for JavaScript, run the following npm install command:

    npm install microsoft-cognitiveservices-speech-sdk
    

    For more information, see the Node.js samples.

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

    Unpack to a folder

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

  • Download the Speech SDK as a .zip package and unpack it into the newly created folder. These files are 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 that's 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 a new file named index.html in the folder, and open this file with a text editor.

    HTML script tag

    Download and extract the microsoft.cognitiveservices.speech.sdk.bundle.js file from the Speech SDK for JavaScript. Place it in a folder that your HTML file can access.

    <script src="microsoft.cognitiveservices.speech.sdk.bundle.js"></script>;
    

    If you're targeting a web browser and using the <script> tag, the sdk prefix is not needed. The sdk prefix is an alias that's used to name the require module.

    Alternatively, you could directly include a <script> tag in the HTMLs <head> element, relying on the JSDelivr NPM syndicate.

    <script src="https://cdn.jsdelivr.net/npm/microsoft-cognitiveservices-speech-sdk@latest/distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle-min.js">
    </script>
    

    For more information, see the browser-based samples.

    Use the Speech SDK

    Add the following import statement to use the Speech SDK in your JavaScript project:

    import * as sdk from "microsoft-cognitiveservices-speech-sdk";
    

    For more information on import, see Export and Import on the JavaScript website.

    Alternatively, you could use a require statement:

    const sdk = require("microsoft-cognitiveservices-speech-sdk");
    

    Reference documentation | Package (Download) | Additional Samples on GitHub

    This guide shows how to install the Speech SDK for Objective-C.

    For details about using the Speech SDK for Swift, see Importing Objective-C into Swift.

    Install the Speech SDK for Objective-C

    The Speech SDK for Objective-C is available natively as a CocoaPod package for Mac x64 and ARM-based silicons.

    System requirements for Mac:

  • A macOS version 10.14 or later
  • The macOS CocoaPod package is available for download and use with the Xcode 9.4.1 (or later) integrated development environment (IDE).

  • Go to the Xcode directory where your .xcodeproj project file is located.

  • Run pod init to create a pod file named Podfile.

  • Replace the contents of Podfile with the following. Update the target name from 'AppName' to the name of your app. Update the platform or pod version as needed.

    platform :osx, 10.14
    use_frameworks!
    target 'AppName' do
      pod 'MicrosoftCognitiveServicesSpeech-macOS', '~> 1.31.0'
    
  • Run pod install to install the Speech SDK.

    Alternatively, you can download the binary CocoaPod and unzip to extract its contents. In your Xcode project, add a reference to the extracted "MicrosoftCognitiveServicesSpeech.xcframework" folder and its contents.

    .NET developers can build native macOS applications by using the Xamarin.Mac application framework. For more information, see Xamarin.Mac.

    The Speech SDK for Objective-C is available natively as a CocoaPod package.

    System requirements for iOS:

  • A macOS version 10.14 or later
  • Target iOS 9.3 or later
  • The macOS CocoaPod package is available for download and use with the Xcode 9.4.1 (or later) integrated development environment (IDE).

  • Go to the Xcode directory where your .xcodeproj project file is located.

  • Run pod init to create a pod file named Podfile.

  • Replace the contents of Podfile with the following. Update the target name from 'AppName' to the name of your app. Update the platform or pod version as needed.

    platform :ios, '9.3'
    use_frameworks!
    target 'AppName' do
      pod 'MicrosoftCognitiveServicesSpeech-iOS', '~> 1.31.0'
    
  • Run pod install to install the Speech SDK.

    Alternatively, you can download the binary CocoaPod and unzip to extract its contents. In your Xcode project, add a reference to the extracted "MicrosoftCognitiveServicesSpeech.xcframework" folder and its contents.

    .NET developers can build native iOS applications by using the Xamarin.iOS application framework For more information, see Xamarin.iOS.

    Reference documentation | Package (Download) | Additional Samples on GitHub

    This guide shows how to install the Speech SDK for Swift.

    For details about using the Speech SDK for Swift, see Importing Objective-C into Swift.

    Install the Speech SDK for Swift

    The Speech SDK for Swift is available natively as a CocoaPod package for Mac x64 and ARM-based silicons.

    System requirements for Mac:

  • A macOS version 10.14 or later
  • The macOS CocoaPod package is available for download and use with the Xcode 9.4.1 (or later) integrated development environment (IDE).

  • Go to the Xcode directory where your .xcodeproj project file is located.

  • Run pod init to create a pod file named Podfile.

  • Replace the contents of Podfile with the following. Update the target name from 'AppName' to the name of your app. Update the platform or pod version as needed.

    platform :osx, 10.14
    use_frameworks!
    target 'AppName' do
      pod 'MicrosoftCognitiveServicesSpeech-macOS', '~> 1.31.0'
    
  • Run pod install to install the Speech SDK.

    Alternatively, you can download the binary CocoaPod and unzip to extract its contents. In your Xcode project, add a reference to the extracted "MicrosoftCognitiveServicesSpeech.xcframework" folder and its contents.

    .NET developers can build native macOS applications by using the Xamarin.Mac application framework. For more information, see Xamarin.Mac.

    The Speech SDK for Swift is available natively as a CocoaPod package.

    System requirements for iOS:

  • A macOS version 10.14 or later
  • Target iOS 9.3 or later
  • The macOS CocoaPod package is available for download and use with the Xcode 9.4.1 (or later) integrated development environment (IDE).

  • Go to the Xcode directory where your .xcodeproj project file is located.

  • Run pod init to create a pod file named Podfile.

  • Replace the contents of Podfile with the following. Update the target name from 'AppName' to the name of your app. Update the platform or pod version as needed.

    platform :ios, '9.3'
    use_frameworks!
    target 'AppName' do
      pod 'MicrosoftCognitiveServicesSpeech-iOS', '~> 1.31.0'
    
  • Run pod install to install the Speech SDK.

    Alternatively, you can download the binary CocoaPod and unzip to extract its contents. In your Xcode project, add a reference to the extracted "MicrosoftCognitiveServicesSpeech.xcframework" folder and its contents.

    .NET developers can build native iOS applications by using the Xamarin.iOS application framework For more information, see Xamarin.iOS.

    Reference documentation | Package (PyPi) | Additional Samples on GitHub

    This guide shows how to install the Speech SDK for Python.

    Platform requirements

    The Speech SDK for Python is compatible with Windows, Linux, and macOS.

    Windows Linux macOS

    On Windows, you must use the 64-bit target architecture. Windows 10 or later is required.

    You must install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, 2019, and 2022 for your platform. Installing this package for the first time might require a restart.

    Important

    Make sure that packages of the same target architecture are installed. For example, if you install the x64 redistributable package, then you need to install the x64 Python package.

    The Speech SDK for Python only supports Ubuntu 18.04/20.04/22.04, Debian 10/11, Red Hat Enterprise Linux (RHEL) 8, and CentOS 8 on the x64 and ARM64 architectures when used with Linux.

    Important

    Use the most recent LTS release of the Linux distribution. For example, if you are using Ubuntu 20.04 LTS, use the latest release of Ubuntu 20.04.X.

    The Speech SDK depends on the following Linux system libraries:

  • The shared libraries of the GNU C library, including the POSIX Threads Programming library, libpthreads
  • The OpenSSL library (libssl) version 1.x and certificates (ca-certificates)
  • The shared library for ALSA applications (libasound)
  • You should also install ca-certificates to establish a secure websocket and avoid the WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED error.
  • Important

    The Speech SDK does not yet support OpenSSL 3.0, which is the default in Ubuntu 22.04 and Debian 12.

    To install OpenSSL 1.x from sources on Debian/Ubuntu based systems that don't have it, do:

    wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf -
    cd openssl-1.1.1u
    ./config --prefix=/usr/local
    make -j $(nproc)
    sudo make install_sw install_ssldirs
    sudo ldconfig -v
    export SSL_CERT_DIR=/etc/ssl/certs
    

    Notes on installation:

  • Check https://www.openssl.org/source/ for the latest OpenSSL 1.x version to use.
  • The setting of SSL_CERT_DIR must be in effect systemwide or at least in the console where applications that use the Speech SDK are launched from, otherwise OpenSSL 1.x installed in /usr/local may not find certificates.
  • Ensure that the console output from ldconfig -v includes /usr/local/lib as it should on modern systems by default. If this isn't the case, set LD_LIBRARY_PATH (with the same scope as SSL_CERT_DIR) to add /usr/local/lib to the library path:
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    

    To use the Speech SDK in Alpine Linux, create a Debian chroot environment as documented in the Alpine Linux Wiki on running glibc programs. Then follow the Debian instructions here.

    sudo apt-get update
    sudo apt-get install build-essential libssl-dev ca-certificates libasound2 wget
    

    Install the development tools and libraries:

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

    Important

  • On RHEL/CentOS 7, follow the instructions on how to configure RHEL/CentOS 7 for Speech SDK.
  • On RHEL/CentOS 8, follow the instructions on how to configure OpenSSL for Linux.
  • Install a version of Python from 3.7 or later.

    To check your installation, open a terminal and run the command python --version. If it's installed properly, you'll get a response like "Python 3.8.10". If you're using macOS or Linux, you might need to run the command python3 --version instead. To enable use of python instead of python3, run alias python='python3' to set up an alias. The Speech SDK quickstart samples specify python usage.

    Install the Speech SDK for Python

    Before you install the Speech SDK for Python, make sure to satisfy the platform requirements.

    Choose your tool or IDE

    VS Code

    Install from PyPI

    To install the Speech SDK for Python, run this command in a terminal.

    pip install azure-cognitiveservices-speech
    

    Upgrade to the latest Speech SDK

    To upgrade to the latest Speech SDK, run this command in a terminal:

    pip install --upgrade azure-cognitiveservices-speech
    

    You can check which Speech SDK for Python version is currently installed by inspecting the azure.cognitiveservices.speech.__version__ variable. For example, run this command in a terminal:

    pip list
    

    Install the Speech SDK by using Visual Studio Code

    To install the Speech SDK for Python:

  • Download and install Visual Studio Code.

  • Run Visual Studio Code and install the Python extension:

  • Select File > Preferences > Extensions.
  • Search for Python, find the Python extension for Visual Studio Code published by Microsoft, and then select Install.
  • Select Terminal > New Terminal to open a terminal within Visual Studio Code.

  • At the terminal prompt, run the following command to install the Speech SDK for Python package.

    python -m pip install azure-cognitiveservices-speech
    

    For more information about Visual Studio Code and Python, see the Visual Studio Code documentation and the Visual Studio Code Python tutorial.

    Use the Speech SDK

    Add the following import statement to use the Speech SDK in your Python project:

    import azure.cognitiveservices.speech as speechsdk
    

    Next steps

  • Speech to text quickstart
  • Text to speech quickstart
  • Speech translation quickstart
  •