Home

Awesome


page_type: sample languages:


Sample Repository for the Microsoft Cognitive Services Speech SDK

This project hosts the samples for the Microsoft Cognitive Services Speech SDK. To find out more about the Microsoft Cognitive Services Speech SDK itself, please visit the SDK documentation site.

News

Please check here for release notes and older releases.

Features

This repository hosts samples that help you to get started with several features of the SDK. In addition more complex scenarios are included to give you a head-start on using speech technology in your application.

We tested the samples with the latest released version of the SDK on Windows 10, Linux (on supported Linux distributions and target architectures), Android devices (API 23: Android 6.0 Marshmallow or higher), Mac x64 (OS version 10.14 or higher) and Mac M1 arm64 (OS version 11.0 or higher) and iOS 11.4 devices.

Getting Started

The SDK documentation has extensive sections about getting started, setting up the SDK, as well as the process to acquire the required subscription keys. You will need subscription keys to run the samples on your machines, you therefore should follow the instructions on these pages before continuing.

Get the samples

Build and run the samples

Note: the samples make use of the Microsoft Cognitive Services Speech SDK. By downloading the Microsoft Cognitive Services Speech SDK, you acknowledge its license, see Speech SDK license agreement.

Please see the description of each individual sample for instructions on how to build and run it.

Related GitHub repositories

Speech recognition quickstarts

The following quickstarts demonstrate how to perform one-shot speech recognition using a microphone. If you want to build them from scratch, please follow the quickstart or basics articles on our documentation page.

QuickstartPlatformDescription
Quickstart C++ for LinuxLinuxDemonstrates one-shot speech recognition from a microphone.
Quickstart C++ for WindowsWindowsDemonstrates one-shot speech recognition from a microphone.
Quickstart C++ for macOSmacOS
Quickstart C# .NET for WindowsWindowsDemonstrates one-shot speech recognition from a microphone.
Quickstart C# .NET CoreWindows, Linux, macOSDemonstrates one-shot speech recognition from a microphone.
Quickstart C# UWP for WindowsWindowsDemonstrates one-shot speech recognition from a microphone.
Quickstart C# Unity (Windows or Android)Windows, AndroidDemonstrates one-shot speech recognition from a microphone.
Quickstart for AndroidAndroidDemonstrates one-shot speech recognition from a microphone.
Quickstart Java JREWindows, Linux, macOSDemonstrates one-shot speech recognition from a microphone.
Quickstart JavaScriptWebDemonstrates one-shot speech recognition from a microphone.
Quickstart Node.jsNode.jsDemonstrates one-shot speech recognition from a file.
Quickstart PythonWindows, Linux, macOSDemonstrates one-shot speech recognition from a microphone.
Quickstart Objective-C iOSiOSDemonstrates one-shot speech recognition from a file with recorded speech.
Quickstart Swift iOSiOSDemonstrates one-shot speech recognition from a microphone.
Quickstart Objective-C macOSmacOSDemonstrates one-shot speech recognition from a microphone.
Quickstart Swift macOSmacOSDemonstrates one-shot speech recognition from a microphone.

Speech translation quickstarts

The following quickstarts demonstrate how to perform one-shot speech translation using a microphone. If you want to build them from scratch, please follow the quickstart or basics articles on our documentation page.

QuickstartPlatformDescription
Quickstart C++ for WindowsWindowsDemonstrates one-shot speech translation/transcription from a microphone.
Quickstart C# .NET Framework for WindowsWindowsDemonstrates one-shot speech translation/transcription from a microphone.
Quickstart C# .NET CoreWindows, Linux, macOSDemonstrates one-shot speech translation/transcription from a microphone.
Quickstart C# UWP for WindowsWindowsDemonstrates one-shot speech translation/transcription from a microphone.
Quickstart Java JREWindows, Linux, macOSDemonstrates one-shot speech translation/transcription from a microphone.

Speech synthesis quickstarts

The following quickstarts demonstrate how to perform one-shot speech synthesis to a speaker. If you want to build them from scratch, please follow the quickstart or basics articles on our documentation page.

