The latest release of Watson Speech to Text and Text to Speech changed both the authentication mechanism and also how some of the APIs work This has necessitated changes to the code and answers for Chapter 3 (Speech to Text) and Chapter 4 (Text to Speech). Chapters 5 & following have the corrected code placed into the HTML/js, env.json, and controller/features folders.
##Changes: ##
env.json: Watson is now looking for an apikey and url instead of a userid and password
Speech To Text
token generation, not documented by IBM for nodeJS, is completely different in this release. So the server code (speech-to-text.js) has been rewritten to support the new iam based approach for generating a token. The token id in the browser side has also changed.
Text to Speech
The process to connect to the service and to run the synthesize process is also completely new on the server side. There are no changes on the browser side. Also, it seems that the initial invocation of synthesize always fails - there's some kind of race condition involved. So the server code forces an initial synthesize to get that error out of the way. You'll see this in the first few lines of the server side code.
To get the latest version of this repository onto your local system, assuming that you have followed the recommendation to first fork this repository and then clone from your own id, issue the two following commands.
The first command tells git to use this repository as the upstream master. You only need execute this command once during the life of your local cloned repository.
git remote add upstream https://github.com/rddill-IBM/ZeroToCognitive.git
The second command tells git to retrieve the latest information from the upstream master and integrate it into your local, cloned copy
git pull upstream master