Using the sample audio client
To quickly get started with the voice interface, download a sample Java-based audio client and connect it to your Watson Assistant Solutions tenant.
Note: To reconfigure your audio client, start the procedure from step 3.
Before you begin
- Install Java 8.
- Scroll down to the Java SE 8u* section.
- Click the JDK Download button.
- Accept the license agreement.
- Click the link for your operating system.
- Double-click the download file to install the Java JDK.
- Install Maven.
- Click the apache-maven-*-bin.zip link to download.
- Extract the Maven zip file to a directory on your local system.
- From the command line, add the Maven binaries to your PATH variable . For example, on a Mac OS, enter:
export PATH=paste-directory-where-you-unzipped-maven/bin:$PATH
- Create an IAM API key for your tenant. For instructions, see the Managing user API keys in the IBM Cloud Docs. Download the key file for later use.
- Sign in to your Watson Assistant Solutions tenant.
Procedure
- Copy the sample audio client to your system. Open a Git terminal and enter:
git clone https://github.com/Watson-Personal-Assistant/AudioClientSampleCodeJava.git
- In the sample client, copy the
config/configure.properties.example
file and rename it toconfig/configure.properties
. - Set the following mandatory parameters in the
config/configure.properties
file on the audio client.host=wa-audio-gateway.mybluemix.net userID=any-name-with-alphanumeric-hyphen-or-underscore-characters tenantID=paste-tenant-ID-here-if-you-have-multiple-tenants skillset=paste-skillset-here-eg-industry IAMAPIKey=paste-the-IAM-API-Key-created-earlier
- Build your audio client. From the top-level directory of your client, enter:
A JAR file for the audio client is created in themvn package
target/
directory. The file name includes a version number. Each build includes a -SNAPSHOT suffix. - Start the audio client JAR file. From the top-level directory of your client, enter:
On Raspberry Pi, enter:java -jar target/wpa-1.4-SNAPSHOT.jar
sudo java -jar wpa-1.4-SNAPSHOT.jar
- (Optional) Deploy the audio client to your audio device or Raspberry Pi and start the JAR file. Copy the audio client JAR file and the
/config
directory from the/target
directory and save them to a directory, for example,/watson
, on your device. For example:
The Jar file and the$ scp target/wpa-1.4-SNAPSHOT.jar pi@192.168.1.15:~/watson
/config
directory must be at the same level on your device. - Chat with your assistant.
- Press Enter on your keyboard to start and say "Hello". Pause after each utterance.
- Ask some questions. For example, "What is a hurricane" and "Tell me about bitcoin".
- Press Ctrl + C to stop the client.