[{"id":"610558d0.e6fcb","type":"tab","label":"openMHA control","disabled":false,"info":""},{"id":"1557271e.985f11","type":"ui_base","theme":{"name":"theme-custom","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#004899","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","reset":false},"themeState":{"base-color":{"default":"#4B7930","value":"#004899","edited":true},"page-titlebar-backgroundColor":{"value":"#004799","edited":true},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#a0a9d7","edited":true},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#004799","edited":true},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":42,"sy":42,"gx":10,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"5a95dddd.c4488c","type":"ui_tab","name":"System control","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"401bc39f.af9f54","type":"ui_group","name":"System control","tab":"5a95dddd.c4488c","order":1,"disp":false,"width":"6","collapse":false},{"id":"4d46fff.cce77","type":"ui_group","name":"Settings","tab":"","disp":false,"width":"6","collapse":false},{"id":"847db7e3.f3463","type":"ui_group","name":"Transparent Earpiece","tab":"","disp":false,"width":"6","collapse":false},{"id":"78dc1a38.50c914","type":"ui_group","name":"Compressor","tab":"","disp":false,"width":"6","collapse":false},{"id":"16634ae1.229f0d","type":"ui_spacer","name":"spacer","group":"401bc39f.af9f54","order":14,"width":"6","height":1},{"id":"fab322ee.5715b8","type":"ui_spacer","name":"spacer","group":"4d46fff.cce77","order":5,"width":"6","height":1},{"id":"b125452c.c211d","type":"ui_spacer","name":"spacer","group":"4d46fff.cce77","order":2,"width":"2","height":1},{"id":"a0e6a585.49258","type":"ui_spacer","name":"spacer","group":"4d46fff.cce77","order":7,"width":"2","height":1},{"id":"56afea8.9740594","type":"ui_spacer","name":"spacer","group":"78dc1a38.50c914","order":3,"width":1,"height":1},{"id":"327c549a.1b1474","type":"ui_group","name":"Switches","tab":"7f692d6.05e65d4","order":1,"disp":false,"width":"6","collapse":false},{"id":"7f692d6.05e65d4","type":"ui_tab","name":"Hearing Aid Processing","icon":"dashboard","disabled":false,"hidden":false},{"id":"6d4216b5.b50918","type":"ui_spacer","name":"spacer","group":"401bc39f.af9f54","order":4,"width":1,"height":1},{"id":"3a080ac2.dfe8e6","type":"ui_spacer","name":"spacer","group":"401bc39f.af9f54","order":6,"width":1,"height":1},{"id":"28ec7c5c.29a29c","type":"ui_spacer","name":"spacer","group":"401bc39f.af9f54","order":8,"width":"2","height":1},{"id":"dc484a5c.dde75","type":"ui_spacer","name":"spacer","group":"401bc39f.af9f54","order":15,"width":"6","height":1},{"id":"b729bc91.23981","type":"ui_group","name":"Analysis","tab":"5a95dddd.c4488c","order":2,"disp":true,"width":"6","collapse":false},{"id":"84df8280.73929","type":"function","z":"610558d0.e6fcb","name":"set gain HP","func":"msg.payload=\"mha.transducers.mhachain.headphone_volume.gains=[ 0 0 \" + msg.payload.toString() + \" \" + msg.payload.toString() + \"]\\n\"\nreturn msg;","outputs":1,"noerr":0,"x":950,"y":380,"wires":[["d41a0ba.921fcf8"]]},{"id":"28412c2a.5b058c","type":"exec","z":"610558d0.e6fcb","command":"sudo shutdown -h now","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Shutdown","x":730,"y":620,"wires":[[],[],[]]},{"id":"65111bd6.89c5dc","type":"function","z":"610558d0.e6fcb","name":"set gain line","func":"msg.payload=\"mha.transducers.mhachain.split.phone.gain.gains=\" + msg.payload.toString() + \"\\n\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":320,"wires":[["d41a0ba.921fcf8"]]},{"id":"6137988c.6a6cd","type":"function","z":"610558d0.e6fcb","name":"mute line","func":"var mixmatrix\nif (msg.payload === false){\nmixmatrix = \"[[0 0];[0 0]]\"\n}\nelse{\nmixmatrix = \"[[1 0];[0 1]]\"\n}\nmsg.payload=\"mha.transducers.mhachain.split.phone.mix.m=\" + mixmatrix + \"\\n\"\nreturn msg;","outputs":1,"noerr":0,"x":940,"y":520,"wires":[["d41a0ba.921fcf8"]]},{"id":"fb8211e.c27af7","type":"function","z":"610558d0.e6fcb","name":"mute BTE","func":"var mixmatrix\nif (msg.payload === true){\nmixmatrix = \"[[0 0 0 0];[0 0 0 0];[0 0 0 0];[0 0 0 0]]\"\n}\nelse{\nmixmatrix = \"[[1 0 0 0];[0 1 0 0];[0 0 1 0];[0 0 0 1]]\"\n}\nmsg.payload=\"mha.transducers.mhachain.split.bte.mix.m=\" + mixmatrix + \"\\n\"\nreturn msg;","outputs":1,"noerr":0,"x":940,"y":440,"wires":[["d41a0ba.921fcf8"]]},{"id":"8190010e.acea1","type":"function","z":"610558d0.e6fcb","name":"stop mha","func":"msg.payload=\"cmd=quit\\n\";\nreturn msg;","outputs":1,"noerr":0,"x":300,"y":520,"wires":[[]]},{"id":"ef95e67a.398b68","type":"function","z":"610558d0.e6fcb","name":"start mha","func":"msg.payload=\"?read:/etc/mahalia/openMHAcontrol.cfg\\n\";\nreturn msg;","outputs":1,"noerr":0,"x":300,"y":440,"wires":[[]]},{"id":"ec3aee2d.4a9dd8","type":"change","z":"610558d0.e6fcb","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":100,"wires":[["d8ec859d.3505f8","f59c6523.e5321"]]},{"id":"97d7a357.340188","type":"ui_button","z":"610558d0.e6fcb","name":"Shutdown","group":"401bc39f.af9f54","order":16,"width":"6","height":"1","passthru":false,"label":"Shutdown system","tooltip":"","color":"","bgcolor":"","icon":"cancel","payload":"1","payloadType":"str","topic":"","x":550,"y":620,"wires":[["28412c2a.5b058c"]]},{"id":"5f490bc2.451fc4","type":"ui_button","z":"610558d0.e6fcb","name":"","group":"401bc39f.af9f54","order":5,"width":"4","height":"1","passthru":true,"label":"Reset","tooltip":"","color":"","bgcolor":"#32CD32","icon":"","payload":"false","payloadType":"bool","topic":"","x":150,"y":300,"wires":[["ec3aee2d.4a9dd8","c8ad197.ec70de8","aed6c09a.c8d048","66c562a3.10585c","25994f92.04066","b5793b8b.004038","48be6631.7d8828"]]},{"id":"b5793b8b.004038","type":"ui_switch","z":"610558d0.e6fcb","name":"","label":"","tooltip":"","group":"401bc39f.af9f54","order":11,"width":"1","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":730,"y":520,"wires":[["6137988c.6a6cd"]]},{"id":"25994f92.04066","type":"ui_switch","z":"610558d0.e6fcb","name":"","label":"Mute BTE microphones","tooltip":"","group":"401bc39f.af9f54","order":3,"width":"6","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"volume_up","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"volume_off","offcolor":"","x":670,"y":440,"wires":[["fb8211e.c27af7"]]},{"id":"d5cf0f74.2a8e28","type":"ui_slider","z":"610558d0.e6fcb","name":"","label":"Headphone","tooltip":"","group":"401bc39f.af9f54","order":9,"width":"4","height":"1","passthru":false,"outs":"end","topic":"","topicType":"str","min":"-20","max":"20","step":1,"x":750,"y":360,"wires":[["84df8280.73929","50f5646b.f88acc"]]},{"id":"6af6ec8a.e8a264","type":"ui_slider","z":"610558d0.e6fcb","name":"","label":"Line","tooltip":"","group":"401bc39f.af9f54","order":12,"width":"3","height":"1","passthru":false,"outs":"end","topic":"","topicType":"str","min":"-20","max":"20","step":1,"x":730,"y":300,"wires":[["65111bd6.89c5dc","7c6cbc15.d8f15c"]]},{"id":"50f5646b.f88acc","type":"ui_text_input","z":"610558d0.e6fcb","name":"","label":"","tooltip":"","group":"401bc39f.af9f54","order":10,"width":"2","height":"1","passthru":false,"mode":"text","delay":"0","topic":"","topicType":"str","x":540,"y":380,"wires":[["d5cf0f74.2a8e28","84df8280.73929"]]},{"id":"7c6cbc15.d8f15c","type":"ui_text_input","z":"610558d0.e6fcb","name":"","label":"","tooltip":"","group":"401bc39f.af9f54","order":13,"width":"2","height":"1","passthru":false,"mode":"text","delay":"0","topic":"","topicType":"str","x":540,"y":320,"wires":[["6af6ec8a.e8a264","65111bd6.89c5dc"]]},{"id":"467cf362.257c34","type":"function","z":"610558d0.e6fcb","name":"Coherence Switch","func":"if (msg.payload === true){\nmsg.payload=\"mha.transducers.mhachain.signal_processing.ola.c.coh.select=coherence\\n\"\n}\nelse{\nmsg.payload=\"mha.transducers.mhachain.signal_processing.ola.c.coh.select=identity\\n\"\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":970,"y":100,"wires":[["d41a0ba.921fcf8"]]},{"id":"d8ec859d.3505f8","type":"ui_switch","z":"610558d0.e6fcb","name":"","label":"Coherence filter","tooltip":"","group":"327c549a.1b1474","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":720,"y":100,"wires":[["467cf362.257c34"]]},{"id":"deffc78f.0a1f6","type":"function","z":"610558d0.e6fcb","name":"Fshift Switch","func":"if (msg.payload === true){\nmsg.payload=\"mha.transducers.mhachain.signal_processing.ola.c.fshift.select=fshift\\n\"\n}\nelse{\nmsg.payload=\"mha.transducers.mhachain.signal_processing.ola.c.fshift.select=identity\\n\"\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":950,"y":140,"wires":[["d41a0ba.921fcf8"]]},{"id":"f59c6523.e5321","type":"ui_switch","z":"610558d0.e6fcb","name":"","label":"Frequency shifter","tooltip":"","group":"327c549a.1b1474","order":4,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":690,"y":140,"wires":[["deffc78f.0a1f6"]]},{"id":"e1113890.762a98","type":"ui_switch","z":"610558d0.e6fcb","name":"","label":"Adaptive Differential Mic","tooltip":"","group":"327c549a.1b1474","order":5,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"ADM","style":"","onvalue":"0","onvalueType":"num","onicon":"","oncolor":"","offvalue":"1","offvalueType":"num","officon":"","offcolor":"","x":610,"y":180,"wires":[["18dfe4b8.ae6c33"]]},{"id":"18dfe4b8.ae6c33","type":"function","z":"610558d0.e6fcb","name":"bypass logic","func":"switch (msg.topic){\ncase \"ADM\":\n    flow.set('adm', msg.payload);\n    break;\ncase \"mic\":\n    flow.set('mic', msg.payload);\n    break;\n}\n// get the latest values - default to 0 and 1 if not yet set\nvar adm = flow.get('adm') || 0;\nvar mic = flow.get('mic') || 1;\nvar bypass=adm*mic;\nmsg.payload=\"mha.transducers.mhachain.split.bte.adm.bypass=\" + bypass.toString() + \"\\n\";\nif(bypass !== 0){\nmsg.payload+=\"mha.transducers.mhachain.signal_processing.ola.c.decomb.select=identity\\n\";     \n}\nelse{\nmsg.payload+=\"mha.transducers.mhachain.signal_processing.ola.c.decomb.select=equalize\\n\";     \n}\nreturn msg\n\n","outputs":1,"noerr":0,"x":950,"y":200,"wires":[["d41a0ba.921fcf8"]]},{"id":"7ea60f4d.143628","type":"ui_switch","z":"610558d0.e6fcb","name":"","label":"Microphone pair: front / rear","tooltip":"","group":"401bc39f.af9f54","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"mic","style":"","onvalue":"2","onvalueType":"num","onicon":"","oncolor":"","offvalue":"1","offvalueType":"num","officon":"","offcolor":"","x":660,"y":220,"wires":[["18dfe4b8.ae6c33"]]},{"id":"d41a0ba.921fcf8","type":"tcp request","z":"610558d0.e6fcb","server":"localhost","port":"33337","out":"sit","splitc":" ","name":"","x":1270,"y":80,"wires":[[]]},{"id":"b35cacf5.0f716","type":"function","z":"610558d0.e6fcb","name":"Compressor Switch","func":"if (msg.payload === true){\nmsg.payload=\"mha.transducers.mhachain.signal_processing.ola.c.mbc.select=multibandcompressor\\n\"\n}\nelse{\nmsg.payload=\"mha.transducers.mhachain.signal_processing.ola.c.mbc.select=identity\\n\"\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":970,"y":60,"wires":[["d41a0ba.921fcf8"]]},{"id":"48be6631.7d8828","type":"ui_switch","z":"610558d0.e6fcb","name":"","label":"Compressor","tooltip":"","group":"327c549a.1b1474","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":710,"y":60,"wires":[["b35cacf5.0f716"]]},{"id":"c8ad197.ec70de8","type":"change","z":"610558d0.e6fcb","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":220,"wires":[["7ea60f4d.143628","e1113890.762a98","b5cafbb2.8b5398"]]},{"id":"aed6c09a.c8d048","type":"change","z":"610558d0.e6fcb","name":"0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":140,"wires":[["7c6cbc15.d8f15c","50f5646b.f88acc","6af6ec8a.e8a264","d5cf0f74.2a8e28","65111bd6.89c5dc","84df8280.73929"]]},{"id":"77bd3ea4.32848","type":"debug","z":"610558d0.e6fcb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":950,"y":620,"wires":[]},{"id":"3007d176.a31836","type":"ui_dropdown","z":"610558d0.e6fcb","name":"","label":"Compression ratio","tooltip":"","place":"Select option","group":"327c549a.1b1474","order":2,"width":"6","height":"1","passthru":true,"options":[{"label":"1","value":1,"type":"num"},{"label":"2","value":2,"type":"num"},{"label":"3","value":3,"type":"num"}],"payload":"","topic":"","x":690,"y":20,"wires":[["108baf1a.268af9"]]},{"id":"b5cafbb2.8b5398","type":"ui_dropdown","z":"610558d0.e6fcb","name":"","label":"Headset","tooltip":"","place":"Select option","group":"401bc39f.af9f54","order":1,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"RIC Speakers S","value":1,"type":"num"},{"label":"RIC Speakers M","value":2,"type":"num"}],"payload":"","topic":"","topicType":"str","x":680,"y":260,"wires":[["8172ea77.1a30a"]]},{"id":"108baf1a.268af9","type":"function","z":"610558d0.e6fcb","name":"Compression Selection","func":"if (msg.payload === 1){\nmsg.payload=\"mha.transducers.mhachain.signal_processing.ola.c.mbc?read:/etc/mahalia/generic-hearing-aid/compression_rate_1.cfg \\n\"\n}\nelse if(msg.payload ===2){\nmsg.payload=\"mha.transducers.mhachain.signal_processing.ola.c.mbc?read:/etc/mahalia/generic-hearing-aid/compression_rate_2.cfg \\n\"\n}\nelse if(msg.payload ===3){\nmsg.payload=\"mha.transducers.mhachain.signal_processing.ola.c.mbc?read:/etc/mahalia/generic-hearing-aid/compression_rate_3.cfg \\n\"\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":990,"y":20,"wires":[["d41a0ba.921fcf8"]]},{"id":"8172ea77.1a30a","type":"function","z":"610558d0.e6fcb","name":"Microphone Selection","func":"if (msg.payload === 1){\nmsg.payload=\"?read:/etc/mahalia/calibration/speaker-s/calib.cfg\\n\"\n}\nelse if(msg.payload ===2){\nmsg.payload=\"?read:/etc/mahalia/calibration/speaker-m/calib.cfg\\n\"\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":980,"y":260,"wires":[["d41a0ba.921fcf8"]]},{"id":"bedec01b.49ea8","type":"inject","z":"610558d0.e6fcb","name":"","repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":90,"y":180,"wires":[["5f490bc2.451fc4","339c0493.be3684"]]},{"id":"66c562a3.10585c","type":"change","z":"610558d0.e6fcb","name":"2","rules":[{"t":"set","p":"payload","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":40,"wires":[["3007d176.a31836"]]},{"id":"39db5f5a.a69bb8","type":"ui_text","z":"610558d0.e6fcb","group":"401bc39f.af9f54","order":7,"width":"4","height":"1","name":"","label":"Volume Control","format":"","layout":"row-spread","x":170,"y":400,"wires":[]},{"id":"9ede758a.686cc8","type":"tcp request","z":"610558d0.e6fcb","server":"localhost","port":"33337","out":"time","splitc":"5","name":"Level","x":370,"y":720,"wires":[["3ce559e6.0f3aa6","57399e33.b9eb5"]]},{"id":"a2494b78.047778","type":"function","z":"610558d0.e6fcb","name":"get level","func":"msg.payload=\"mha.transducers.calib_out.rmslevel?val\\n\";\nreturn msg;","outputs":1,"noerr":0,"x":220,"y":720,"wires":[["9ede758a.686cc8"]]},{"id":"3ce559e6.0f3aa6","type":"function","z":"610558d0.e6fcb","name":"toString level L","func":"msg.payload=msg.payload.toString('utf8');\nmsg.payload=msg.payload.replace(\"[\", \"\");\nmsg.payload=msg.payload.replace(\"]\", \"\");\nmsg.payload=msg.payload.split(\" \");\nmsg.payload=parseFloat(msg.payload[0]);\nreturn msg;","outputs":1,"noerr":0,"x":560,"y":720,"wires":[["169d2aae.49179d"]]},{"id":"57399e33.b9eb5","type":"function","z":"610558d0.e6fcb","name":"toString level R","func":"msg.payload=msg.payload.toString('utf8');\nmsg.payload=msg.payload.replace(\"[\", \"\");\nmsg.payload=msg.payload.replace(\"]\", \"\");\nmsg.payload=msg.payload.split(\" \");\nmsg.payload=parseFloat(msg.payload[1]);\nreturn msg;","outputs":1,"noerr":0,"x":560,"y":780,"wires":[["d5496e36.1388b8"]]},{"id":"169d2aae.49179d","type":"ui_gauge","z":"610558d0.e6fcb","name":"","group":"327c549a.1b1474","order":7,"width":"3","height":"2","gtype":"gage","title":"Out level L","label":"","format":"","min":"30","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":790,"y":720,"wires":[]},{"id":"d5496e36.1388b8","type":"ui_gauge","z":"610558d0.e6fcb","name":"","group":"327c549a.1b1474","order":8,"width":"3","height":"2","gtype":"gage","title":"Out level R","label":"","format":"","min":"30","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":790,"y":780,"wires":[]},{"id":"339c0493.be3684","type":"trigger","z":"610558d0.e6fcb","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-200","extend":false,"units":"ms","reset":"stop","bytopic":"all","outputs":1,"x":210,"y":600,"wires":[["a2494b78.047778"]]},{"id":"ca13f198.1b0738","type":"inject","z":"610558d0.e6fcb","name":"Repeat cmd=start","repeat":"6","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"\"cmd=start\\n\"","payloadType":"json","x":1270,"y":20,"wires":[["d41a0ba.921fcf8"]]}]