Reference documentation | Package (NuGet) | Additional samples on GitHub
In this quickstart, you install the Speech SDK for C#.
The Speech SDK for C# is compatible with Windows, Linux, and macOS.
The Speech SDK for C# only supports the following distributions on the x64, ARM32, and ARM64 architectures:
- Ubuntu 20.04/22.04/24.04
- Debian 11/12
- Amazon Linux 2023
- Azure Linux 3.0
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, version 1.x (
libssl1) or 3.x (libssl3), and certificates (ca-certificates).
- The shared library for ALSA applications (
libasound2).
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo yum update
sudo yum install alsa-lib ca-certificates openssl wget
Run these commands:
sudo tdnf update
sudo tdnf install alsa-lib ca-certificates openssl wget
A macOS version 10.14 or later is required.
Install the Speech SDK for C#
The Speech SDK for C# is available as a NuGet package and implements .NET Standard 2.0. For more information, see Microsoft.CognitiveServices.Speech.
The Speech SDK for C# can be installed from the .NET CLI by using the following dotnet add command:
dotnet add package Microsoft.CognitiveServices.Speech
The Speech SDK for C# can be installed by using the following Install-Package command:
Install-Package Microsoft.CognitiveServices.Speech
Reference documentation | Package (NuGet) | Additional samples on GitHub
In this quickstart, you install the Speech SDK for C++.
The Speech SDK for C++ is compatible with Windows, Linux, and macOS.
The Speech SDK for C++ only supports the following distributions on the x64, ARM32, and ARM64 architectures:
- Ubuntu 20.04/22.04/24.04
- Debian 11/12
- Amazon Linux 2023
- Azure Linux 3.0
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, version 1.x (
libssl1) or 3.x (libssl3), and certificates (ca-certificates).
- The shared library for ALSA applications (
libasound2).
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo yum update
sudo yum install alsa-lib ca-certificates openssl wget
Run these commands:
sudo tdnf update
sudo tdnf install alsa-lib ca-certificates openssl wget
A macOS version 10.14 or later is required.
Install the Speech SDK for C++
The Speech SDK for C++ is available as a NuGet package. For more information, see Microsoft.CognitiveServices.Speech.
The Speech SDK for C++ can be installed from the .NET CLI by using the following dotnet add command:
dotnet add package Microsoft.CognitiveServices.Speech
The Speech SDK for C++ can be installed by using the following Install-Package command:
Install-Package Microsoft.CognitiveServices.Speech
You can follow these guides for more options.
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.
Choose a directory for the Speech SDK files. Set the SPEECHSDK_ROOT environment variable to point to that directory. This variable makes it easy to refer to the directory in future commands.
To use the directory speechsdk in your home directory, run the following command:
export SPEECHSDK_ROOT="$HOME/speechsdk"
Create the directory if it doesn't exist:
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 partner notices 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.
| Path |
Description |
| license.md |
License |
| ThirdPartyNotices.md |
Partner notices |
| REDIST.txt |
Redistribution notice |
| include |
Required header files for C++ |
| lib/arm32 |
Native library for ARM32 required to link your application |
| lib/arm64 |
Native library for ARM64 required to link your application |
| lib/x64 |
Native library for x64 required to link your application |
| lib/x86 |
Native library for x86 required to link your application |
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.
Choose a directory for the Speech SDK files. Set the SPEECHSDK_ROOT environment variable to point to that directory. This variable makes it easy to refer to the directory in future commands.
To use the directory speechsdk in your home directory, run the following command:
export SPEECHSDK_ROOT="$HOME/speechsdk"
Create the directory if it doesn't exist:
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 partner 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:
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 box.
On the Workloads tab, under Windows, find the Desktop development with C++ workload. If that workload isn't already selected, select it.
On the Individual components tab, find NuGet package manager. If it isn't already selected, select it.
Select 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:
From the Visual Studio menu, 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 box, 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 dropdown 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 dropdown 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 box, select OK.
In the License Acceptance dialog box, 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
In this quickstart, you install the Speech SDK for Go.
The Speech SDK for Go supports the following distributions on the x64 architecture:
- Ubuntu 20.04/22.04/24.04
- Debian 11/12
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, version 1.x (
libssl1) or 3.x (libssl3), and certificates (ca-certificates).
- The shared library for ALSA applications (
libasound2).
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo yum update
sudo yum install alsa-lib ca-certificates openssl wget
Run these commands:
sudo tdnf update
sudo tdnf install alsa-lib ca-certificates openssl wget
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.
Choose a directory for the Speech SDK files. Set the SPEECHSDK_ROOT environment variable to point to that directory. This variable makes it easy to refer to the directory in future commands.
To use the directory speechsdk in your home directory, run the following command:
export SPEECHSDK_ROOT="$HOME/speechsdk"
Create the directory if it doesn't exist:
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 partner notices 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.
| Path |
Description |
| license.md |
License |
| ThirdPartyNotices.md |
Partner notices |
| REDIST.txt |
Redistribution notice |
| include |
Required header files for C++ |
| lib/arm32 |
Native library for ARM32 required to link your application |
| lib/arm64 |
Native library for ARM64 required to link your application |
| lib/x64 |
Native library for x64 required to link your application |
| lib/x86 |
Native library for x86 required to link your application |
The following steps enable your Go environment to find the Speech SDK.
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"
Important
Replace <architecture> with the processor architecture of your CPU: x64, arm32, or arm64.
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"
Important
Replace <architecture> with the processor architecture of your CPU: x64, arm32, or arm64.
Reference documentation | Additional samples on GitHub
In this quickstart, you install the Speech SDK for Java.
Choose your target environment:
The Speech SDK for Java is compatible with Windows, Linux, and macOS.
The Speech SDK for Java supports the following distributions on the x64, ARM32, and ARM64 architectures:
- Ubuntu 20.04/22.04/24.04
- Debian 11/12
- Amazon Linux 2023
- Azure Linux 3.0
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, version 1.x (
libssl1) or 3.x (libssl3), and certificates (ca-certificates).
- The shared library for ALSA applications (
libasound2).
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo yum update
sudo yum install alsa-lib ca-certificates openssl wget
Run these commands:
sudo tdnf update
sudo tdnf install alsa-lib ca-certificates openssl wget
A macOS version 10.14 or later is required.
The Speech SDK is compatible with Android devices that have 32/64-bit ARM processor and Intel x86/x64 compatible processors.
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.43.0. To check the latest version, search our GitHub repository.
Choose your target environment:
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:
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.43.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, select File > New > Project.
The New Project dialog box 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 context 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.43.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.43.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.
In the New project window that appears, select Phone and Tablet > Empty Activity, and then select Next.
Enter SpeechQuickstart in the Name text box.
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 26: Android 8.0 (Oreo) in the Minimum API level selection box.
Select Finish.
Android Studio takes some time to prepare your new project. For your first time using Android Studio, it might 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 dropdown 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.43.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
In this quickstart, you 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.
Understand the architectural implications between Node.js and client web browsers. For example, the document object model (DOM) isn't available for server-side applications. 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:
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 to use 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>;
Tip
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 HTML <head> element, relying on the JSDelivr.
<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
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
In this quickstart, you install the Speech SDK for Objective-C.
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 systems.
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 content. 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.43.0'
end
Run pod install to install the Speech SDK.
Alternatively, download the binary CocoaPod and extract its contents. In your Xcode project, add a reference to the extracted MicrosoftCognitiveServicesSpeech.xcframework folder and its contents.
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 content. 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.43.0'
end
Run pod install to install the Speech SDK.
Alternatively, download the binary CocoaPod and extract its contents. In your Xcode project, add a reference to the extracted MicrosoftCognitiveServicesSpeech.xcframework folder and its contents.
Reference documentation | Package (download) | Additional samples on GitHub
In this quickstart, you install the Speech SDK for 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 systems.
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 content. 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.43.0'
end
Run pod install to install the Speech SDK.
Alternatively, download the binary CocoaPod and extract its contents. In your Xcode project, add a reference to the extracted MicrosoftCognitiveServicesSpeech.xcframework folder and its contents.
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.43.0'
end
Run pod install to install the Speech SDK.
Alternatively, download the binary CocoaPod and extract its contents. In your Xcode project, add a reference to the extracted MicrosoftCognitiveServicesSpeech.xcframework folder and its contents.
Reference documentation | Package (PyPi) | Additional samples on GitHub
In this quickstart, you install the Speech SDK for Python.
The Speech SDK for Python is compatible with Windows, Linux, and macOS.
On Windows, you must use the 64-bit target architecture. Windows 10 or later is required.
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, install the x64 Python package.
The Speech SDK for Python supports the following distributions on the x64 and ARM64 architectures:
- Ubuntu 20.04/22.04/24.04
- Debian 11/12
- Amazon Linux 2023
- Azure Linux 3.0
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, version 1.x (
libssl1) or 3.x (libssl3), and certificates (ca-certificates).
- The shared library for ALSA applications (
libasound2).
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget
Run these commands:
sudo yum update
sudo yum install alsa-lib ca-certificates openssl wget
Run these commands:
sudo tdnf update
sudo tdnf install alsa-lib ca-certificates openssl wget
A macOS version 10.14 or later is required.
Install a version of Python from 3.8 or later.
To check your installation, open a terminal and run the command python --version. If Python installed properly, you 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.
Install from PyPI
To install the Speech SDK for Python, run this command in a console window:
pip install azure-cognitiveservices-speech
Upgrade to the latest Speech SDK
To upgrade to the latest Speech SDK, run this command in console window:
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 console window:
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 Visual Studio Code and Getting Started with Python in VS Code.
Use the Speech SDK
Add the following import statement to use the Speech SDK in your Python project:
import azure.cognitiveservices.speech as speechsdk
Code samples
Code samples are available in the Azure-Samples/cognitive-services-speech-sdk repository on GitHub. There are samples for C# (including Universal Windows Platform (UWP) and Unity), C++, Java, JavaScript (including Browser and Node.js), Objective-C, Python, and Swift. Code samples for Go are available in the Microsoft/cognitive-services-speech-sdk-go repository on GitHub.
Related content