This sample demonstrates how to create a macOS app in Objective-C using the Cognitive Services Speech SDK to transcribe speech recorded from a microphone to text.
- A subscription key for the Speech service. See Try the speech service for free.
- A macOS machine with Xcode 9.4.1 or later and macOS 10.13 or later
By downloading the Microsoft Cognitive Services Speech SDK, you acknowledge its license, see Speech SDK license agreement.
The Cognitive Services Speech SDK for Mac is distributed as a framework bundle. It can be used in Xcode projects as a CocoaPod, or downloaded directly here and linked manually. This guide uses a CocoaPod.
- Install the CocoaPod dependency manager as described in its installation instructions.
- Navigate to the directory of the downloaded sample app (
helloworld
) in a terminal. - Run the command
pod install
. This will generate ahelloworld.xcworkspace
Xcode workspace containing both the sample app and the Speech SDK as a dependency. This workspace will be used in the following.
- Open the
helloworld.xcworkspace
workspace in Xcode. - Make the following changes in the
AppDelegate.m
file:- Replace the string
YourSubscriptionKey
with your subscription key. - Replace the string
YourServiceRegion
with the region associated with your subscription (for example,westus
for the free trial subscription).
- Replace the string
- Make the debug output visible (View > Debug Area > Activate Console).
- Build and run the example code by selecting Product -> Run from the menu or clicking the Play button.
- After you click the button in the app and say a few words, you should see the text you have spoken on the lower part of the screen. When you run the app for the first time, you should be prompted to give the app access to your computer's microphone.