Download a compressed copy of the project, or run the following command and open up the folder if you have Git installed.
git clone https://github.com/RedKenrok/Electron-VoiceInterfaceBoilerplate.git && cd Electron-VoiceInterfaceBoilerplate
Make sure Node.js is installed, this installation will also include Npm.js. Run the following command install the project dependencies.
npm install --save
For audio recording the module 'node-audiorecorder' is used. This requires the usage of the 'rec' or on windows 'sox' command, please make sure this is installed and working. See the previously linked repository for more information.
In order to use the speech recognition and natural language processing an online API will be need to be configured so add either a Google Cloud Platform key or Wit.ai key to the data folder. See the two section below for more information.
Get the key file from the Google Cloud Platform as a json file. Rename this file to 'google-cloud.json' and add it to the 'app/keys/' directory.
For more information see step 1 through 3 of the quickstart guide of the Speech API and Language API.
Get the Access tokens from the Wit.ai site and add them to a file named 'wit-ai.json' in the 'app/keys/' directory.
{
"app_id": "App ID",
"server": "Server Access Token",
"client": "Client Access Token"
}
If you want to use snowboy's hotword detection and are running MacOS or a compatible Linux distro then add a file named 'hotworddetector.json' to the 'app/data/' directory and add the following information.
{
"detector": {
"resource": "./node_modules/snowboy/resources/common.res"
},
"models": [
{
"file": "./node_modules/snowboy/resources/snowboy.umdl",
"hotwords": "snowboy"
}
],
"recorder": {}
}
Replace the given data with your own and add any other to configure it.
If you are on windows and have errors during the post install phase when rebuilding the dependencies or get an error related to gyp or grpc try the following commands in a terminal with administrator privileges.
- Install python 2.7
npm i -g -production windows-build-tools
- Install node-gyp
npm i -g node-gyp
- Set the environmental path for python.
setx PYTHON "%USERPROFILE%.windows-build-tools\python27\python.exe"
- Restart the device for the environmental path to take effect.
- Remove the node_modules directory of the project.
- Reinstall the dependencies.
npm i --save