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:
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
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:
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.
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.
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:
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
Configure the Go environment
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.
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:
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 23: Android 6.0 (Marshmallow) 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 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.42.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.
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 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.
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.
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.42.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.42.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 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.42.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.42.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.
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).
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
Add the following import statement to use the Speech SDK in your Python project:
import azure.cognitiveservices.speech as speechsdk
Code samples
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.