├── screenshots ├── NodeRED-arecord-STT-flow.png ├── NodeRED-micropi-STT-flow.png ├── NodeRED-arecord-STT-dashboard.png ├── NodeRED-micropi-HeyWatson-flow.png ├── NodeRED-arecord-STT-dashboard-flow.png └── NodeRED-micropi-HeyWatson-STT-flow.png ├── README.md ├── LICENSE └── flows └── MatrixNodeREDSnowboy.json /screenshots/NodeRED-arecord-STT-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnwalicki/Node-RED-MatrixVoice/master/screenshots/NodeRED-arecord-STT-flow.png -------------------------------------------------------------------------------- /screenshots/NodeRED-micropi-STT-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnwalicki/Node-RED-MatrixVoice/master/screenshots/NodeRED-micropi-STT-flow.png -------------------------------------------------------------------------------- /screenshots/NodeRED-arecord-STT-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnwalicki/Node-RED-MatrixVoice/master/screenshots/NodeRED-arecord-STT-dashboard.png -------------------------------------------------------------------------------- /screenshots/NodeRED-micropi-HeyWatson-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnwalicki/Node-RED-MatrixVoice/master/screenshots/NodeRED-micropi-HeyWatson-flow.png -------------------------------------------------------------------------------- /screenshots/NodeRED-arecord-STT-dashboard-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnwalicki/Node-RED-MatrixVoice/master/screenshots/NodeRED-arecord-STT-dashboard-flow.png -------------------------------------------------------------------------------- /screenshots/NodeRED-micropi-HeyWatson-STT-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnwalicki/Node-RED-MatrixVoice/master/screenshots/NodeRED-micropi-HeyWatson-STT-flow.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Matrix Voice, Node-RED and Watson Cognitive APIs 2 | 3 | ## Introduction 4 | This repository contains examples of how I set up my Matrix Voice to record 5 | speech via Node-RED running on the Raspberry Pi. There are a few Node-RED flows 6 | which demonstrate the evolution of my experiments. 7 | 8 | Before you can use these examples, upgrade [Node-RED](http://nodered.org) on 9 | your Raspberry Pi. Older versions of Node.js and Node-RED are pre-installed 10 | on the default Raspbian image. I started with [Raspbian Stretch](https://www.raspberrypi.org/downloads/raspbian/), 11 | applied distro updates, then installed [Matrix Core](https://matrix-io.github.io/matrix-documentation/matrix-core/getting-started/installation/) only. I also used npm to install node-red-dashboard, node-red-contrib-microPi, node-red-contrib-snowboy, node-red-node-weather-underground and node-red-node-watson 12 | 13 | I started at the command line and made certain that I could record audio. 14 | > /usr/bin/arecord -d 5 --device=mic_channel0 -r 16000 -c 1 -f S16_LE /home/pi/test.wav 15 | 16 | Node-RED flows and screenshots included in this repository: 17 | * **arecord with Matrix Voice** - Simple flow which records a .wav file via the Matrix Voice 8 MEMs microphones and sends it to Watson Speech to Text for transcription. 18 | * **arecord with Matrix Voice controlled by a Node-RED Dashboard** - Same flow but controlled by a Node-RED dashboard. 19 | * **MicroPi with Watson Speech to Text** - Replace the arecord exec node with a hacked MicroPi node. 20 | * **Snowboy wake word example** - Use the Matrix Voice speaker to listen for a wake word "Hey Watson" using [Snowboy](https://flows.nodered.org/node/node-red-contrib-snowboy) 21 | * **Full example of Matrix Voice with a wake word and Watson Cognitive API to implement a ChatBot** - A bit more sophisticated example that lets you talk with your Raspberry Pi . I pass the streaming speech to node-red-contrib-snowboy to listen for a wake word. In my case “Hey Watson”. That wakes up a Node-RED flow that uses Watson Speech to Text, Watson Conversation (in another version) and Watson Text to Speech to interact with the user. 22 | 23 | ### Import a prebuilt flow from GitHub 24 | Since configuring Node-RED nodes and wiring them together requires many steps to document in screenshots, there is an easier way to build a flow by importing a prebuilt flow into your Node-RED editor. 25 | 26 | * Some of the sections below will have a **Get the Code** link. 27 | 28 | * When instructed, open the **Get the Code** github URL, mark or Ctrl-A to select all of the text, and copy the text for the flow to your Clipboard. 29 | * Click on the Node-RED Menu **(6)**, then Import **(7)**, then Clipboard **(8)**. 30 | ![Node-RED import screenshot](https://github.com/johnwalicki/IoT-AssetTracking-Perishable-Network-Blockchain/blob/master/Node-RED/screenshots/IBMCloud-NodeRED-import.png?raw=true) 31 | * Paste the text of the flow into the **Import nodes** dialog and press the red **Import** button. 32 | ![Node-RED import from clipboard screenshot](https://github.com/johnwalicki/IoT-AssetTracking-Perishable-Network-Blockchain/blob/master/Node-RED/screenshots/IBMCloud-NodeRED-pastefromclipboard.png) 33 | * The new flow will be imported into **new tabs** in the Node-RED Editor. 34 | 35 | ## Get the flow 36 | As a first step, copy the code from GitHub to your Clipboard and import it into your Node-RED editor. 37 | 38 | Get the Code - [Node-RED Matrix Voice flows](flows/MatrixNodeREDSnowboy.json) 39 | 40 | ## Matrix Voice Node-RED Screenshots 41 | **arecord with Matrix Voice** - Simple flow which records a .wav file via the Matrix Voice 8 MEMs microphones and sends it to Watson Speech to Text for transcription. 42 | ![arecord with Matrix Voice](screenshots/NodeRED-arecord-STT-flow.png?raw=true) 43 | 44 | **arecord with Matrix Voice controlled by a Node-RED Dashboard** - Same flow but controlled by a Node-RED dashboard. 45 | ![arecord with Matrix Voice controlled by a NR Dashboad](screenshots/NodeRED-arecord-STT-dashboard-flow.png?raw=true) 46 | ![Matrix Voice controlled by a NR Dashboad](screenshots/NodeRED-arecord-STT-dashboard.png?raw=true) 47 | 48 | **MicroPi with Watson Speech to Text** - Replace the arecord exec node with a hacked MicroPi node. 49 | ![MicroPi with Watson Speech to Text](screenshots/NodeRED-micropi-STT-flow.png?raw=true) 50 | 51 | **Snowboy wake word example** - Use the Matrix Voice speaker to listen for a wake word "Hey Watson" using [Snowboy](https://flows.nodered.org/node/node-red-contrib-snowboy) 52 | ![Snowboy wake word example](screenshots/NodeRED-micropi-HeyWatson-flow.png?raw=true) 53 | 54 | **Full example of Matrix Voice with a wake word and Watson Cognitive API to implement a ChatBot** 55 | ![Watson Chatbot with Matrix Voice](screenshots/NodeRED-micropi-HeyWatson-STT-flow.png?raw=true) 56 | 57 | # Hacking node-red-contrib-microPi 58 | The node-red-contrib-micropi node expects to record USB Audio via 59 | > arecord -D plughw:1,0 60 | 61 | Matrix Voice outputs audio on mic_channel0. 62 | You can test with 63 | > $ /usr/bin/arecord -d 5 --device=mic_channel0 -r 16000 -c 1 -f S16_LE /home/pi/test.wav 64 | 65 | I had installed node-red-contrib-micropi into /usr/lib/node_modules, so as root, edit 66 | /usr/lib/node_modules/node-red-contrib-micropi/micropi/nodes/micropi/lib/mic.js 67 | and change 68 | > _device = options.device || 'plughw:1,0'; 69 | 70 | into 71 | > _device = options.device || 'mic_channel0'; 72 | 73 | I'll propose a formal patch to node-red-contrib-microPi 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /flows/MatrixNodeREDSnowboy.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "b362ebad.6aeea", 4 | "type": "tab", 5 | "label": "arecord with Matrix Voice", 6 | "disabled": false, 7 | "info": "" 8 | }, 9 | { 10 | "id": "5ebc51e3.44925", 11 | "type": "tab", 12 | "label": "Simple Speech Dashboard", 13 | "disabled": false, 14 | "info": "" 15 | }, 16 | { 17 | "id": "5781a723.05cf58", 18 | "type": "tab", 19 | "label": "Microphone", 20 | "disabled": false, 21 | "info": "" 22 | }, 23 | { 24 | "id": "81d3569a.48c9e8", 25 | "type": "tab", 26 | "label": "Hey Watson", 27 | "disabled": false, 28 | "info": "" 29 | }, 30 | { 31 | "id": "b91bb085.c3bf28", 32 | "type": "tab", 33 | "label": "Matrix Voice Hey Watson", 34 | "disabled": false, 35 | "info": "" 36 | }, 37 | { 38 | "id": "d9ac9e76.5dd8f8", 39 | "type": "ui_group", 40 | "z": "b362ebad.6aeea", 41 | "name": "Speech Example", 42 | "tab": "b2e69e0d.c7392", 43 | "disp": true, 44 | "width": "10", 45 | "collapse": false 46 | }, 47 | { 48 | "id": "b2e69e0d.c7392", 49 | "type": "ui_tab", 50 | "z": "", 51 | "name": "Watson Speech Dashboard Example", 52 | "icon": "dashboard", 53 | "order": 1 54 | }, 55 | { 56 | "id": "c38bd1ea.0587e", 57 | "type": "ui_base", 58 | "theme": { 59 | "name": "theme-light", 60 | "lightTheme": { 61 | "default": "#0094CE", 62 | "baseColor": "#0094CE", 63 | "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif", 64 | "edited": true, 65 | "reset": false 66 | }, 67 | "darkTheme": { 68 | "default": "#097479", 69 | "baseColor": "#097479", 70 | "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif", 71 | "edited": false 72 | }, 73 | "customTheme": { 74 | "name": "Untitled Theme 1", 75 | "default": "#4B7930", 76 | "baseColor": "#4B7930", 77 | "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif" 78 | }, 79 | "themeState": { 80 | "base-color": { 81 | "default": "#0094CE", 82 | "value": "#0094CE", 83 | "edited": false 84 | }, 85 | "page-titlebar-backgroundColor": { 86 | "value": "#0094CE", 87 | "edited": false 88 | }, 89 | "page-backgroundColor": { 90 | "value": "#fafafa", 91 | "edited": false 92 | }, 93 | "page-sidebar-backgroundColor": { 94 | "value": "#ffffff", 95 | "edited": false 96 | }, 97 | "group-textColor": { 98 | "value": "#1bbfff", 99 | "edited": false 100 | }, 101 | "group-borderColor": { 102 | "value": "#ffffff", 103 | "edited": false 104 | }, 105 | "group-backgroundColor": { 106 | "value": "#ffffff", 107 | "edited": false 108 | }, 109 | "widget-textColor": { 110 | "value": "#111111", 111 | "edited": false 112 | }, 113 | "widget-backgroundColor": { 114 | "value": "#0094ce", 115 | "edited": false 116 | }, 117 | "widget-borderColor": { 118 | "value": "#ffffff", 119 | "edited": false 120 | }, 121 | "base-font": { 122 | "value": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif" 123 | } 124 | } 125 | }, 126 | "site": { 127 | "name": "Node-RED Dashboard", 128 | "hideToolbar": "false", 129 | "allowSwipe": "false", 130 | "dateFormat": "DD/MM/YYYY", 131 | "sizes": { 132 | "sx": 48, 133 | "sy": 48, 134 | "gx": 6, 135 | "gy": 6, 136 | "cx": 6, 137 | "cy": 6, 138 | "px": 0, 139 | "py": 0 140 | } 141 | } 142 | }, 143 | { 144 | "id": "22fb4b35.14daac", 145 | "type": "inject", 146 | "z": "b362ebad.6aeea", 147 | "name": "Click here to Start Recording", 148 | "topic": "", 149 | "payload": "start", 150 | "payloadType": "str", 151 | "repeat": "", 152 | "crontab": "", 153 | "once": false, 154 | "onceDelay": "", 155 | "x": 180, 156 | "y": 100, 157 | "wires": [ 158 | [ 159 | "a936ab52.c82f38" 160 | ] 161 | ] 162 | }, 163 | { 164 | "id": "a7a299f5.a2bf68", 165 | "type": "comment", 166 | "z": "b362ebad.6aeea", 167 | "name": "#2 Pass the .wav buffer to Watson Speech to Text", 168 | "info": "Pass the .wav buffer to Watson Speech to Text", 169 | "x": 490, 170 | "y": 320, 171 | "wires": [] 172 | }, 173 | { 174 | "id": "8417f383.317158", 175 | "type": "watson-speech-to-text", 176 | "z": "b362ebad.6aeea", 177 | "name": "", 178 | "alternatives": "", 179 | "speakerlabels": false, 180 | "smartformatting": false, 181 | "lang": "en-US", 182 | "langhidden": "en-US", 183 | "langcustom": "NoCustomisationSetting", 184 | "langcustomhidden": "", 185 | "band": "BroadbandModel", 186 | "bandhidden": "BroadbandModel", 187 | "password": "", 188 | "payload-response": true, 189 | "streaming-mode": false, 190 | "default-endpoint": true, 191 | "service-endpoint": "", 192 | "x": 440, 193 | "y": 360, 194 | "wires": [ 195 | [ 196 | "2a01996c.38a6b6" 197 | ] 198 | ] 199 | }, 200 | { 201 | "id": "9afc9e0d.9d45d8", 202 | "type": "comment", 203 | "z": "b362ebad.6aeea", 204 | "name": "#1 Record a message", 205 | "info": "/usr/bin/arecord is available on \n - Mac OSX\n - Linux (ALSA)\n\nExperiment with SoX on Windows", 206 | "x": 120, 207 | "y": 60, 208 | "wires": [] 209 | }, 210 | { 211 | "id": "2a01996c.38a6b6", 212 | "type": "debug", 213 | "z": "b362ebad.6aeea", 214 | "name": "", 215 | "active": true, 216 | "tosidebar": true, 217 | "console": false, 218 | "tostatus": false, 219 | "complete": "payload", 220 | "x": 630, 221 | "y": 360, 222 | "wires": [] 223 | }, 224 | { 225 | "id": "a936ab52.c82f38", 226 | "type": "exec", 227 | "z": "b362ebad.6aeea", 228 | "command": "/usr/bin/arecord -d 5 --device=mic_channel0 -r 16000 -c 1 -f S16_LE /home/pi/test.wav", 229 | "addpay": false, 230 | "append": "", 231 | "useSpawn": "false", 232 | "timer": "", 233 | "oldrc": false, 234 | "name": "", 235 | "x": 410, 236 | "y": 220, 237 | "wires": [ 238 | [ 239 | "63696ebb.e9b65" 240 | ], 241 | [], 242 | [] 243 | ] 244 | }, 245 | { 246 | "id": "63696ebb.e9b65", 247 | "type": "file in", 248 | "z": "b362ebad.6aeea", 249 | "name": "", 250 | "filename": "/home/pi/test.wav", 251 | "format": "", 252 | "chunk": false, 253 | "sendError": false, 254 | "x": 230, 255 | "y": 360, 256 | "wires": [ 257 | [ 258 | "8417f383.317158" 259 | ] 260 | ] 261 | }, 262 | { 263 | "id": "d133ffa6.7c2a08", 264 | "type": "comment", 265 | "z": "5ebc51e3.44925", 266 | "name": "#2 Pass the .wav buffer to Watson Speech to Text", 267 | "info": "Pass the .wav buffer to Watson Speech to Text", 268 | "x": 450, 269 | "y": 320, 270 | "wires": [] 271 | }, 272 | { 273 | "id": "6bd3011d.ea1ce", 274 | "type": "ui_button", 275 | "z": "5ebc51e3.44925", 276 | "name": "Start Recording", 277 | "group": "d9ac9e76.5dd8f8", 278 | "order": 1, 279 | "width": 0, 280 | "height": 0, 281 | "passthru": false, 282 | "label": "Start Recording", 283 | "color": "black", 284 | "bgcolor": "", 285 | "icon": "", 286 | "payload": "start", 287 | "payloadType": "str", 288 | "topic": "", 289 | "x": 140, 290 | "y": 100, 291 | "wires": [ 292 | [ 293 | "8c975485.0a3" 294 | ] 295 | ] 296 | }, 297 | { 298 | "id": "f0d2d159.723628", 299 | "type": "watson-speech-to-text", 300 | "z": "5ebc51e3.44925", 301 | "name": "", 302 | "alternatives": "", 303 | "speakerlabels": false, 304 | "smartformatting": false, 305 | "lang": "en-US", 306 | "langhidden": "en-US", 307 | "langcustom": "NoCustomisationSetting", 308 | "langcustomhidden": "", 309 | "band": "BroadbandModel", 310 | "bandhidden": "BroadbandModel", 311 | "password": "", 312 | "payload-response": true, 313 | "streaming-mode": false, 314 | "default-endpoint": true, 315 | "service-endpoint": "", 316 | "x": 440, 317 | "y": 360, 318 | "wires": [ 319 | [ 320 | "41bc0135.ffa85", 321 | "24c65e64.687e9a" 322 | ] 323 | ] 324 | }, 325 | { 326 | "id": "1652d675.7ef082", 327 | "type": "comment", 328 | "z": "5ebc51e3.44925", 329 | "name": "#1 Record a message", 330 | "info": "/usr/bin/arecord is available on \n - Mac OSX\n - Linux (ALSA)\n\nExperiment with SoX on Windows", 331 | "x": 120, 332 | "y": 60, 333 | "wires": [] 334 | }, 335 | { 336 | "id": "41bc0135.ffa85", 337 | "type": "debug", 338 | "z": "5ebc51e3.44925", 339 | "name": "", 340 | "active": true, 341 | "tosidebar": true, 342 | "console": false, 343 | "tostatus": false, 344 | "complete": "payload", 345 | "x": 630, 346 | "y": 360, 347 | "wires": [] 348 | }, 349 | { 350 | "id": "8c975485.0a3", 351 | "type": "exec", 352 | "z": "5ebc51e3.44925", 353 | "command": "/usr/bin/arecord -d 5 --device=mic_channel0 -r 16000 -c 1 -f S16_LE /home/pi/test.wav", 354 | "addpay": false, 355 | "append": "", 356 | "useSpawn": "false", 357 | "timer": "", 358 | "oldrc": false, 359 | "name": "", 360 | "x": 410, 361 | "y": 220, 362 | "wires": [ 363 | [ 364 | "641a2e10.ae6de8" 365 | ], 366 | [], 367 | [] 368 | ] 369 | }, 370 | { 371 | "id": "641a2e10.ae6de8", 372 | "type": "file in", 373 | "z": "5ebc51e3.44925", 374 | "name": "", 375 | "filename": "/home/pi/test.wav", 376 | "format": "", 377 | "chunk": false, 378 | "sendError": false, 379 | "x": 230, 380 | "y": 360, 381 | "wires": [ 382 | [ 383 | "f0d2d159.723628" 384 | ] 385 | ] 386 | }, 387 | { 388 | "id": "24c65e64.687e9a", 389 | "type": "ui_text", 390 | "z": "5ebc51e3.44925", 391 | "group": "d9ac9e76.5dd8f8", 392 | "order": 2, 393 | "width": 0, 394 | "height": 0, 395 | "name": "", 396 | "label": "Transcript", 397 | "format": "{{msg.payload}}", 398 | "layout": "row-spread", 399 | "x": 620, 400 | "y": 400, 401 | "wires": [] 402 | }, 403 | { 404 | "id": "47abadde.a6a60c", 405 | "type": "inject", 406 | "z": "5781a723.05cf58", 407 | "name": "Click here to Start Recording", 408 | "topic": "", 409 | "payload": "true", 410 | "payloadType": "bool", 411 | "repeat": "", 412 | "crontab": "", 413 | "once": false, 414 | "x": 160, 415 | "y": 100, 416 | "wires": [ 417 | [ 418 | "f1ef04e4.8090d" 419 | ] 420 | ] 421 | }, 422 | { 423 | "id": "1bb50c3d.21d97c", 424 | "type": "inject", 425 | "z": "5781a723.05cf58", 426 | "name": "Click here to Stop Recording", 427 | "topic": "", 428 | "payload": "false", 429 | "payloadType": "bool", 430 | "repeat": "", 431 | "crontab": "", 432 | "once": false, 433 | "x": 160, 434 | "y": 140, 435 | "wires": [ 436 | [ 437 | "f1ef04e4.8090d" 438 | ] 439 | ] 440 | }, 441 | { 442 | "id": "daa86ca9.7a3b38", 443 | "type": "comment", 444 | "z": "5781a723.05cf58", 445 | "name": "node-red-contrib-micropi dependency", 446 | "info": "This flow requires the\n node-red-contrib-micropi\nfor the Micro Pi node.\nYou can either \n $ sudo npm -g install node-red-contrib-micropi\n and restart the Node-RED service\nor install it from Node-RED Manage Palette.", 447 | "x": 290, 448 | "y": 60, 449 | "wires": [] 450 | }, 451 | { 452 | "id": "d5ad2005.a149a8", 453 | "type": "microPi", 454 | "z": "5781a723.05cf58", 455 | "name": "microPi", 456 | "filename": "/home/pi/audio/demo.wav", 457 | "domain": "http://localhost:1880/getAudio", 458 | "rate": "16000", 459 | "bitwidth": "16", 460 | "endian": "little", 461 | "encoding": "signed-integer", 462 | "channels": "1", 463 | "silence": "10", 464 | "debug": "true", 465 | "mode": "", 466 | "x": 640, 467 | "y": 120, 468 | "wires": [ 469 | [], 470 | [ 471 | "8a6329a6.25372" 472 | ], 473 | [] 474 | ] 475 | }, 476 | { 477 | "id": "2f79707f.d6f878", 478 | "type": "comment", 479 | "z": "5781a723.05cf58", 480 | "name": "#2 Pass the .wav buffer to Watson Speech to Text", 481 | "info": "Pass the .wav buffer to Watson Speech to Text", 482 | "x": 550, 483 | "y": 280, 484 | "wires": [] 485 | }, 486 | { 487 | "id": "55268039.559fd8", 488 | "type": "watson-speech-to-text", 489 | "z": "5781a723.05cf58", 490 | "name": "", 491 | "alternatives": "", 492 | "speakerlabels": false, 493 | "smartformatting": false, 494 | "lang": "en-US", 495 | "langhidden": "en-US", 496 | "langcustom": "NoCustomisationSetting", 497 | "langcustomhidden": "", 498 | "band": "BroadbandModel", 499 | "bandhidden": "BroadbandModel", 500 | "password": "", 501 | "payload-response": true, 502 | "streaming-mode": false, 503 | "default-endpoint": true, 504 | "service-endpoint": "", 505 | "x": 500, 506 | "y": 320, 507 | "wires": [ 508 | [ 509 | "33e1ce1a.ce327a" 510 | ] 511 | ] 512 | }, 513 | { 514 | "id": "33e1ce1a.ce327a", 515 | "type": "debug", 516 | "z": "5781a723.05cf58", 517 | "name": "", 518 | "active": true, 519 | "tosidebar": true, 520 | "console": false, 521 | "tostatus": false, 522 | "complete": "payload", 523 | "x": 690, 524 | "y": 320, 525 | "wires": [] 526 | }, 527 | { 528 | "id": "8a6329a6.25372", 529 | "type": "file in", 530 | "z": "5781a723.05cf58", 531 | "name": "", 532 | "filename": "/home/pi/audio/demo.wav", 533 | "format": "", 534 | "chunk": false, 535 | "sendError": true, 536 | "x": 250, 537 | "y": 320, 538 | "wires": [ 539 | [ 540 | "55268039.559fd8" 541 | ] 542 | ] 543 | }, 544 | { 545 | "id": "f1ef04e4.8090d", 546 | "type": "change", 547 | "z": "5781a723.05cf58", 548 | "name": "", 549 | "rules": [ 550 | { 551 | "t": "set", 552 | "p": "options.device", 553 | "pt": "msg", 554 | "to": "mic_channel0", 555 | "tot": "str" 556 | } 557 | ], 558 | "action": "", 559 | "property": "", 560 | "from": "", 561 | "to": "", 562 | "reg": false, 563 | "x": 430, 564 | "y": 120, 565 | "wires": [ 566 | [ 567 | "d5ad2005.a149a8" 568 | ] 569 | ] 570 | }, 571 | { 572 | "id": "4bcc3f21.f751", 573 | "type": "inject", 574 | "z": "81d3569a.48c9e8", 575 | "name": "Click here to Start Recording", 576 | "topic": "", 577 | "payload": "true", 578 | "payloadType": "bool", 579 | "repeat": "", 580 | "crontab": "", 581 | "once": false, 582 | "x": 160, 583 | "y": 100, 584 | "wires": [ 585 | [ 586 | "6210b55c.843e34" 587 | ] 588 | ] 589 | }, 590 | { 591 | "id": "dd499212.6b27c", 592 | "type": "inject", 593 | "z": "81d3569a.48c9e8", 594 | "name": "Click here to Stop Recording", 595 | "topic": "", 596 | "payload": "false", 597 | "payloadType": "bool", 598 | "repeat": "", 599 | "crontab": "", 600 | "once": false, 601 | "x": 160, 602 | "y": 140, 603 | "wires": [ 604 | [ 605 | "6210b55c.843e34" 606 | ] 607 | ] 608 | }, 609 | { 610 | "id": "2082c6a8.c17f12", 611 | "type": "comment", 612 | "z": "81d3569a.48c9e8", 613 | "name": "node-red-contrib-micropi dependency", 614 | "info": "This flow requires the\n node-red-contrib-micropi\nfor the Micro Pi node.\nYou can either \n $ sudo npm -g install node-red-contrib-micropi\n and restart the Node-RED service\nor install it from Node-RED Manage Palette.", 615 | "x": 290, 616 | "y": 60, 617 | "wires": [] 618 | }, 619 | { 620 | "id": "3b25074b.528108", 621 | "type": "microPi", 622 | "z": "81d3569a.48c9e8", 623 | "name": "microPi", 624 | "filename": "/home/pi/audio/demo.wav", 625 | "domain": "http://localhost:1880/getAudio", 626 | "rate": "16000", 627 | "bitwidth": "16", 628 | "endian": "little", 629 | "encoding": "signed-integer", 630 | "channels": "1", 631 | "silence": "10", 632 | "debug": "false", 633 | "mode": "", 634 | "x": 620, 635 | "y": 120, 636 | "wires": [ 637 | [ 638 | "b28fd5dd.f113a" 639 | ], 640 | [], 641 | [] 642 | ] 643 | }, 644 | { 645 | "id": "4f3b5666.910e7", 646 | "type": "debug", 647 | "z": "81d3569a.48c9e8", 648 | "name": "", 649 | "active": true, 650 | "console": "false", 651 | "complete": "true", 652 | "x": 1050, 653 | "y": 120, 654 | "wires": [] 655 | }, 656 | { 657 | "id": "b28fd5dd.f113a", 658 | "type": "Snowboy", 659 | "z": "81d3569a.48c9e8", 660 | "name": "Hey Watson hotword detector", 661 | "detectorFile": "/home/pi/snowboy/rpi-arm-raspbian-8.0-1.1.1/resources/common.res", 662 | "models": [ 663 | { 664 | "idxOutput": 0, 665 | "nbOutputs": 1, 666 | "hotwords": "", 667 | "sensitivity": "", 668 | "file": "/home/pi/snowboy/Hey Watson.pmdl" 669 | } 670 | ], 671 | "multipleOutput": "false", 672 | "debug": "true", 673 | "x": 850, 674 | "y": 120, 675 | "wires": [ 676 | [ 677 | "4f3b5666.910e7" 678 | ] 679 | ] 680 | }, 681 | { 682 | "id": "6210b55c.843e34", 683 | "type": "change", 684 | "z": "81d3569a.48c9e8", 685 | "name": "", 686 | "rules": [ 687 | { 688 | "t": "set", 689 | "p": "options.device", 690 | "pt": "msg", 691 | "to": "mic_channel0", 692 | "tot": "str" 693 | } 694 | ], 695 | "action": "", 696 | "property": "", 697 | "from": "", 698 | "to": "", 699 | "reg": false, 700 | "x": 430, 701 | "y": 120, 702 | "wires": [ 703 | [ 704 | "3b25074b.528108" 705 | ] 706 | ] 707 | }, 708 | { 709 | "id": "13b54aad.e148ed", 710 | "type": "comment", 711 | "z": "5781a723.05cf58", 712 | "name": "Hacked version of MicroPi - READ THIS", 713 | "info": "MicroPi expects to record USB Audio via \n arecord -D plughw:1,0\nMatrix Voice outputs audio on mic_channel0\n arecord -D mic_channel0\n \nAs root, edit\n /usr/lib/node_modules/node-red-contrib-micropi/micropi/nodes/micropi/lib/mic.js\nchange\n _device = options.device || 'plughw:1,0';\nto\n _device = options.device || 'mic_channel0';\n", 714 | "x": 670, 715 | "y": 60, 716 | "wires": [] 717 | }, 718 | { 719 | "id": "cf14d705.d98b2", 720 | "type": "comment", 721 | "z": "81d3569a.48c9e8", 722 | "name": "Hacked version of MicroPi - READ THIS", 723 | "info": "MicroPi expects to record USB Audio via \n arecord -D plughw:1,0\nMatrix Voice outputs audio on mic_channel0\n arecord -D mic_channel0\n \nAs root, edit\n /usr/lib/node_modules/node-red-contrib-micropi/micropi/nodes/micropi/lib/mic.js\nchange\n _device = options.device || 'plughw:1,0';\nto\n _device = options.device || 'mic_channel0';\n", 724 | "x": 630, 725 | "y": 60, 726 | "wires": [] 727 | }, 728 | { 729 | "id": "d2c4caf0.971328", 730 | "type": "watson-speech-to-text", 731 | "z": "b91bb085.c3bf28", 732 | "name": "", 733 | "alternatives": "", 734 | "speakerlabels": false, 735 | "smartformatting": false, 736 | "lang": "en-US", 737 | "langhidden": "en-US", 738 | "langcustom": "NoCustomisationSetting", 739 | "langcustomhidden": "", 740 | "band": "BroadbandModel", 741 | "bandhidden": "BroadbandModel", 742 | "password": "", 743 | "payload-response": true, 744 | "streaming-mode": false, 745 | "default-endpoint": true, 746 | "service-endpoint": "", 747 | "x": 840, 748 | "y": 280, 749 | "wires": [ 750 | [ 751 | "e0acef2e.014348", 752 | "937ca935.77df2" 753 | ] 754 | ] 755 | }, 756 | { 757 | "id": "e0acef2e.014348", 758 | "type": "debug", 759 | "z": "b91bb085.c3bf28", 760 | "name": "", 761 | "active": true, 762 | "console": "false", 763 | "complete": "transcription", 764 | "x": 1090, 765 | "y": 280, 766 | "wires": [] 767 | }, 768 | { 769 | "id": "937ca935.77df2", 770 | "type": "switch", 771 | "z": "b91bb085.c3bf28", 772 | "name": "Select Entities", 773 | "property": "payload", 774 | "propertyType": "msg", 775 | "rules": [ 776 | { 777 | "t": "cont", 778 | "v": "bye", 779 | "vt": "str" 780 | }, 781 | { 782 | "t": "cont", 783 | "v": "joke", 784 | "vt": "str" 785 | }, 786 | { 787 | "t": "cont", 788 | "v": "weather", 789 | "vt": "str" 790 | }, 791 | { 792 | "t": "else" 793 | } 794 | ], 795 | "checkall": "true", 796 | "repair": false, 797 | "outputs": 4, 798 | "x": 120, 799 | "y": 620, 800 | "wires": [ 801 | [ 802 | "e0592d63.da4da8" 803 | ], 804 | [ 805 | "e5da7cb0.480208" 806 | ], 807 | [ 808 | "ecdd0a41.ca9698" 809 | ], 810 | [ 811 | "9302da50.0c6c6" 812 | ] 813 | ] 814 | }, 815 | { 816 | "id": "bb682b4d.7d5cf8", 817 | "type": "comment", 818 | "z": "b91bb085.c3bf28", 819 | "name": "Tell the Matrix Voice to tell a joke or ask for the Weather Report", 820 | "info": "", 821 | "x": 630, 822 | "y": 40, 823 | "wires": [] 824 | }, 825 | { 826 | "id": "d7dd28db.680178", 827 | "type": "comment", 828 | "z": "b91bb085.c3bf28", 829 | "name": "Paste API keys for Speech to Text", 830 | "info": "1. Log into Bluemix\n2. Create an instance of the \nWatson Speech to Text service.\n3. Visit the Service Credentials tab\n4. Click on View Credentials\n5. Copy/Paste the password and username into\nthis Node-RED node.", 831 | "x": 900, 832 | "y": 240, 833 | "wires": [] 834 | }, 835 | { 836 | "id": "1da802b3.a76b4d", 837 | "type": "comment", 838 | "z": "b91bb085.c3bf28", 839 | "name": "node-red-node-watson dependency", 840 | "info": "This flow requires the\n node-red-node-watson\nfor the following Watson nodes:\n Speech to Text\n\nYou can either \n $ sudo npm -g install node-red-node-watson\n and restart the Node-RED service\nor install it from Node-RED Manage Palette.", 841 | "x": 980, 842 | "y": 200, 843 | "wires": [] 844 | }, 845 | { 846 | "id": "9302da50.0c6c6", 847 | "type": "change", 848 | "z": "b91bb085.c3bf28", 849 | "name": "Huh? Continue listening", 850 | "rules": [ 851 | { 852 | "t": "set", 853 | "p": "payload", 854 | "pt": "msg", 855 | "to": "0,0,0", 856 | "tot": "str" 857 | } 858 | ], 859 | "action": "", 860 | "property": "", 861 | "from": "", 862 | "to": "", 863 | "reg": false, 864 | "x": 370, 865 | "y": 720, 866 | "wires": [ 867 | [ 868 | "32c6a7f4.f3c128" 869 | ] 870 | ] 871 | }, 872 | { 873 | "id": "5099f3dd.2cebec", 874 | "type": "change", 875 | "z": "b91bb085.c3bf28", 876 | "name": "Forecast", 877 | "rules": [ 878 | { 879 | "t": "set", 880 | "p": "payload", 881 | "pt": "msg", 882 | "to": "payload.forecast", 883 | "tot": "msg" 884 | } 885 | ], 886 | "action": "", 887 | "property": "", 888 | "from": "", 889 | "to": "", 890 | "reg": false, 891 | "x": 580, 892 | "y": 640, 893 | "wires": [ 894 | [ 895 | "2cde2988.9e41f6" 896 | ] 897 | ] 898 | }, 899 | { 900 | "id": "2cde2988.9e41f6", 901 | "type": "watson-text-to-speech", 902 | "z": "b91bb085.c3bf28", 903 | "name": "", 904 | "lang": "en-US", 905 | "langhidden": "en-US", 906 | "langcustom": "NoCustomisationSetting", 907 | "langcustomhidden": "", 908 | "voice": "en-US_MichaelVoice", 909 | "voicehidden": "en-US_MichaelVoice", 910 | "format": "audio/wav", 911 | "password": "", 912 | "payload-response": true, 913 | "default-endpoint": true, 914 | "service-endpoint": "", 915 | "x": 740, 916 | "y": 600, 917 | "wires": [ 918 | [ 919 | "3afb802b.66754", 920 | "beeeb4de.95af98" 921 | ] 922 | ] 923 | }, 924 | { 925 | "id": "ecdd0a41.ca9698", 926 | "type": "wunderground", 927 | "z": "b91bb085.c3bf28", 928 | "name": "", 929 | "lon": "", 930 | "lat": "", 931 | "city": "New York", 932 | "country": "ny", 933 | "x": 340, 934 | "y": 640, 935 | "wires": [ 936 | [ 937 | "5099f3dd.2cebec", 938 | "855b1283.8d0588" 939 | ] 940 | ] 941 | }, 942 | { 943 | "id": "855b1283.8d0588", 944 | "type": "debug", 945 | "z": "b91bb085.c3bf28", 946 | "name": "", 947 | "active": true, 948 | "console": "false", 949 | "complete": "payload.forecast", 950 | "x": 620, 951 | "y": 680, 952 | "wires": [] 953 | }, 954 | { 955 | "id": "7a35b108.5d658", 956 | "type": "comment", 957 | "z": "b91bb085.c3bf28", 958 | "name": "Paste API keys for Text to Speech", 959 | "info": "1. Log into Bluemix\n2. Create an instance of the \nWatson Text to Speech service.\n3. Visit the Service Credentials tab\n4. Click on View Credentials\n5. Copy/Paste the password and username into\nthis Node-RED node.", 960 | "x": 660, 961 | "y": 560, 962 | "wires": [] 963 | }, 964 | { 965 | "id": "b4a35369.a1bb1", 966 | "type": "comment", 967 | "z": "b91bb085.c3bf28", 968 | "name": "node-red-node-watson dependency", 969 | "info": "This flow requires the\n node-red-node-watson@0.5.10 or higher\nfor the following Watson nodes:\n Text to Speech\n Speech to Text\n Tone Analyzer\n Visual Recognition\n\nYou can either \n $ sudo npm -g install node-red-node-watson\n and restart the Node-RED service\nor install it from Node-RED Manage Palette.", 970 | "x": 600, 971 | "y": 480, 972 | "wires": [] 973 | }, 974 | { 975 | "id": "be6604dd.b60d2", 976 | "type": "comment", 977 | "z": "b91bb085.c3bf28", 978 | "name": "node-red-node-weather-underground dependency", 979 | "info": "This flow requires\n node-red-node-weather-underground\n\nYou can either \n $ sudo npm -g install node-red-node-weather-underground\n and restart the Node-RED service\nor install it from Node-RED Manage Palette.", 980 | "x": 450, 981 | "y": 760, 982 | "wires": [] 983 | }, 984 | { 985 | "id": "d252f097.ab147", 986 | "type": "comment", 987 | "z": "b91bb085.c3bf28", 988 | "name": "WeatherUnderground API", 989 | "info": "Visit \n https://www.wunderground.com/weather/api/\nto get yourself a free developer API key.", 990 | "x": 370, 991 | "y": 680, 992 | "wires": [] 993 | }, 994 | { 995 | "id": "1617e270.86bd56", 996 | "type": "comment", 997 | "z": "b91bb085.c3bf28", 998 | "name": "node-red-contrib-micropi dependency", 999 | "info": "This flow requires the\n node-red-contrib-micropi\nfor the Micro Pi node.\nYou can either \n $ sudo npm -g install node-red-contrib-micropi\n and restart the Node-RED service\nor install it from Node-RED Manage Palette.", 1000 | "x": 210, 1001 | "y": 60, 1002 | "wires": [] 1003 | }, 1004 | { 1005 | "id": "1d4b6c34.2eedb4", 1006 | "type": "inject", 1007 | "z": "b91bb085.c3bf28", 1008 | "name": "Click here to Start Recording", 1009 | "topic": "", 1010 | "payload": "true", 1011 | "payloadType": "bool", 1012 | "repeat": "", 1013 | "crontab": "", 1014 | "once": false, 1015 | "onceDelay": "", 1016 | "x": 180, 1017 | "y": 140, 1018 | "wires": [ 1019 | [ 1020 | "f8a43192.067dc" 1021 | ] 1022 | ] 1023 | }, 1024 | { 1025 | "id": "fe054964.385838", 1026 | "type": "inject", 1027 | "z": "b91bb085.c3bf28", 1028 | "name": "Click here to Stop Recording", 1029 | "topic": "", 1030 | "payload": "false", 1031 | "payloadType": "bool", 1032 | "repeat": "", 1033 | "crontab": "", 1034 | "once": false, 1035 | "x": 180, 1036 | "y": 180, 1037 | "wires": [ 1038 | [ 1039 | "f8a43192.067dc" 1040 | ] 1041 | ] 1042 | }, 1043 | { 1044 | "id": "f8a43192.067dc", 1045 | "type": "microPi", 1046 | "z": "b91bb085.c3bf28", 1047 | "name": "microPi", 1048 | "filename": "/dev/null", 1049 | "domain": "http://localhost:1880/getAudio", 1050 | "rate": "16000", 1051 | "bitwidth": "16", 1052 | "endian": "little", 1053 | "encoding": "signed-integer", 1054 | "channels": "1", 1055 | "silence": "4", 1056 | "debug": "false", 1057 | "mode": "", 1058 | "x": 440, 1059 | "y": 180, 1060 | "wires": [ 1061 | [ 1062 | "cdee064.970b5f8" 1063 | ], 1064 | [], 1065 | [] 1066 | ] 1067 | }, 1068 | { 1069 | "id": "ad901d60.e73018", 1070 | "type": "debug", 1071 | "z": "b91bb085.c3bf28", 1072 | "name": "", 1073 | "active": true, 1074 | "console": "false", 1075 | "complete": "true", 1076 | "x": 990, 1077 | "y": 160, 1078 | "wires": [] 1079 | }, 1080 | { 1081 | "id": "cdee064.970b5f8", 1082 | "type": "Snowboy", 1083 | "z": "b91bb085.c3bf28", 1084 | "name": "Hey Watson hotword detector", 1085 | "detectorFile": "/home/pi/snowboy/rpi-arm-raspbian-8.0-1.1.1/resources/common.res", 1086 | "models": [ 1087 | { 1088 | "idxOutput": 0, 1089 | "nbOutputs": 1, 1090 | "hotwords": "", 1091 | "sensitivity": "", 1092 | "file": "/home/pi/snowboy/Hey Watson.pmdl" 1093 | } 1094 | ], 1095 | "multipleOutput": "false", 1096 | "debug": "true", 1097 | "x": 690, 1098 | "y": 160, 1099 | "wires": [ 1100 | [ 1101 | "ad901d60.e73018", 1102 | "2497149.f1c74ec", 1103 | "6b1ef022.fe2cc" 1104 | ] 1105 | ] 1106 | }, 1107 | { 1108 | "id": "d09d9e8f.0495f8", 1109 | "type": "link out", 1110 | "z": "b91bb085.c3bf28", 1111 | "name": "", 1112 | "links": [ 1113 | "39f38c46.954bd4" 1114 | ], 1115 | "x": 1195, 1116 | "y": 720, 1117 | "wires": [] 1118 | }, 1119 | { 1120 | "id": "32c6a7f4.f3c128", 1121 | "type": "change", 1122 | "z": "b91bb085.c3bf28", 1123 | "name": "Continue listening for Hey Watson", 1124 | "rules": [ 1125 | { 1126 | "t": "set", 1127 | "p": "payload", 1128 | "pt": "msg", 1129 | "to": "true", 1130 | "tot": "bool" 1131 | } 1132 | ], 1133 | "action": "", 1134 | "property": "", 1135 | "from": "", 1136 | "to": "", 1137 | "reg": false, 1138 | "x": 1000, 1139 | "y": 720, 1140 | "wires": [ 1141 | [ 1142 | "d09d9e8f.0495f8" 1143 | ] 1144 | ] 1145 | }, 1146 | { 1147 | "id": "39f38c46.954bd4", 1148 | "type": "link in", 1149 | "z": "b91bb085.c3bf28", 1150 | "name": "", 1151 | "links": [ 1152 | "d09d9e8f.0495f8" 1153 | ], 1154 | "x": 275, 1155 | "y": 220, 1156 | "wires": [ 1157 | [ 1158 | "f8a43192.067dc" 1159 | ] 1160 | ] 1161 | }, 1162 | { 1163 | "id": "2497149.f1c74ec", 1164 | "type": "change", 1165 | "z": "b91bb085.c3bf28", 1166 | "name": "Turn off Hotword detection", 1167 | "rules": [ 1168 | { 1169 | "t": "set", 1170 | "p": "payload", 1171 | "pt": "msg", 1172 | "to": "false", 1173 | "tot": "bool" 1174 | } 1175 | ], 1176 | "action": "", 1177 | "property": "", 1178 | "from": "", 1179 | "to": "", 1180 | "reg": false, 1181 | "x": 700, 1182 | "y": 80, 1183 | "wires": [ 1184 | [ 1185 | "f8a43192.067dc" 1186 | ] 1187 | ] 1188 | }, 1189 | { 1190 | "id": "aaabb005.4f41f8", 1191 | "type": "delay", 1192 | "z": "b91bb085.c3bf28", 1193 | "name": "", 1194 | "pauseType": "delay", 1195 | "timeout": "4", 1196 | "timeoutUnits": "seconds", 1197 | "rate": "1", 1198 | "nbRateUnits": "1", 1199 | "rateUnits": "second", 1200 | "randomFirst": "1", 1201 | "randomLast": "5", 1202 | "randomUnits": "seconds", 1203 | "drop": false, 1204 | "x": 360, 1205 | "y": 380, 1206 | "wires": [ 1207 | [ 1208 | "944f44ad.6880f" 1209 | ] 1210 | ] 1211 | }, 1212 | { 1213 | "id": "944f44ad.6880f", 1214 | "type": "change", 1215 | "z": "b91bb085.c3bf28", 1216 | "name": "Stop Listening", 1217 | "rules": [ 1218 | { 1219 | "t": "set", 1220 | "p": "payload", 1221 | "pt": "msg", 1222 | "to": "false", 1223 | "tot": "bool" 1224 | } 1225 | ], 1226 | "action": "", 1227 | "property": "", 1228 | "from": "", 1229 | "to": "", 1230 | "reg": false, 1231 | "x": 520, 1232 | "y": 380, 1233 | "wires": [ 1234 | [ 1235 | "e4c3ba1f.98e0f8" 1236 | ] 1237 | ] 1238 | }, 1239 | { 1240 | "id": "e0592d63.da4da8", 1241 | "type": "change", 1242 | "z": "b91bb085.c3bf28", 1243 | "name": "Bye / Exit", 1244 | "rules": [ 1245 | { 1246 | "t": "set", 1247 | "p": "payload", 1248 | "pt": "msg", 1249 | "to": "Thanks for Playing. Come Back tomorrow", 1250 | "tot": "str" 1251 | } 1252 | ], 1253 | "action": "", 1254 | "property": "", 1255 | "from": "", 1256 | "to": "", 1257 | "reg": false, 1258 | "x": 320, 1259 | "y": 520, 1260 | "wires": [ 1261 | [ 1262 | "73342bde.0e8bec" 1263 | ] 1264 | ] 1265 | }, 1266 | { 1267 | "id": "73342bde.0e8bec", 1268 | "type": "watson-text-to-speech", 1269 | "z": "b91bb085.c3bf28", 1270 | "name": "", 1271 | "lang": "en-US", 1272 | "langhidden": "en-US", 1273 | "langcustom": "NoCustomisationSetting", 1274 | "langcustomhidden": "", 1275 | "voice": "en-US_MichaelVoice", 1276 | "voicehidden": "en-US_MichaelVoice", 1277 | "format": "audio/wav", 1278 | "password": "", 1279 | "payload-response": true, 1280 | "default-endpoint": true, 1281 | "service-endpoint": "", 1282 | "x": 740, 1283 | "y": 520, 1284 | "wires": [ 1285 | [ 1286 | "3afb802b.66754", 1287 | "eea75af6.1db0a" 1288 | ] 1289 | ] 1290 | }, 1291 | { 1292 | "id": "6b1ef022.fe2cc", 1293 | "type": "exec", 1294 | "z": "b91bb085.c3bf28", 1295 | "command": "/usr/bin/aplay", 1296 | "addpay": false, 1297 | "append": " -D plughw:2,0 /home/pi/audio/howcanihelpyou.wav", 1298 | "useSpawn": "false", 1299 | "timer": "", 1300 | "oldrc": false, 1301 | "name": "How can I help You?", 1302 | "x": 180, 1303 | "y": 300, 1304 | "wires": [ 1305 | [ 1306 | "aaabb005.4f41f8", 1307 | "54632bc.22e7cd4" 1308 | ], 1309 | [], 1310 | [] 1311 | ] 1312 | }, 1313 | { 1314 | "id": "54632bc.22e7cd4", 1315 | "type": "change", 1316 | "z": "b91bb085.c3bf28", 1317 | "name": "Listen for 4 seconds", 1318 | "rules": [ 1319 | { 1320 | "t": "set", 1321 | "p": "payload", 1322 | "pt": "msg", 1323 | "to": "true", 1324 | "tot": "bool" 1325 | } 1326 | ], 1327 | "action": "", 1328 | "property": "", 1329 | "from": "", 1330 | "to": "", 1331 | "reg": false, 1332 | "x": 440, 1333 | "y": 280, 1334 | "wires": [ 1335 | [ 1336 | "e4c3ba1f.98e0f8" 1337 | ] 1338 | ] 1339 | }, 1340 | { 1341 | "id": "88703d38.03a398", 1342 | "type": "comment", 1343 | "z": "b91bb085.c3bf28", 1344 | "name": "What is the weather today?", 1345 | "info": "", 1346 | "x": 1100, 1347 | "y": 320, 1348 | "wires": [] 1349 | }, 1350 | { 1351 | "id": "df0600bc.96ad9", 1352 | "type": "comment", 1353 | "z": "b91bb085.c3bf28", 1354 | "name": "Bye ", 1355 | "info": "", 1356 | "x": 1030, 1357 | "y": 400, 1358 | "wires": [] 1359 | }, 1360 | { 1361 | "id": "e5da7cb0.480208", 1362 | "type": "change", 1363 | "z": "b91bb085.c3bf28", 1364 | "name": "Tell a joke", 1365 | "rules": [ 1366 | { 1367 | "t": "set", 1368 | "p": "payload", 1369 | "pt": "msg", 1370 | "to": "Why did the robot go back to robot school? ,,,, Because his skills were getting a little rusty!", 1371 | "tot": "str" 1372 | } 1373 | ], 1374 | "action": "", 1375 | "property": "", 1376 | "from": "", 1377 | "to": "", 1378 | "reg": false, 1379 | "x": 320, 1380 | "y": 600, 1381 | "wires": [ 1382 | [ 1383 | "2cde2988.9e41f6" 1384 | ] 1385 | ] 1386 | }, 1387 | { 1388 | "id": "64d2fd95.87795c", 1389 | "type": "comment", 1390 | "z": "b91bb085.c3bf28", 1391 | "name": "Can you tell a joke?", 1392 | "info": "", 1393 | "x": 1070, 1394 | "y": 360, 1395 | "wires": [] 1396 | }, 1397 | { 1398 | "id": "8dfbb182.2861f8", 1399 | "type": "inject", 1400 | "z": "b91bb085.c3bf28", 1401 | "name": "", 1402 | "topic": "", 1403 | "payload": "", 1404 | "payloadType": "date", 1405 | "repeat": "", 1406 | "crontab": "", 1407 | "once": false, 1408 | "x": 123.125, 1409 | "y": 390, 1410 | "wires": [ 1411 | [ 1412 | "6b1ef022.fe2cc" 1413 | ] 1414 | ] 1415 | }, 1416 | { 1417 | "id": "e4c3ba1f.98e0f8", 1418 | "type": "microPi", 1419 | "z": "b91bb085.c3bf28", 1420 | "name": "microPi", 1421 | "filename": "/home/pi/audio/demo.wav", 1422 | "domain": "http://localhost:1880/getAudio", 1423 | "rate": "16000", 1424 | "bitwidth": "16", 1425 | "endian": "little", 1426 | "encoding": "signed-integer", 1427 | "channels": "1", 1428 | "silence": "5", 1429 | "debug": "false", 1430 | "mode": "", 1431 | "x": 660, 1432 | "y": 280, 1433 | "wires": [ 1434 | [], 1435 | [ 1436 | "d2c4caf0.971328" 1437 | ], 1438 | [] 1439 | ] 1440 | }, 1441 | { 1442 | "id": "e3bfad7c.1e3748", 1443 | "type": "exec", 1444 | "z": "b91bb085.c3bf28", 1445 | "command": "/usr/bin/aplay", 1446 | "addpay": false, 1447 | "append": "-D plughw:2,0 /home/pi/audio/answer.wav", 1448 | "useSpawn": "false", 1449 | "timer": "", 1450 | "oldrc": false, 1451 | "name": "", 1452 | "x": 1120, 1453 | "y": 600, 1454 | "wires": [ 1455 | [ 1456 | "32c6a7f4.f3c128" 1457 | ], 1458 | [], 1459 | [] 1460 | ] 1461 | }, 1462 | { 1463 | "id": "3afb802b.66754", 1464 | "type": "file", 1465 | "z": "b91bb085.c3bf28", 1466 | "name": "write answer.wav", 1467 | "filename": "/home/pi/audio/answer.wav", 1468 | "appendNewline": false, 1469 | "createDir": true, 1470 | "overwriteFile": "true", 1471 | "x": 950, 1472 | "y": 560, 1473 | "wires": [] 1474 | }, 1475 | { 1476 | "id": "beeeb4de.95af98", 1477 | "type": "delay", 1478 | "z": "b91bb085.c3bf28", 1479 | "name": "", 1480 | "pauseType": "delay", 1481 | "timeout": "2", 1482 | "timeoutUnits": "seconds", 1483 | "rate": "1", 1484 | "nbRateUnits": "1", 1485 | "rateUnits": "second", 1486 | "randomFirst": "1", 1487 | "randomLast": "5", 1488 | "randomUnits": "seconds", 1489 | "drop": false, 1490 | "x": 920, 1491 | "y": 600, 1492 | "wires": [ 1493 | [ 1494 | "e3bfad7c.1e3748" 1495 | ] 1496 | ] 1497 | }, 1498 | { 1499 | "id": "eea75af6.1db0a", 1500 | "type": "delay", 1501 | "z": "b91bb085.c3bf28", 1502 | "name": "", 1503 | "pauseType": "delay", 1504 | "timeout": "2", 1505 | "timeoutUnits": "seconds", 1506 | "rate": "1", 1507 | "nbRateUnits": "1", 1508 | "rateUnits": "second", 1509 | "randomFirst": "1", 1510 | "randomLast": "5", 1511 | "randomUnits": "seconds", 1512 | "drop": false, 1513 | "x": 920, 1514 | "y": 520, 1515 | "wires": [ 1516 | [ 1517 | "4118f0e7.ddfda8" 1518 | ] 1519 | ] 1520 | }, 1521 | { 1522 | "id": "4118f0e7.ddfda8", 1523 | "type": "exec", 1524 | "z": "b91bb085.c3bf28", 1525 | "command": "/usr/bin/aplay", 1526 | "addpay": false, 1527 | "append": "-D plughw:2,0 /home/pi/audio/answer.wav", 1528 | "useSpawn": "false", 1529 | "timer": "", 1530 | "oldrc": false, 1531 | "name": "", 1532 | "x": 1120, 1533 | "y": 520, 1534 | "wires": [ 1535 | [], 1536 | [], 1537 | [] 1538 | ] 1539 | }, 1540 | { 1541 | "id": "7148b34a.3569cc", 1542 | "type": "comment", 1543 | "z": "b91bb085.c3bf28", 1544 | "name": "Hacked version of MicroPi - READ THIS", 1545 | "info": "MicroPi expects to record USB Audio via \n arecord -D plughw:1,0\nMatrix Voice outputs audio on mic_channel0\n arecord -D mic_channel0\n \nAs root, edit\n /usr/lib/node_modules/node-red-contrib-micropi/micropi/nodes/micropi/lib/mic.js\nchange\n _device = options.device || 'plughw:1,0';\nto\n _device = options.device || 'mic_channel0';\n", 1546 | "x": 350, 1547 | "y": 100, 1548 | "wires": [] 1549 | } 1550 | ] 1551 | --------------------------------------------------------------------------------