Quickstart: Install the Speech SDK
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
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
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
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
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
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
Install the Go binary version 1.13 or later.
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
, orarm64
.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
, orarm64
.
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
Install a Java Development Kit such as Azul Zulu OpenJDK. The Microsoft Build of OpenJDK or your preferred JDK should also work.
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.
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 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.43.0</version> </dependency> </dependencies> </project>
Run the following Maven command to install the Speech SDK and dependencies.
mvn clean dependency:copy-dependencies
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.
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.
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
In this quickstart, you install the Speech SDK for Objective-C.
Tip
For more information about using the Speech SDK for Swift, see Importing Objective-C into Swift.
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 fromAppName
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.
Reference documentation | Package (download) | Additional samples on GitHub
In this quickstart, you install the Speech SDK for Swift.
Tip
For more information about using the Speech SDK for Swift, see Importing Objective-C into 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 fromAppName
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.
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.
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
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 likePython 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 ofpython3
, runalias python='python3'
to set up an alias. The Speech SDK quickstart samples specifypython
usage.
Before you install the Speech SDK for Python, make sure to satisfy the platform requirements.
To install the Speech SDK for Python, run this command in a console window:
pip install azure-cognitiveservices-speech
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
Add the following import statement to use the Speech SDK in your Python project:
import azure.cognitiveservices.speech as speechsdk
In depth samples are available in the Azure-Samples/cognitive-services-speech-sdk repository on GitHub. There are samples for C# (including 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.