Skip to content

Instantly share code, notes, and snippets.

@jimwhitfield
Last active May 8, 2017 18:22
Show Gist options
  • Save jimwhitfield/bd9b10353670afb238a9f55f4f593973 to your computer and use it in GitHub Desktop.
Save jimwhitfield/bd9b10353670afb238a9f55f4f593973 to your computer and use it in GitHub Desktop.
A Node Red flow for PC which reads from COM3 and plays the audio file (as coded) in the browser
[
{
"id": "90b76976.49ff38",
"type": "tab",
"label": "Flow 1"
},
{
"id": "52bcfbfe.e89d74",
"type": "switch",
"z": "90b76976.49ff38",
"name": "test for slow/fast",
"property": "n",
"propertyType": "msg",
"rules": [
{
"t": "btwn",
"v": "-1.1",
"vt": "num",
"v2": "1.1",
"v2t": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"outputs": 2,
"x": 263,
"y": 208,
"wires": [
[],
[
"a8f2c7e7.eb00e8",
"272f1ce8.3c55d4"
]
]
},
{
"id": "34d52df0.10c8e2",
"type": "function",
"z": "90b76976.49ff38",
"name": "parseFloat into msg.n",
"func": "\nvar rtn = {n:0.0};\nrtn.n = parseFloat(msg.payload);\n\nreturn rtn;\n",
"outputs": 1,
"noerr": 0,
"x": 256,
"y": 128,
"wires": [
[
"52bcfbfe.e89d74"
]
]
},
{
"id": "ce956e12.d5c97",
"type": "serial in",
"z": "90b76976.49ff38",
"name": "COM3",
"serial": "66517bad.78aab4",
"x": 189,
"y": 41,
"wires": [
[
"34d52df0.10c8e2"
]
]
},
{
"id": "272f1ce8.3c55d4",
"type": "debug",
"z": "90b76976.49ff38",
"name": "",
"active": false,
"console": "false",
"complete": "n",
"x": 499,
"y": 188,
"wires": []
},
{
"id": "a8f2c7e7.eb00e8",
"type": "change",
"z": "90b76976.49ff38",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "\\users\\jim\\OneDrive\\documents\\sound_recordings\\SlowDown1s.wav",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 296,
"y": 303,
"wires": [
[
"8e46c031.20885"
]
]
},
{
"id": "8e46c031.20885",
"type": "file in",
"z": "90b76976.49ff38",
"name": "",
"filename": "\\users\\jim\\OneDrive\\Documents\\sound_recordings\\SLowDown1s.wav",
"format": "",
"x": 476,
"y": 374,
"wires": [
[
"74cf2d23.3c2d84"
]
]
},
{
"id": "74cf2d23.3c2d84",
"type": "play audio",
"z": "90b76976.49ff38",
"name": "",
"voice": "",
"x": 341,
"y": 454,
"wires": []
},
{
"id": "66517bad.78aab4",
"type": "serial-port",
"z": "",
"serialport": "COM3",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"newline": "\\n",
"bin": "false",
"out": "char",
"addchar": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment