Get started with the Speech Devices SDK

This article describes how to configure your development PC and Speech device development kit for developing speech-enabled devices by using the Speech Devices SDK. Then you build and deploy a sample application to the device.

The source code for the sample application is included with the Speech Devices SDK. It's also available on GitHub.

Prerequisites

Before you begin developing with the Speech Devices SDK, gather the information and software you need:

Set up the development kit

  1. Connect the development kit to a PC or power adapter by using a mini USB cable. When the kit is connected, a green power indicator lights up under the top board.

  2. Connect the development kit to a computer by using a second mini USB cable.

    Connecting the dev kit

  3. Orient your development kit for either the circular or linear configuration.

    Development kit configuration Orientation
    Circular Upright, with microphones facing the ceiling
    Linear On its side, with microphones facing you (shown in the following image)

    Linear dev kit orientation

  4. Install the certificates and the wake word (keyword) table file, and set the permissions of the sound device. Type the following commands in a Command Prompt window:

    adb push C:\SDSDK\Android-Sample-Release\scripts\roobo_setup.sh /data/ 
    adb shell
    cd /data/ 
    chmod 777 roobo_setup.sh
    ./roobo_setup.sh
    exit
    

    Note

    These commands use the Android Debug Bridge, adb.exe, which is part of the Android Studio installation. This tool is located in C:\Users[user name]\AppData\Local\Android\Sdk\platform-tools. You can add this directory to your path to make it more convenient to invoke adb. Otherwise, you must specify the full path to your installation of adb.exe in every command that invokes adb.

    Tip

    Mute your PC's microphone and speaker to be sure you are working with the development kit's microphones. This way, you won't accidentally trigger the device with audio from the PC.

  5. Start Vysor on your computer.

    Vysor

  6. Your device should be listed under Choose a device. Select the View button next to the device.

  7. Connect to your wireless network by selecting the folder icon, and then select Settings > WLAN.

    Vysor WLAN

    Note

    If your company has policies about connecting devices to its Wi-Fi system, you need to obtain the MAC address and contact your IT department about how to connect it to your company's Wi-Fi.

    To find the MAC address of the dev kit, select the file folder icon on the desktop of the dev kit.

    Vysor file folder

    Select Settings. Search for "mac address", and then select Mac address > Advanced WLAN. Write down the MAC address that appears near the bottom of the dialog box.

    Vysor MAC address

    Some companies might have a time limit on how long a device can be connected to their Wi-Fi system. You might need to extend the dev kit's registration with your Wi-Fi system after a specific number of days.

    If you want to attach a speaker to the dev kit, you can connect it to the audio line out. You should choose a good-quality, 3.5-mm speaker.

    Vysor audio

Run a sample application

To run the ROOBO tests and validate your development kit setup, build and install the sample application:

  1. Start Android Studio.

  2. Select Open an existing Android Studio project.

    Android Studio - Open an existing project

  3. Go to C:\SDSDK\Android-Sample-Release\example. Select OK to open the example project.

  4. Add your Speech subscription key to the source code. If you want to try intent recognition, also add your Language Understanding service subscription key and application ID.

    Your keys and application information go in the following lines in the source file MainActivity.java:

    // Subscription
    private static final String SpeechSubscriptionKey = "[your speech key]";
    private static final String SpeechRegion = "westus";
    private static final String LuisSubscriptionKey = "[your LUIS key]";
    private static final String LuisRegion = "westus2.api.cognitive.microsoft.com";
    private static final String LuisAppId = "[your LUIS app ID]"
    
  5. The default wake word (keyword) is "Computer". You can also try one of the other provided wake words, like "Machine" or "Assistant". The resource files for these alternate wake words are in the Speech Devices SDK, in the keyword folder. For example, C:\SDSDK\Android-Sample-Release\keyword\Computer contains the files used for the wake word "Computer".

    You can also create a custom wake word.

    To install the wake word you want to use:

    • Create a keyword folder in the data folder on the device by running the following commands in a Command Prompt window:

      adb shell
      cd /data
      mkdir keyword
      exit
      
    • Copy the files kws.table, kws_g.fst, kws_k.fst, and words_kw.txt to the device's \data\keyword folder. Run the following commands in a Command Prompt window. If you created a custom wake word, the kws.table file generated from the web is in the same directory as the kws.table, kws_g.fst, kws_k.fst, and words_kw.txt files. For a custom wake word, use the adb push C:\SDSDK\Android-Sample-Release\keyword\[wake_word_name]\kws.table /data/keyword command to push the kws.table file to the dev kit:

      adb push C:\SDSDK\Android-Sample-Release\keyword\kws.table /data/keyword
      adb push C:\SDSDK\Android-Sample-Release\keyword\Computer\kws_g.fst /data/keyword
      adb push C:\SDSDK\Android-Sample-Release\keyword\Computer\kws_k.fst /data/keyword
      adb push C:\SDSDK\Android-Sample-Release\keyword\Computer\words_kw.txt /data/keyword
      
    • Reference these files in the sample application. Find the following lines in MainActivity.java. Make sure that the keyword specified is the one you're using, and that the path points to the kws.table file that you pushed to the device.

      private static final String Keyword = "Computer";
      private static final String KeywordModel = "/data/keyword/kws.table";
      

      Note

      In your own code, you can use the kws.table file to create a keyword model instance and start recognition:

      KeywordRecognitionModel km = KeywordRecognitionModel.fromFile(KeywordModel);
      final Task<?> task = reco.startKeywordRecognitionAsync(km);
      
  6. Update the following lines, which contain the microphone array geometry settings:

    private static final String DeviceGeometry = "Circular6+1";
    private static final String SelectedGeometry = "Circular6+1";
    

    The following table describes the available values:

    Variable Meaning Available values
    DeviceGeometry Physical mic configuration For a circular dev kit: Circular6+1
    For a linear dev kit: Linear4
    SelectedGeometry Software mic configuration For a circular dev kit that uses all mics: Circular6+1
    For a circular dev kit that uses four mics: Circular3+1
    For a linear dev kit that uses all mics: Linear4
    For a linear dev kit that uses two mics: Linear2
  7. To build the application, on the Run menu, select Run 'app'. The Select Deployment Target dialog box appears.

  8. Select your device, and then select OK to deploy the application to the device.

    Select Deployment Target dialog box

  9. The Speech Devices SDK example application starts and displays the following options:

    Sample Speech Devices SDK example application and options

  10. Experiment!

Troubleshooting

Certificate failures

If you get certificate failures when you use the Speech service, make sure that your device has the correct date and time:

  1. Go to Settings. Under System, select Date & time.

    Under Settings, select Date & time

  2. Keep the Automatic date & time option selected. Under Select time zone, select your current time zone.

    Select date and time zone options

    When you see that the dev kit's time matches the time on your PC, the dev kit is connected to the internet.

    For more development information, see the ROOBO development guide.

Audio

ROOBO provides a tool that captures all audio to flash memory. It might help you troubleshoot audio issues. A version of the tool is provided for each development kit configuration. On the ROOBO site, select your device, and then select the ROOBO Tools link at the bottom of the page.