Taxonomy Icon

IoT

Develop a voice-based interface for your products using cognitive IoT services

Get the code

Summary

Building audio into your applications can be challenging, but Node-RED and Watson services makes it quicker and simpler than ever before. In this code pattern, you’ll learn how to capture audio requests, convert them to text and process them appropriately, and receive audio responses, thereby enabling you to build voice-based interfaces into your apps.

Description

In this code pattern, you’ll create an IBM Cloud app using the Node-RED Starter application. The Node-RED flow connects together the Speech to Text, Watson Assistant, and Text to Speech services to build the complete voice-based interface. The app records speech, converts it to text, processes the requests, sends responses in text, and converts the text back to speech to play through audio speakers.

When you have completed this code pattern, you’ll understand how to:

  • Use Watson cognitive services to build audio conversations
  • Use Watson IoT Platform to manage IoT data
  • Integrate voice-based interfaces in your apps

Flow

Architecture diagram for voice-based interfaces using cognitive IoT services

  1. Node-RED app records audio requests from the microphone.
  2. The Watson Speech to Text service converts your speech to text.
  3. Watson IoT Platform receives the text and assigns it to a device.
  4. Watson IoT Platform checks which kind of request it is:
    • (4a) If it is a request for weather information, it sends the request to the Weather Company Data service, which sends a response.
    • (4b1 and 4b2) If it is a command request, it sends the request to the Watson Tone Analyzer service, which sends it on to the Watson Assistant service, which uses the conversation workspace to process the conversation and send a response.
  5. The Watson Text to Speech service converts the text response to speech.
  6. The audio player reads aloud the response.

Instructions

Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.