QuickstartPlatformDescription
Quickstart C++ for LinuxLinuxDemonstrates one-shot speech synthesis to the default speaker.
Quickstart C++ for WindowsWindowsDemonstrates one-shot speech synthesis to the default speaker.
Quickstart C++ for macOSmacOSDemonstrates one-shot speech synthesis to the default speaker.
Quickstart C# .NET for WindowsWindowsDemonstrates one-shot speech synthesis to the default speaker.
Quickstart C# UWP for WindowsWindowsDemonstrates one-shot speech synthesis to the default speaker.
Quickstart C# .NET CoreWindows, LinuxDemonstrates one-shot speech synthesis to the default speaker.
Quickstart for C# Unity (Windows or Android)Windows, AndroidDemonstrates one-shot speech synthesis to a synthesis result and then rendering to the default speaker.
Quickstart for AndroidAndroidDemonstrates one-shot speech synthesis to the default speaker.
Quickstart Java JREWindows, Linux, macOSDemonstrates one-shot speech synthesis to the default speaker.
Quickstart PythonWindows, Linux, macOSDemonstrates one-shot speech synthesis to the default speaker.
Quickstart Objective-C iOSiOSDemonstrates one-shot speech synthesis to a synthesis result and then rendering to the default speaker.
Quickstart Swift iOSiOSDemonstrates one-shot speech synthesis to the default speaker.
Quickstart Objective-C macOSmacOSDemonstrates one-shot speech synthesis to the default speaker.
Quickstart Swift macOSmacOSDemonstrates one-shot speech synthesis to the default speaker.

Voice Assistant quickstarts

The following quickstarts demonstrate how to create a custom Voice Assistant. The applications will connect to a previously authored bot configured to use the Direct Line Speech channel, send a voice request, and return a voice response activity (if configured). If you want to build these quickstarts from scratch, please follow the quickstart or basics articles on our documentation page.

See also Azure-Samples/Cognitive-Services-Voice-Assistant for full Voice Assistant samples and tools.

<br>
QuickstartPlatformDescription
Quickstart Java JREWindows, Linux, macOSDemonstrates speech recognition through the DialogServiceConnector and receiving activity responses.
Quickstart C# UWP for WindowsWindowsDemonstrates speech recognition through the DialogServiceConnector and receiving activity responses.

Samples

The following samples demonstrate additional capabilities of the Speech SDK, such as additional modes of speech recognition as well as intent recognition and translation. Voice Assistant samples can be found in a separate GitHub repo.

SamplePlatformDescription
C++ Console app for WindowsWindowsDemonstrates speech recognition, speech synthesis, intent recognition, conversation transcription and translation
C++ Speech Recognition from MP3/Opus file (Linux only)LinuxDemonstrates speech recognition from an MP3/Opus file
C# Console app for .NET Framework on WindowsWindowsDemonstrates speech recognition, speech synthesis, intent recognition, and translation
C# Console app for .NET Core (Windows or Linux)Windows, Linux, macOSDemonstrates speech recognition, speech synthesis, intent recognition, and translation
Java Console app for JREWindows, Linux, macOSDemonstrates speech recognition, speech synthesis, intent recognition, and translation
Python Console appWindows, Linux, macOSDemonstrates speech recognition, speech synthesis, intent recognition, and translation
Speech-to-text UWP sampleWindowsDemonstrates speech recognition
Text-to-speech UWP sampleWindowsDemonstrates speech synthesis
Speech recognition sample for AndroidAndroidDemonstrates speech and intent recognition
Speech recognition, synthesis, and translation sample for the browser, using JavaScriptWebDemonstrates speech recognition, intent recognition, and translation
Speech recognition and translation sample using JavaScript and Node.jsNode.jsDemonstrates speech recognition, intent recognition, and translation
Speech recognition sample for iOS using a connection objectiOSDemonstrates speech recognition
Extended speech recognition sample for iOSiOSDemonstrates speech recognition using streams etc.
Speech synthesis sample for iOSiOSDemonstrates speech synthesis using streams etc.
C# UWP DialogServiceConnector sample for WindowsWindowsDemonstrates speech recognition through the DialogServiceConnector and receiving activity responses.
C# Unity sample for Windows or AndroidWindows, AndroidDemonstrates speech recognition, intent recognition, and translation for Unity
C# Unity SpeechBotConnector sample for Windows or AndroidWindows, AndroidDemonstrates speech recognition through the SpeechBotConnector and receiving activity responses.
C#, C++ and Java DialogServiceConnector samplesWindows, Linux, AndroidAdditional samples and tools to help you build an application that uses Speech SDK's DialogServiceConnector for voice communication with your Bot-Framework Bot or Custom Command web application.

Samples for using the Speech Service REST API (no Speech SDK installation required):

SampleDescription
Batch transcriptionDemonstrates usage of batch transcription from different programming languages
Batch synthesisDemonstrates usage of batch synthesis from different programming languages

Tools

ToolPlatformDescription
Enumerate audio devicesC++, WindowsShows how to get the Device ID of all connected microphones and loudspeakers. Device ID is required if you want to listen via non-default microphone (Speech Recognition), or play to a non-default loudspeaker (Text-To-Speech) using Speech SDK
Enumerate audio devicesC# .NET Framework, Windows-"-

Sample data for Custom Speech

Resources