diff --git a/openstagecontrol/custom_module_hdp_sync.js b/live_utilities/openstagecontrol/custom_module_hdp_sync.js similarity index 95% rename from openstagecontrol/custom_module_hdp_sync.js rename to live_utilities/openstagecontrol/custom_module_hdp_sync.js index a07d865..47c2f18 100644 --- a/openstagecontrol/custom_module_hdp_sync.js +++ b/live_utilities/openstagecontrol/custom_module_hdp_sync.js @@ -48,6 +48,7 @@ function filterLatencies(arr) { // As described at https://web.archive.org/web/20160310125700/http://mine-control.com/zack/timesync/timesync.html // with bith from https://github.com/enmasseio/timesync/blob/master/src/stat.js + //console.log(arr) // compute median var sorted = arr.slice().sort((a,b)=> a > b ? 1 : a < b ? -1 : 0) var median @@ -66,6 +67,9 @@ function filterLatencies(arr) { var variance = arr.map(x => Math.pow(x - mean, 2)) .reduce((a,b)=>a + b) / (arr.length - 1) + // if all values are the same, return the first one + if (variance === 0) return arr[0] + // compute standard deviation var stdDeviation = Math.sqrt(variance) @@ -73,8 +77,7 @@ function filterLatencies(arr) { var filtered = arr.filter(x=>x < median + stdDeviation) // return arithmetic mean of remaining values - return filtered.reduce((a,b)=>a + b) / filtered.length; - + return filtered.reduce((a,b)=>a + b) / filtered.length } @@ -97,7 +100,7 @@ function receiveSync(address, ...args) { } // Measure clients latencies every 2 seconds -setInterval(pingClients, 50) +setInterval(pingClients, 250) diff --git a/live_utilities/openstagecontrol/hdp.config b/live_utilities/openstagecontrol/hdp.config new file mode 100644 index 0000000..907ef09 --- /dev/null +++ b/live_utilities/openstagecontrol/hdp.config @@ -0,0 +1 @@ +{"send":["127.0.0.1:57120"],"load":"mixer_transport.json","port":9080,"custom-module":"custom_module_hdp_sync.js"} \ No newline at end of file diff --git a/openstagecontrol/mixer.json b/live_utilities/openstagecontrol/mixer.json similarity index 100% rename from openstagecontrol/mixer.json rename to live_utilities/openstagecontrol/mixer.json diff --git a/openstagecontrol/mixer_transport.json b/live_utilities/openstagecontrol/mixer_transport.json similarity index 98% rename from openstagecontrol/mixer_transport.json rename to live_utilities/openstagecontrol/mixer_transport.json index 0884c25..3c5a52b 100644 --- a/openstagecontrol/mixer_transport.json +++ b/live_utilities/openstagecontrol/mixer_transport.json @@ -65,7 +65,7 @@ "borderRadius": "auto", "padding": "auto", "html": "", - "css": "", + "css": "JS{\n// assuming play button's on value is 1\nif (@{transport} === 1) return `\n:host > inner > .navigation {\n pointer-events: none;\n filter: grayscale(100%);\n}`\n}", "colorBg": "auto", "layout": "default", "justify": "start", @@ -179,7 +179,7 @@ "width": "100%", "height": "100%", "expand": "false", - "css": "", + "css": "JS{\n// assuming play button's on value is 1\nif (@{transport} === 1) return `\n:host > inner > .navigation {\n pointer-events: none;\n filter: grayscale(100%);\n}`\n}\n", "file": "transport.json", "fallback": "", "props": { diff --git a/openstagecontrol/mixer_transport_legacy.json b/live_utilities/openstagecontrol/mixer_transport_legacy.json similarity index 100% rename from openstagecontrol/mixer_transport_legacy.json rename to live_utilities/openstagecontrol/mixer_transport_legacy.json diff --git a/openstagecontrol/transport.json b/live_utilities/openstagecontrol/transport.json similarity index 93% rename from openstagecontrol/transport.json rename to live_utilities/openstagecontrol/transport.json index dcb7805..c1f01c5 100644 --- a/openstagecontrol/transport.json +++ b/live_utilities/openstagecontrol/transport.json @@ -334,9 +334,9 @@ "decimals": 0, "target": "", "ignoreDefaults": false, - "bypass": true, + "bypass": false, "onCreate": "", - "onValue": "console.log(\"tempo/\" + getProp(\"parent\", \"variables\").piece)\nif(value === 1){\n //setVar('main_panel', 'editable', false)\n send(false, \"/transport\", 1, getProp(\"parent\", \"variables\").piece, get(\"measure\"), get(\"beat\"), get(\"tempo/\" + getProp(\"parent\", \"variables\").piece));\n} else {\n //setVar('main_panel', 'editable', true)\n send(false, \"/transport\", 0, getProp(\"parent\", \"variables\").piece, get(\"measure\"), get(\"beat\"), get(\"tempo/\" + getProp(\"parent\", \"variables\").piece));\n}" + "onValue": "if(value === 1){\n //setVar('main_panel', 'editable', false)\n send(\"/transport\", 1, getProp(\"parent\", \"variables\").piece, get(\"measure\"), get(\"beat\"), get(\"tempo/\" + getProp(\"parent\", \"variables\").piece));\n} else {\n //setVar('main_panel', 'editable', true)\n send(\"/transport\", 0, getProp(\"parent\", \"variables\").piece, get(\"measure\"), get(\"beat\"), get(\"tempo/\" + getProp(\"parent\", \"variables\").piece));\n}" } ], "tabs": [] diff --git a/supercollider/live_utilities.scd b/live_utilities/supercollider/live_utilities.scd similarity index 100% rename from supercollider/live_utilities.scd rename to live_utilities/supercollider/live_utilities.scd diff --git a/supercollider/music_data/ammann.txt b/live_utilities/supercollider/music_data/ammann.txt similarity index 100% rename from supercollider/music_data/ammann.txt rename to live_utilities/supercollider/music_data/ammann.txt diff --git a/supercollider/music_data/berger.txt b/live_utilities/supercollider/music_data/berger.txt similarity index 100% rename from supercollider/music_data/berger.txt rename to live_utilities/supercollider/music_data/berger.txt diff --git a/supercollider/music_data/jaendel.txt b/live_utilities/supercollider/music_data/jaendel.txt similarity index 100% rename from supercollider/music_data/jaendel.txt rename to live_utilities/supercollider/music_data/jaendel.txt diff --git a/supercollider/music_data/kari.txt b/live_utilities/supercollider/music_data/kari.txt similarity index 100% rename from supercollider/music_data/kari.txt rename to live_utilities/supercollider/music_data/kari.txt diff --git a/supercollider/music_data/penrose.txt b/live_utilities/supercollider/music_data/penrose.txt similarity index 100% rename from supercollider/music_data/penrose.txt rename to live_utilities/supercollider/music_data/penrose.txt diff --git a/supercollider/music_data/robinson.txt b/live_utilities/supercollider/music_data/robinson.txt similarity index 100% rename from supercollider/music_data/robinson.txt rename to live_utilities/supercollider/music_data/robinson.txt diff --git a/openstagecontrol/custom_module_hdp.js b/openstagecontrol/custom_module_hdp.js deleted file mode 100644 index 8dd8073..0000000 --- a/openstagecontrol/custom_module_hdp.js +++ /dev/null @@ -1,53 +0,0 @@ -module.exports = { - - init: function(){ - // this will be executed once when the osc server starts - }, - - oscInFilter:function(data) { - - //console.log(data) - - var {host, port, address, args} = data - - if (address === '/playing') { - receive("/measure", args[0].value) - receive("/beat", args[1].value) - receive("/visual_click", 1) - } - - return - - }, - - oscOutFilter:function(data) { - - var {host, port, address, args} = data - - console.log(data) - - if (address.substring(1, 6) == 'mixer') { - tokens = address.split('/') - ins = tokens[2] - type = tokens[3] - index = tokens[4] - val = args[0].value - args = [{'type': 's', 'value': ins}, {'type': 's', 'value': type}, {'type': 's', 'value': index}, {'type': 'f', 'value': val}] - //console.log(data) - address = '/mixer' - return {host, port, address, args} - } - - if (address === '/transport') { - return {host, port, address, args} - } - - return - - }, - - unload: function(){ - // this will be executed when the custom module is reloaded - }, - -} diff --git a/openstagecontrol/hdp.config b/openstagecontrol/hdp.config deleted file mode 100644 index a77154f..0000000 --- a/openstagecontrol/hdp.config +++ /dev/null @@ -1 +0,0 @@ -{"send":["127.0.0.1:57120"],"custom-module":"/home/mwinter/Portfolio/a_history_of_the_domino_problem/a_history_of_the_domino_problem_source/openstagecontrol/custom_module_hdp_sync.js","load":"/home/mwinter/Portfolio/a_history_of_the_domino_problem/a_history_of_the_domino_problem_source/openstagecontrol/mixer_transport.json","port":9080} \ No newline at end of file diff --git a/openstagecontrol/mixer_transport-backup000.json b/openstagecontrol/mixer_transport-backup000.json deleted file mode 100644 index 67f7687..0000000 --- a/openstagecontrol/mixer_transport-backup000.json +++ /dev/null @@ -1,612 +0,0 @@ -{ - "createdWith": "Open Stage Control", - "version": "1.24.0", - "type": "session", - "content": { - "type": "root", - "lock": false, - "id": "root", - "visible": true, - "interaction": true, - "comments": "", - "width": "auto", - "height": "auto", - "colorText": "auto", - "colorWidget": "auto", - "alphaFillOn": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "tabsPosition": "top", - "hideMenu": false, - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "matrix", - "top": 240, - "left": 40, - "lock": false, - "id": "mixer/berger/pan", - "visible": true, - "interaction": true, - "comments": "", - "width": 570, - "height": 50, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "horizontal", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "tabsPosition": "top", - "variables": "@{parent.variables}", - "traversing": false, - "widgetType": "knob", - "quantity": 6, - "props": {}, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [], - "tabs": [] - }, - { - "type": "matrix", - "top": 20, - "left": 40, - "lock": false, - "id": "mixer/berger/volume", - "visible": true, - "interaction": true, - "comments": "", - "width": 570, - "height": 220, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "horizontal", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "tabsPosition": "top", - "variables": "@{parent.variables}", - "traversing": false, - "widgetType": "fader", - "quantity": 6, - "props": {}, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [], - "tabs": [] - }, - { - "type": "matrix", - "top": 290, - "left": 40, - "lock": false, - "id": "mixer/berger/mute", - "visible": true, - "interaction": true, - "comments": "", - "width": 570, - "height": 40, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "horizontal", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "tabsPosition": "top", - "variables": "@{parent.variables}", - "traversing": false, - "widgetType": "button", - "quantity": 6, - "props": {}, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [], - "tabs": [] - }, - { - "type": "panel", - "top": 20, - "left": 610, - "lock": false, - "id": "mixer/string/master_panel", - "visible": true, - "interaction": true, - "comments": "", - "width": 60, - "height": 310, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "tabsPosition": "top", - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "fader", - "top": 0, - "left": 0, - "lock": false, - "id": "mixer/berger/volume/master", - "visible": true, - "interaction": true, - "comments": "", - "width": "auto", - "height": 300, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "design": "default", - "knobSize": "auto", - "horizontal": false, - "pips": false, - "dashed": false, - "gradient": [], - "snap": false, - "spring": false, - "doubleTap": false, - "range": { - "min": 0, - "max": 1 - }, - "logScale": false, - "sensitivity": 1, - "steps": "", - "origin": "auto", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "onTouch": "" - } - ], - "tabs": [] - }, - { - "type": "button", - "top": 520, - "left": 40, - "lock": false, - "id": "transport", - "visible": true, - "interaction": true, - "comments": "", - "width": 80, - "height": 30, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorTextOn": "auto", - "label": "#{@{this} == 0 ? \"play\" : \"stop\"}", - "vertical": false, - "wrap": false, - "on": 1, - "off": 0, - "mode": "toggle", - "doubleTap": false, - "decoupled": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 0, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "if(value === 1){\n send(false, \"/transport\", 1, get(\"measure\"), get(\"beat\"));\n} else {\n send(false, \"/transport\", 0, get(\"measure\"), get(\"beat\"));\n}" - }, - { - "type": "panel", - "top": 330, - "left": 40, - "lock": false, - "id": "metronome", - "visible": true, - "interaction": true, - "comments": "", - "width": 630, - "height": 190, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "tabsPosition": "top", - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "input", - "top": 0, - "left": 0, - "lock": false, - "id": "measure", - "visible": true, - "interaction": true, - "comments": "", - "width": 250, - "height": 180, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": 0, - "html": "", - "css": ":host {\n font-size: 120rem;\n}", - "align": "center", - "unit": "", - "asYouType": false, - "numeric": false, - "validation": "", - "maxLength": "", - "value": 1, - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 0, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - }, - { - "type": "text", - "top": 10, - "left": 250, - "lock": false, - "id": "text_3", - "visible": true, - "comments": "", - "width": 50, - "height": 130, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": ":host {\n font-size: 120rem;\n}", - "vertical": false, - "wrap": false, - "align": "center", - "value": ":", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "" - }, - { - "type": "input", - "top": 0, - "left": 300, - "lock": false, - "id": "beat", - "visible": true, - "interaction": true, - "comments": "", - "width": 120, - "height": 180, - "expand": false, - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": ":host {\n font-size: 120rem;\n}", - "align": "center", - "unit": "", - "asYouType": false, - "numeric": true, - "validation": "", - "maxLength": "", - "value": 1, - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 0, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - }, - { - "type": "led", - "top": 10, - "left": 430, - "lock": false, - "id": "visual_click", - "visible": true, - "comments": "", - "width": 180, - "height": 160, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "mode": "intensity", - "range": { - "min": 0, - "max": 1 - }, - "alphaRange": { - "min": 0, - "max": 1 - }, - "logScale": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "target": "", - "onCreate": "", - "onValue": "var fallTime = 0.3,\nfps = 24,\nmaxValue = 1,\nstep = maxValue / fps / fallTime\n\nsetTimeout(()=>{\n if (value <= 0) clearTimeout()\n set(\"this\", value - step)\n}, 1000 / fps)" - } - ], - "tabs": [] - }, - { - "type": "switch", - "top": 50, - "left": 750, - "lock": false, - "id": "switch_1", - "visible": true, - "interaction": true, - "comments": "", - "width": "auto", - "height": "auto", - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorTextOn": "auto", - "layout": "vertical", - "gridTemplate": "", - "wrap": false, - "values": "{\n \"\n \"Value 2\": 2\n}", - "mode": "tap", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - } - ], - "tabs": [] - } -} \ No newline at end of file