From 21611e92b8a5ef3da1e633b9a894b095596861a4 Mon Sep 17 00:00:00 2001 From: mwinter Date: Sat, 22 Apr 2023 12:53:19 +0200 Subject: [PATCH] save button working --- open_stage_control/modules/custom_module.js | 3 - .../seeds_and_ledgers_gui_bak.json | 2443 ----------------- supercollider/seeds_and_ledgers_main_dict.scd | 727 ----- 3 files changed, 3173 deletions(-) delete mode 100644 open_stage_control/seeds_and_ledgers_gui_bak.json delete mode 100644 supercollider/seeds_and_ledgers_main_dict.scd diff --git a/open_stage_control/modules/custom_module.js b/open_stage_control/modules/custom_module.js index 3e83d0a..3aefeab 100644 --- a/open_stage_control/modules/custom_module.js +++ b/open_stage_control/modules/custom_module.js @@ -255,12 +255,9 @@ module.exports = { } if (address === '/save_ledger') { - console.log("[sdfdf,]".replace(/([a-zA-Z0-9-]+)/g, "\"$1\"")) ledger = {} ledger.ledger = JSON.parse(args[0].value.replace(/([a-zA-Z0-9-]+)/g, "\"$1\"")) args[0].value = JSON.stringify(ledger) - //model.music_data = JSON.parse(args[0].value) - //args[0].value = JSON.stringify(model) return {host, port, address, args} } diff --git a/open_stage_control/seeds_and_ledgers_gui_bak.json b/open_stage_control/seeds_and_ledgers_gui_bak.json deleted file mode 100644 index bb7088a..0000000 --- a/open_stage_control/seeds_and_ledgers_gui_bak.json +++ /dev/null @@ -1,2443 +0,0 @@ -{ - "createdWith": "Open Stage Control", - "version": "1.22.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, - "verticalTabs": false, - "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": "panel", - "top": 10, - "left": 770, - "lock": false, - "id": "motif_panel", - "visible": true, - "interaction": true, - "comments": "", - "width": 560, - "height": 640, - "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, - "verticalTabs": false, - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "textarea", - "top": 40, - "left": 10, - "lock": false, - "id": "mus_seq", - "visible": true, - "comments": "", - "width": 530, - "height": 580, - "expand": false, - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": 0, - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "textarea {\n white-space: pre;\n line-height: 20rem;\n font-size: 12rem;\n}", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "//set(\"this\", JSON.stringify(JSON.parse(value), null, 5))", - "interaction": true, - "typeTags": "s", - "ignoreDefaults": false, - "bypass": false - }, - { - "type": "text", - "top": 10, - "left": 10, - "lock": false, - "id": "motif_label", - "visible": true, - "comments": "", - "width": 90, - "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": "", - "align": "center", - "value": "motif", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "vertical": false, - "wrap": false - } - ], - "tabs": [] - }, - { - "type": "panel", - "top": 10, - "left": 580, - "lock": false, - "id": "ledger_panel", - "visible": true, - "interaction": true, - "comments": "", - "width": 190, - "height": 640, - "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": false, - "innerPadding": true, - "verticalTabs": false, - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "text", - "top": 10, - "left": 10, - "lock": false, - "id": "ledger_label", - "visible": true, - "comments": "", - "width": 70, - "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": "", - "value": "ledger", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "vertical": false, - "wrap": false, - "align": "center" - }, - { - "type": "file", - "top": 10, - "left": 80, - "lock": false, - "id": "load_ledger", - "visible": true, - "interaction": true, - "comments": "", - "width": 80, - "height": 30.000000000000004, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "align": "center", - "hidePath": true, - "mode": "open", - "directory": "Sketches/seeds_and_ledgers/resources", - "extension": "*", - "allowDir": false - }, - { - "type": "panel", - "top": 50, - "left": 10, - "lock": false, - "id": "sequencer_panel", - "visible": true, - "interaction": true, - "comments": "", - "width": 180, - "height": 600, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": 0, - "borderRadius": 0, - "padding": 0, - "html": "", - "css": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": false, - "innerPadding": true, - "verticalTabs": false, - "variables": "@{parent.variables}", - "traversing": false, - "widgets": [ - { - "type": "panel", - "top": 81, - "left": 0, - "lock": false, - "id": "ledger_panel", - "visible": true, - "interaction": true, - "comments": "", - "width": 170, - "height": 480, - "expand": true, - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": 0, - "borderRadius": 0, - "padding": 0, - "html": "", - "css": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": "auto", - "innerPadding": true, - "verticalTabs": false, - "variables": "@{parent.variables}", - "traversing": false, - "widgets": [ - { - "type": "switch", - "top": 0, - "left": 130, - "lock": false, - "id": "cur_play_uid", - "visible": true, - "comments": "", - "width": 20, - "height": "VAR{\"height\", 100}", - "expand": "false", - "colorText": "rgba(216,222,233,1)", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": 2, - "html": "", - "css": ":host {\n font-size: 0\n}", - "wrap": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "interaction": true, - "colorTextOn": "auto", - "mode": "tap", - "typeTags": "", - "ignoreDefaults": false, - "bypass": false, - "layout": "vertical", - "gridTemplate": "", - "values": "@{ledger_switch_vals}" - }, - { - "type": "variable", - "lock": false, - "id": "ledger_switch_vals", - "comments": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - }, - { - "type": "variable", - "lock": false, - "id": "ledger_switch_indices", - "comments": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - }, - { - "type": "variable", - "lock": false, - "id": "ledger_size", - "comments": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "/*\nvar array = Array(value + 2).fill().map((element, index) => index)\nconsole.log(array)\nset('ledger_switch_vals', array)\n*/" - }, - { - "type": "textarea", - "top": 0, - "left": 40, - "lock": false, - "id": "ledger", - "visible": true, - "interaction": true, - "comments": "", - "width": 90, - "height": "VAR{\"height\", 100}", - "expand": true, - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "textarea {\n overflow-y: hidden;\n line-height: VAR{\"line-height\", 20}rem;\n font-size: VAR{\"font-size\", 12}rem;\n padding-left: 10rem\n}", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "setVar(\"this\", \"height\", 0)\nvar lines = get(\"this\").split(/\\r|\\r\\n|\\n/);\nsetVar(\"this\", \"height\", (lines.length * getVar(\"this\", \"line-height\") + 6));\nsetVar(\"cur_play_uid\", \"height\", getVar(\"this\", \"height\"))\nsetVar(\"start_play\", \"height\", getVar(\"this\", \"height\"))\nsetVar(\"ledger_panel\", \"height\", getVar(\"this\", \"height\"))\nsetVar(\"ref_uid\", \"height\", getVar(\"this\", \"height\"))\nvar switchVals = lines.map((element, index) => element.trim().replace(',',''))\nvar switchIndices = lines.map((element, index) => index)\nset(\"ledger_switch_vals\", switchVals)\nset(\"ledger_switch_indices\", switchIndices)" - }, - { - "type": "switch", - "top": 0, - "left": 0, - "lock": false, - "id": "ref_uid", - "visible": true, - "interaction": true, - "comments": "", - "width": 20, - "height": "VAR{\"height\", 100}", - "expand": "false", - "colorText": "rgba(216,222,233,1)", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": 2, - "html": "", - "css": ":host {\n font-size: 0\n}", - "colorTextOn": "auto", - "layout": "vertical", - "gridTemplate": "", - "wrap": false, - "values": "@{ledger_switch_vals}", - "mode": "tap", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "console.log(get(\"ledger_switch_vals\"))\nconsole.log(value)" - }, - { - "type": "switch", - "top": 0, - "left": 20, - "lock": false, - "id": "start_play", - "visible": true, - "interaction": true, - "comments": "", - "width": 20, - "height": "VAR{\"height\", 100}", - "expand": "false", - "colorText": "rgba(216,222,233,1)", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": 2, - "html": "", - "css": ":host {\n font-size: 0\n}", - "colorTextOn": "auto", - "layout": "vertical", - "gridTemplate": "", - "wrap": false, - "values": "@{ledger_switch_indices}", - "mode": "tap", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - } - ], - "tabs": [] - }, - { - "type": "button", - "top": 60, - "left": 0, - "lock": false, - "id": "ref_uid_lock", - "visible": true, - "comments": "", - "width": 20, - "height": 20.727272727272727, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "vertical": false, - "wrap": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "interaction": true, - "colorTextOn": "auto", - "label": "L", - "on": 1, - "off": 0, - "mode": "toggle", - "doubleTap": false, - "decoupled": false, - "typeTags": "", - "ignoreDefaults": false, - "bypass": true - }, - { - "type": "input", - "top": 60, - "left": 40, - "lock": false, - "id": "current_uid", - "visible": true, - "comments": "", - "width": 90, - "height": 20, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "align": "center", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 0, - "target": "", - "onCreate": "", - "onValue": "", - "interaction": true, - "typeTags": "s", - "ignoreDefaults": false, - "bypass": true, - "unit": "", - "asYouType": true, - "numeric": true, - "validation": "", - "maxLength": "" - }, - { - "type": "button", - "top": 60, - "left": 130, - "lock": false, - "id": "current_uid_lock", - "visible": true, - "interaction": true, - "comments": "", - "width": 20, - "height": 20, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "", - "colorTextOn": "auto", - "label": "L", - "vertical": false, - "wrap": false, - "on": 1, - "off": 0, - "mode": "toggle", - "doubleTap": false, - "decoupled": false - }, - { - "type": "button", - "top": 30, - "left": 0, - "lock": false, - "id": "transport", - "visible": true, - "interaction": true, - "comments": "", - "width": 150, - "height": 20, - "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 console.log(get(\"start_play\"))\n send(false, \"/transport\", 1, get(\"start_play\") - 1);\n} else {\n send(false, \"/transport\", 0, get(\"start_play\") - 1);\n}" - }, - { - "type": "button", - "top": 0, - "left": 0, - "lock": false, - "id": "gen", - "visible": true, - "interaction": true, - "comments": "", - "width": 70, - "height": 20, - "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": "generate", - "vertical": false, - "wrap": false, - "on": 1, - "off": 0, - "mode": "push", - "doubleTap": false, - "decoupled": false, - "value": "", - "default": 0, - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "if(value === 1){\n var sVal = 1\n var order = null\n var passage = null\n var rUID = get(\"ref_uid\")\n var durSeed;\n var orderSeed;\n var weightSeed\n \n if(get(\"ref_uid\")){\n rUID = get(\"ref_uid\")\n } else {\n rUID = 1\n }\n \n if(get(\"dur_seed_lock\") == 1){\n durSeed = get(\"dur_seed\")\n } else {\n durSeed = 1\n }\n \n if(get(\"order_seed_lock\") == 1){\n orderSeed = get(\"order_seed\")\n } else {\n orderSeed = 1\n }\n \n if(get(\"weights_seed_lock\") == 1){\n weightSeed = get(\"weights_seed\")\n } else {\n weightSeed = 1\n }\n \n /*\n if(get(\"order_lock\") == 1){\n order = get(\"order\").replace(/\\s/g, \"\")\n send(false, \"/gen\", rUID, durSeed, orderSeed, weightSeed, order)\n } else {\n order = get(\"order_size\")\n passage = get(\"passage_size\")\n send(false, \"/gen\", rUID, durSeed, orderSeed, weightSeed,\n {\"type\": \"i\", \"value\": order[0]}, \n {\"type\": \"i\", \"value\": order[1]}, \n {\"type\": \"i\", \"value\": passage[0]}, \n {\"type\": \"i\", \"value\": passage[1]});\n }\n */\n \n send('custom:module', '/gen', stateGet('root'))\n\n}" - }, - { - "type": "button", - "top": 0, - "left": 80, - "lock": false, - "id": "commit", - "visible": true, - "interaction": true, - "comments": "", - "width": 70, - "height": 20, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "value": "", - "default": 0, - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "if(value === 1){\n //send(false, \"/commit\");\n //set(\"reference_seed\", get(\"current_seed\"))\n //var lVals = get(\"ledger_switch_vals\")\n //if(get(\"ref_uid_lock\") === 0){\n // set(\"ref_uid\", lVals[lVals.length - 2])\n //}\n // set(\"current_uid\", \"\")\n send('custom:module', 'commit', get(\"current_uid\"), stateGet('root'), stateGet('ledger_panel'))\n}\n ", - "colorTextOn": "auto", - "label": "auto", - "vertical": false, - "wrap": false, - "on": 1, - "off": 0, - "mode": "push", - "doubleTap": false, - "decoupled": false - } - ], - "tabs": [] - } - ], - "tabs": [] - }, - { - "type": "panel", - "top": 10, - "left": 30, - "lock": false, - "id": "seeds_panel", - "visible": true, - "interaction": true, - "comments": "", - "width": 550, - "height": 640, - "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, - "verticalTabs": false, - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "text", - "top": 10, - "left": 10, - "lock": false, - "id": "seeds_label", - "visible": 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": "", - "value": "seeds", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "vertical": false, - "wrap": false, - "align": "center" - }, - { - "type": "panel", - "top": 90, - "left": 10, - "lock": false, - "id": "seeds_tab_panel", - "visible": true, - "comments": "", - "width": "96.3%", - "height": "84.13%", - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": 0, - "html": "", - "css": "> inner > .navigation {\n height: 35rem;\n}", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "interaction": true, - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "verticalTabs": false, - "variables": "@{parent.variables}", - "traversing": false, - "typeTags": "", - "ignoreDefaults": false, - "bypass": true, - "widgets": [], - "tabs": [ - { - "type": "tab", - "lock": false, - "id": "instrumentation", - "visible": true, - "interaction": true, - "comments": "", - "colorText": "auto", - "colorWidget": "auto", - "colorFill": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "verticalTabs": false, - "label": "auto", - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "textarea", - "top": 270, - "left": 290, - "lock": false, - "id": "order", - "visible": true, - "interaction": true, - "comments": "", - "width": "41.18%", - "height": "41.24%", - "expand": false, - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "textarea {\n white-space: pre;\n line-height: 1.5;\n font-size: 12px;\n}", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "s", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - }, - { - "type": "button", - "top": 270, - "left": 480, - "lock": false, - "id": "order_lock", - "visible": true, - "comments": "", - "width": 20, - "height": 20, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "vertical": false, - "wrap": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "interaction": true, - "colorTextOn": "auto", - "label": "L", - "on": 1, - "off": 0, - "mode": "toggle", - "doubleTap": false, - "decoupled": false, - "typeTags": "", - "ignoreDefaults": false, - "bypass": false - }, - { - "type": "panel", - "top": 190, - "left": 290, - "lock": false, - "id": "order_size_panel", - "visible": true, - "comments": "", - "width": 210, - "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": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "interaction": true, - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "verticalTabs": false, - "variables": "@{parent.variables}", - "traversing": false, - "typeTags": "", - "ignoreDefaults": false, - "bypass": false, - "widgets": [ - { - "type": "range", - "top": 0, - "left": 40, - "lock": false, - "id": "order_size", - "visible": true, - "interaction": true, - "comments": "", - "width": 120, - "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": "", - "design": "default", - "knobSize": "auto", - "horizontal": true, - "pips": false, - "dashed": false, - "gradient": [], - "snap": true, - "spring": false, - "doubleTap": false, - "range": { - "min": 1, - "max": 10 - }, - "logScale": false, - "sensitivity": 1, - "steps": 10, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "i", - "decimals": 0, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "onTouch": "" - }, - { - "type": "input", - "top": 0, - "left": 160, - "lock": false, - "id": "order_size_v2", - "visible": true, - "comments": "", - "width": 40, - "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": "", - "align": "center", - "value": "@{order_size.value.1}", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 0, - "target": "", - "onCreate": "", - "onValue": "set(\"order_size\", [get(\"order_size_v1\"), value])", - "interaction": true, - "unit": "", - "asYouType": false, - "numeric": false, - "validation": "", - "maxLength": "", - "typeTags": "i", - "ignoreDefaults": false, - "bypass": false - }, - { - "type": "input", - "top": 0, - "left": 0, - "lock": false, - "id": "order_size_v1", - "visible": true, - "comments": "", - "width": 40, - "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": "", - "align": "center", - "value": "@{order_size.value.0}", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 0, - "target": "", - "onCreate": "", - "onValue": "set(\"order_size\", [value, get(\"order_size_v2\")])", - "interaction": true, - "unit": "", - "asYouType": false, - "numeric": false, - "validation": "", - "maxLength": "", - "typeTags": "i", - "ignoreDefaults": false, - "bypass": false - } - ], - "tabs": [] - }, - { - "type": "panel", - "top": 230, - "left": 290, - "lock": false, - "id": "passage_size_panel", - "visible": true, - "interaction": true, - "comments": "", - "width": 210, - "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": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "verticalTabs": false, - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "range", - "top": 0, - "left": 40, - "lock": false, - "id": "passage_size", - "visible": true, - "interaction": true, - "comments": "", - "width": 120, - "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": "", - "design": "default", - "knobSize": "auto", - "horizontal": true, - "pips": false, - "dashed": false, - "gradient": [], - "snap": true, - "spring": false, - "doubleTap": false, - "range": { - "min": 0, - "max": 10 - }, - "logScale": false, - "sensitivity": 1, - "steps": 11, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 0, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "onTouch": "" - }, - { - "type": "input", - "top": 0, - "left": 160, - "lock": false, - "id": "passage_size_v2", - "visible": true, - "comments": "", - "width": 40, - "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": "", - "align": "center", - "value": "@{passage_size.value.1}", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 0, - "target": "", - "onCreate": "", - "onValue": "set(\"passage_size\", [get(\"passage_size_v1\"), value])", - "interaction": true, - "unit": "", - "asYouType": false, - "numeric": false, - "validation": "", - "maxLength": "", - "typeTags": "", - "ignoreDefaults": false, - "bypass": false - }, - { - "type": "input", - "top": 0, - "left": 0, - "lock": false, - "id": "passage_size_v1", - "visible": true, - "comments": "", - "width": 40, - "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": "", - "align": "center", - "value": "@{passage_size.value.0}", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 0, - "target": "", - "onCreate": "", - "onValue": "set(\"passage_size\", [value, get(\"passage_size_v2\")])", - "interaction": true, - "unit": "", - "asYouType": false, - "numeric": false, - "validation": "", - "maxLength": "", - "typeTags": "", - "ignoreDefaults": false, - "bypass": false - } - ], - "tabs": [] - }, - { - "type": "matrix", - "top": 10, - "left": 290, - "lock": false, - "id": "sus_weights", - "visible": true, - "interaction": true, - "comments": "", - "width": "41.18%", - "height": "37.11%", - "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, - "variables": "@{parent.variables}", - "traversing": false, - "widgetType": "fragment", - "quantity": 3, - "props": "{\n \"file\": \"fragments/slider.json\",\n \"props\": {\n \"variables\": #{{\n \"n\": $, \"name\": [\"1\", \"2\", \"3\"][$], \n \"min\": -1200, \"max\": 2400,\n \"address\": \"/sus_weights\"\n }}\n }\n}", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "console.log(\"test\")", - "widgets": [], - "tabs": [] - }, - { - "type": "matrix", - "top": 10, - "left": 10, - "lock": false, - "id": "range_matrix", - "visible": true, - "interaction": true, - "comments": "", - "width": "52%", - "height": "95.24%", - "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, - "variables": "@{parent.variables}", - "traversing": false, - "widgetType": "fragment", - "quantity": 4, - "props": "{\n \"file\": \"fragments/range_slider_responsive_2.json\",\n \"props\": {\n \"variables\": {\n \"n\": #{$}, \"min\": -1200, \"max\": 2400, \"address\": \"/range\"\n }\n }\n}", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "", - "widgets": [], - "tabs": [] - } - ], - "tabs": [] - }, - { - "type": "tab", - "lock": false, - "id": "durations", - "visible": true, - "interaction": true, - "comments": "", - "colorText": "auto", - "colorWidget": "auto", - "colorFill": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": false, - "verticalTabs": false, - "label": "auto", - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "panel", - "top": 0, - "left": 0, - "lock": false, - "id": "dur_panel", - "visible": true, - "interaction": true, - "comments": "", - "width": "100%", - "height": "100%", - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "> inner > .navigation {\n height: 30rem;\n}", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "", - "widgets": [], - "tabs": [ - { - "type": "tab", - "lock": false, - "id": "entrances", - "visible": true, - "interaction": true, - "comments": "", - "colorText": "auto", - "colorWidget": "auto", - "colorFill": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "verticalTabs": false, - "label": "auto", - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "fragment", - "top": 50, - "left": 10, - "lock": false, - "id": "entrances", - "visible": true, - "interaction": true, - "comments": "", - "width": "96.46%", - "height": "86.09%", - "expand": "false", - "css": "", - "file": "fragments/env_durs_frags.json", - "fallback": "", - "props": {}, - "address": "auto", - "variables": "@{parent.variables}" - }, - { - "type": "switch", - "top": 10, - "left": 10, - "lock": false, - "id": "entrances_probs_sync", - "visible": true, - "interaction": true, - "comments": "", - "width": 490, - "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", - "layout": "horizontal", - "gridTemplate": "", - "wrap": false, - "values": { - "sync to entrances": "entrances", - "sync to passages": "passages", - "sync to exits": "exits" - }, - "mode": "tap", - "value": "", - "default": "passages", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "set(\"@{parent.id}_probs_vals\", get(value + \"_probs_vals\"))" - } - ], - "tabs": [] - }, - { - "type": "tab", - "lock": false, - "id": "passages", - "visible": true, - "interaction": true, - "comments": "", - "colorText": "auto", - "colorWidget": "auto", - "colorFill": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "verticalTabs": false, - "label": "auto", - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "fragment", - "top": 50, - "left": 10, - "lock": false, - "id": "passages", - "visible": true, - "interaction": true, - "comments": "", - "width": "96.46%", - "height": "86.09%", - "expand": "false", - "css": "", - "file": "fragments/env_durs_frags.json", - "fallback": "", - "props": {}, - "address": "auto", - "variables": "@{parent.variables}" - }, - { - "type": "switch", - "top": 10, - "left": 10, - "lock": false, - "id": "passages_probs_sync", - "visible": true, - "interaction": true, - "comments": "", - "width": 490, - "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", - "layout": "horizontal", - "gridTemplate": "", - "wrap": false, - "values": { - "sync to entrances": "entrances", - "sync to passages": "passages", - "sync to exits": "exits" - }, - "mode": "tap", - "value": "", - "default": "passages", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "set(\"@{parent.id}_probs_vals\", get(value + \"_probs_vals\"))" - } - ], - "tabs": [] - }, - { - "type": "tab", - "lock": false, - "id": "exits", - "visible": true, - "interaction": true, - "comments": "", - "colorText": "auto", - "colorWidget": "auto", - "colorFill": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "verticalTabs": false, - "label": "auto", - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "fragment", - "top": 50, - "left": 10, - "lock": false, - "id": "exits", - "visible": true, - "interaction": true, - "comments": "", - "width": "96.46%", - "height": "86.09%", - "expand": "false", - "css": "", - "file": "fragments/env_durs_frags.json", - "fallback": "", - "props": {}, - "address": "auto", - "variables": "@{parent.variables}" - }, - { - "type": "switch", - "top": 10, - "left": 10, - "lock": false, - "id": "exits_probs_sync", - "visible": true, - "interaction": true, - "comments": "", - "width": 490, - "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", - "layout": "horizontal", - "gridTemplate": "", - "wrap": false, - "values": { - "sync to entrances": "entrances", - "sync to passages": "passages", - "sync to exits": "exits" - }, - "mode": "tap", - "value": "", - "default": "passages", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "set(\"@{parent.id}_probs_vals\", get(value + \"_probs_vals\"))" - } - ], - "tabs": [] - } - ], - "verticalTabs": false - } - ], - "tabs": [] - }, - { - "type": "tab", - "lock": false, - "id": "weights", - "visible": true, - "interaction": true, - "comments": "", - "colorText": "auto", - "colorWidget": "auto", - "colorFill": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": false, - "verticalTabs": false, - "label": "melody weights", - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": true, - "onCreate": "", - "onValue": "", - "widgets": [ - { - "type": "fragment", - "top": 10, - "left": 10, - "lock": false, - "id": "step_env", - "visible": true, - "interaction": true, - "comments": "", - "width": "96.53%", - "height": 260, - "expand": "false", - "css": "", - "file": "fragments/env.json", - "fallback": "", - "props": {}, - "address": "auto", - "variables": "@{parent.variables}" - }, - { - "type": "matrix", - "top": 280, - "left": 10, - "lock": false, - "id": "passages_weights", - "visible": true, - "interaction": true, - "comments": "", - "width": "96.53%", - "height": "40.57%", - "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, - "variables": "@{parent.variables}", - "traversing": false, - "widgetType": "fragment", - "quantity": 5, - "props": "{\n \"file\": \"fragments/slider.json\",\n \"props\": {\n \"variables\": #{{\n \"n\": $, \"name\": [\"step\", \"dc\", \"range\", \"registration\", \"hd\"][$], \n \"min\": -1200, \"max\": 2400,\n \"address\": \"/passages_weights\"\n }}\n }\n}", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "widgets": [], - "tabs": [] - }, - { - "type": "variable", - "lock": false, - "id": "passage_weights/2_val_share", - "comments": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "console.log(value)" - } - ], - "tabs": [] - } - ] - }, - { - "type": "input", - "top": 50, - "left": 50, - "lock": false, - "id": "order_seed", - "visible": true, - "interaction": true, - "comments": "", - "width": 80, - "height": 30.000000000000004, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "align": "center", - "unit": "", - "asYouType": false, - "numeric": false, - "validation": "", - "maxLength": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - }, - { - "type": "button", - "top": 50, - "left": 130, - "lock": false, - "id": "dur_seed_lock", - "visible": true, - "comments": "", - "width": 30.000000000000004, - "height": 30.000000000000004, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "vertical": false, - "wrap": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "interaction": true, - "colorTextOn": "auto", - "label": "L", - "on": 1, - "off": 0, - "mode": "toggle", - "doubleTap": false, - "decoupled": false, - "typeTags": "", - "ignoreDefaults": false, - "bypass": true - }, - { - "type": "button", - "top": 50, - "left": 300, - "lock": false, - "id": "order_seed_lock", - "visible": true, - "comments": "", - "width": 29.999999999999996, - "height": 29.999999999999996, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "vertical": false, - "wrap": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "interaction": true, - "colorTextOn": "auto", - "label": "L", - "on": 1, - "off": 0, - "mode": "toggle", - "doubleTap": false, - "decoupled": false, - "typeTags": "", - "ignoreDefaults": false, - "bypass": true - }, - { - "type": "input", - "top": 50, - "left": 220, - "lock": false, - "id": "dur_seed", - "visible": true, - "interaction": true, - "comments": "", - "width": 80, - "height": 30.000000000000004, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "align": "center", - "unit": "", - "asYouType": false, - "numeric": false, - "validation": "", - "maxLength": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - }, - { - "type": "button", - "top": 50, - "left": 460, - "lock": false, - "id": "weights_seed_lock", - "visible": true, - "comments": "", - "width": 29.999999999999996, - "height": 29.999999999999996, - "expand": "false", - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "vertical": false, - "wrap": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "decimals": 2, - "target": "", - "onCreate": "", - "onValue": "", - "interaction": true, - "colorTextOn": "auto", - "label": "L", - "on": 1, - "off": 0, - "mode": "toggle", - "doubleTap": false, - "decoupled": false, - "typeTags": "", - "ignoreDefaults": false, - "bypass": true - }, - { - "type": "input", - "top": 50, - "left": 380, - "lock": false, - "id": "weights_seed", - "visible": true, - "interaction": true, - "comments": "", - "width": 80, - "height": 30.000000000000004, - "expand": false, - "colorText": "auto", - "colorWidget": "auto", - "colorStroke": "auto", - "colorFill": "auto", - "alphaStroke": "auto", - "alphaFillOff": "auto", - "alphaFillOn": "auto", - "lineWidth": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "align": "center", - "unit": "", - "asYouType": false, - "numeric": false, - "validation": "", - "maxLength": "", - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "" - } - ], - "tabs": [] - } - ], - "tabs": [] - } -} \ No newline at end of file diff --git a/supercollider/seeds_and_ledgers_main_dict.scd b/supercollider/seeds_and_ledgers_main_dict.scd deleted file mode 100644 index 5b87524..0000000 --- a/supercollider/seeds_and_ledgers_main_dict.scd +++ /dev/null @@ -1,727 +0,0 @@ -( -// helper funcs -var hsArrayToCents, pDist, hdSum, hsChordalDistance, hsArrayToFreq; - -// score funcs -var isInRange, spacingScore, rangeScore, intervalScore, inclusionScore; - -// subroutines -var genTuples, initVoices, genOrders, genSubMotif, updateVoices, genDurFunc; - -// primary routines -var genMotif, genSecondarySeq; - -// audition funcs -var genPatterns, genMidiPatterns; - -// resource management funcs -var seedFunc, genUID, writeResources, stringifyToDepth, setSeeds, sanityCheck, -msgInterpret, loadLedgerFile, loadLedgerJSON, loadModelFile, loadModelJSON; - -// model vars -//(model and global vars mostly set by OSC funcs -var curUID, refUID, orderSeed, durSeed, motifSeed, -entrancesProbVals, passagesProbVals, exitsProbVals, -ranges, orders, susWeights, passagesWeights, passagesSize, orderSize, -model; - -// model aux vars -var entrancesDurFunc, passagesDurFunc, exitsDurFunc; - -// other global vars -var lastXChanges, popSize, exPath, dir, primes, dims, tuples, -seq, group, player, ledgerPath, ledger, currentlyPlayingUID; - - -// install JSON quark -if(Quarks.isInstalled("JSONlib").not, { - Quarks.install("https://github.com/musikinformatik/JSONlib.git"); - thisProcess.recompile; - //HelpBrowser.openHelpFor("Classes/JSONlib"); -}); - - -//------helper funcs - -hsArrayToCents = { - arg hsArray; - hsArray.collect({arg dist, p; dist * 1200 * log2(primes[p][0]/primes[p][1])}).sum -}; - -pDist = { - arg array1, array2, signed = false; - var pDistance; - pDistance = hsArrayToCents.value(array1) - hsArrayToCents.value(array2); - if(signed, {pDistance}, {abs(pDistance)}) -}; - -hdSum = { - arg hsArrays; - var size, distances, mean; - size = hsArrays.size; - distances = (size - 1).collect({arg i; - ((i + 1)..(size - 1)).collect({arg j; - abs(hsArrays[i] - hsArrays[j]).collect({arg dist, p; dist * log2(primes[p].product)}).sum - }); - }).flat; - mean = distances.sum / distances.size; - distances.sum - //mean + ((1 / sqrt((pow(distances - mean, 2)).sum / distances.size)) * mean) -}; - -hsChordalDistance = { - arg hsArrays1, hsArrays2; - var size, distances, mean; - size = hsArrays1.size; - distances = hsArrays1.size.collect({arg i; - hsArrays2.size.collect({arg j; - abs(hsArrays1[i] - hsArrays2[j]).collect({arg dist, p; dist * log2(primes[p].product)}).sum - }); - }).flat; - mean = distances.sum / distances.size; - distances.sum - //mean + ((1 / sqrt((pow(distances - mean, 2)).sum / distances.size)) * mean) -}; - -hsArrayToFreq = { - arg array; - array.collect({arg dim, d; pow(primes[d][0]/primes[d][1], dim)}).product -}; - -//------score funcs - -/* -isInRange = { - arg hsArray, min, max; - var cents; - cents = hsArrayToCents.value(hsArray); - (cents >= min) && (cents <= max) -}; -*/ - -spacingScore = { - arg hsArrays, min; - var centsArray; - centsArray = hsArrays.collect({arg hsArray; hsArrayToCents.value(hsArray)}).sort({arg a, b; a < b}); - centsArray.differentiate.drop(1).collect({arg pDistance; if(pDistance >= min, {1}, {0.01})}).sum; -}; - -rangeScore = { - arg hsArray1, hsArray2, min, max, low, signed = false; - var pDistance; - pDistance = pDist.value(hsArray1, hsArray2, signed); - if((pDistance >= min) && (pDistance <= max), {1}, {low}); -}; - -intervalScore = { - arg hsArray1, hsArray2, mean, sd, signed = false; - var pDistance; - pDistance = pDist.value(hsArray1, hsArray2, signed); - pDistance.gaussCurve(1, mean, sd) -}; - -inclusionScore = { - arg array, test, min = 0.01; - if(array.collect({arg v; v.hash}).includes(test.hash), {min}, {1}); -}; - - -//------subroutines - -genTuples = { - var tuples; - tuples = dims.collect({[-1, 0, 1]}).allTuples.select({arg tuple; (abs(tuple.drop(1)).sum <= 1) && (tuple[0] == 0)}); - tuples = tuples ++ tuples.collect({arg tuple; [-3, -2, -1, 1, 2, 3].collect({arg octTrans; tuple.deepCopy.put(0, octTrans)})}).flatten; -}; - -initVoices = { - var init, voicesInit; - voicesInit = popSize.collect({dims.collect({0})}); - /* - voicesInit = [dims.collect({0})]; - (popSize - 1).do({ - arg rep, new; - rep = dims.rand; - new = voicesInit.last.deepCopy; - new[rep] = new[rep] + [-1, 1].choose(); - voicesInit = voicesInit.add(new); - }); - */ - voicesInit.deepCopy; -}; - -genDurFunc = {arg chordProb, min, max, envData, seed; - var env, pTable, durFunc; - env = Env.pairs([[0, 0]] ++ envData.clump(2) ++ [[1, 0]]).asSignal(256).asList.asArray; - pTable = env.asRandomTable; - durFunc = {arg allowChord; - var res; - res = if(allowChord.not, { - pTable.tableRand * (max - min) + min - }, { - if(1.0.rand < chordProb, {0}, {pTable.tableRand * (max - min) + min}); - }).round(0.125); - if(res.asInteger == res, {res = res.asInteger}); - res - }; - seedFunc.value(durFunc, model["dur_seed"]); -}; - -genOrders = {arg minMotifLength = 1, maxMotifLength = 5, minProgLength = 0, maxProgLength = 5; - ((maxMotifLength - minMotifLength).rand + minMotifLength).collect({ - var noProgIns, noSusIns, noSilentIns, prog, sus, silent; - noSusIns = [1, 2, 3].wchoose(susWeights.normalizeSum); - noProgIns = (popSize - noSusIns).rand + 1; - noSilentIns = popSize - noSusIns - noProgIns; - - # prog, sus, silent = (0..(popSize-1)).scramble.clumps([noProgIns, noSusIns, noSilentIns]); - - prog = (prog.scramble ++ ((maxProgLength - minProgLength).rand + minProgLength).collect({prog.choose}).scramble); - if(silent == nil, {silent = []}); - [sus.scramble, prog, silent.scramble] - }); -}; - -updateVoices = {arg ins, sus; - var voices, candidates, nWeights, nProbs, sel; - - voices = lastXChanges.deepCopy.last; - - candidates = sus.collect({arg v; tuples.collect({arg t; voices[v] + t})}).flatten; - candidates = difference(candidates.asSet, voices.asSet).asList; - nProbs = candidates.collect({arg candidate; - var ranges, stepScore, recentlySoundedScore, isInRangeScore, regScore, hdScore; - - ranges = model["ranges"]; - //stepScore = intervalScore.value(voices[ins], candidate, 30, 400, 0.1); - stepScore = intervalScore.value(voices[ins], candidate, 100, 100); - recentlySoundedScore = inclusionScore.value(lastXChanges.flop[ins], candidate, 0); - isInRangeScore = rangeScore.value(candidate, candidate.collect({0}), ranges[ins][0], ranges[ins][1], 0, true); - regScore = spacingScore.value(voices.deepCopy.put(ins, candidate), 300); - hdScore = 1/pow(hdSum.value(voices.deepCopy.put(ins, candidate)), 2); - //maybe what you want here is a vector to another root and then favoring movement towards it. - //distScore = pow(hsChordalDistance.value(voices, voices.put(ins, candidate)), 2); - - [stepScore, recentlySoundedScore, isInRangeScore, regScore, hdScore] - }); - - nWeights = model["passages_weights"]; - - //this handles nWeights of 0; mainly for testing - nProbs = nProbs.flop.select({arg scores, s; nWeights[s] != 0}).flop; - nWeights = nWeights.select({arg weight; weight != 0}); - nProbs = nProbs.flop.collect({arg scores, s; - if(scores.sum == 0, {scores}, {scores.normalizeSum * nWeights[s]}) - }); - nProbs = nProbs.flop.collect({arg scores, s; scores.product}).normalizeSum; - - sel = candidates.wchoose(nProbs); - - voices[ins] = sel; - lastXChanges = lastXChanges.add(voices).keep(-5); -}; - -genSubMotif = {arg order, lastState, repeatLast = false, startFromLast = false, isLastOrder = false; - var sus, prog, silent, flatOrder, res, isInChord, allowChord, lastXChangesHold, voices, adder; - # sus, prog, silent = order; - flatOrder = silent ++ sus ++ prog; - lastXChangesHold = lastXChanges.deepCopy; - voices = lastState.deepCopy; - isInChord = popSize.collect({false}); - allowChord = false; - res = []; - "------generating motif".postln; - //need to figure out here if voices move between motifs - flatOrder.do({arg ins, i; - - if(prog.includes(ins) && repeatLast.not, {updateVoices.value(ins, sus)}); - adder = if(silent.includes(ins), {["Rest"]}, {lastXChanges.last.deepCopy[ins]}); - - if(voices[ins] != adder, { - var dur; - allowChord = if((sus ++ silent).includes(ins), { - (sus ++ silent).includes(ins) && (ins != sus.last); - }, { - if(i < (flatOrder.size - 1), {(isInChord[flatOrder[i + 1]] || (ins == flatOrder[i + 1])).not}, {false}); - }); - dur = passagesDurFunc.value(allowChord); - if(dur == 0, {isInChord[ins] = true}, {isInChord = popSize.collect({false})}); - - voices[ins] = adder; - res = res.add([voices.deepCopy.postln, dur]); - }); - }); - - // pad ending - if(isLastOrder, { - (0..(popSize-1)).scramble.do({arg ins; - if(res.last.first[ins] != ["Rest"], { - var dur; - voices[ins] = ["Rest"]; - allowChord = (voices != popSize.collect({["Rest"]})); - dur = passagesDurFunc.value(allowChord); - res = res.add([voices.deepCopy.postln, dur]); - }); - }); - }); - - //format and return - if(startFromLast, {lastXChanges = lastXChangesHold}); - res; -}; - - -//------primary routines - -genMotif = { - var repeats, fSeq; - - repeats = 1; - fSeq = []; - - repeats.do({arg index; - var motif; - - motif = []; - - model["orders"].do({arg order, o; - var lastState, subMotif; - lastState = if(o == 0, {popSize.collect({["Rest"]})}, {motif.last.last.first}); - subMotif = genSubMotif.value(order, lastState, isLastOrder: o == (orders.size - 1)); - motif = motif.add(subMotif); - - }); - - sanityCheck.value(motif, index); - - fSeq = fSeq.add(motif); - }); - fSeq -}; - -genSecondarySeq = {arg seq; - var curdles, fSeq; - curdles = []; - while({curdles.sum < seq.size}, {curdles = curdles ++ [3.rand + 1]}); - - fSeq = seq.clumps(curdles).collect({arg clump, m; - var repeats, paddedSeq; - - //add rest - paddedSeq = clump.add([[[popSize.collect({["Rest"]}), 0.5.rand]]]); - - //implement repeats - repeats = [0.rand + 1, 1].wchoose([1, 0].normalizeSum); - repeats.collect({paddedSeq}); - }); - fSeq -}; - - -//------audition funcs - -Event.addEventType(\osc, { - if (~addr.postln.notNil) { - ~addr.sendMsg(~indexPath, ~indexMsg); - ~addr.sendMsg(~seqPath, stringifyToDepth.value(~seqMsg, 3)); - //~addr.sendMsg("/STATE/OPEN", (dir.replace("supercollider", "resources") +/+ ~idMsg +/+ ~idMsg ++ "_gui_state" ++ ".state").standardizePath.postln); - }; -}); - -genPatterns = {arg inSeq, addr; - var voices, durs, patterns, res, indices, sectionDurs, ids, seq; - seq = inSeq.collect({arg mSeq; mSeq[0]}); - # voices, durs = seq.flatten2(seq.maxDepth - 5).flop; - indices = inSeq.collect({arg mSeq, m; mSeq[1]}); - ids = inSeq.collect({arg mSeq, m; mSeq[2]}); - sectionDurs = seq.collect({arg mSeq; mSeq.flatten2(mSeq.maxDepth - 5).flop[1].sum}); - res = Ppar( - voices.flop.collect({arg voice; - var clumps, hdScores, freqs, fDurs; - clumps = voice.separate({arg a, b; a != b }); - freqs = clumps.collect({arg clump; if(clump[0] != ["Rest"], {(60.midicps * hsArrayToFreq.value(clump[0]))}, {Rest(0)})}); - fDurs = durs.clumps(clumps.collect({arg clump; clump.size})).collect({arg clump; clump.sum}); - - Pbind( - \instrument, \test, - \group, group, - \freq, Pseq(freqs, 1), - \dur, Pseq(fDurs, 1), - \sustain, Pseq(fDurs, 1) - ) - }) ++ - [ - Pbind( - \type, \osc, - \addr, addr, - \indexPath, "/cur_play_index", - \indexMsg, Pseq(indices.postln, 1), - \seqPath, "/mus_seq", - \seqMsg, Pseq(seq, 1), - \dur, Pseq(sectionDurs, 1) - ); - ] - ); - res -}; - -/* -genMidiPatterns = {arg seq; - var voices, durs, patterns, res, mOut, pbRange; - pbRange = 1; //semitones - change this as needed for your situation - mOut = MIDIOut.newByName("TiMidity", "TiMidity port 0").latency_(Server.default.latency); - # voices, durs = seq.flatten2(seq.maxDepth - 5).flop; - res = Ppar( - voices.flop.collect({arg voice, v; - var clumps, hdScores, freqs, fDurs; - - mOut.program(v, 70); - - clumps = voice.separate({arg a, b; a != b }); - freqs = clumps.collect({arg clump; if(clump[0] != ["Rest"], {(60.midicps * hsArrayToFreq.value(clump[0]))}, {Rest(0)})}); - fDurs = durs.clumps(clumps.collect({arg clump; clump.size})).collect({arg clump; clump.sum}); - - Pbind( - \type, \midi, - \chan, v, - \noteval, Pseq(freqs.cpsmidi - 24, 1), - \note, Pfunc({ | event | event[\noteval].floor }), - \dur, Pseq(fDurs, 1), - \midiout, mOut, - \amp, 1, - \bend, Pfunc({ - | event | - if (event[\note].isRest.not) { - var pitchbendvalue = event[\noteval].frac.linlin(0, pbRange, 8192, 8192*2).asInteger; - m.bend(v, pitchbendvalue); - }; - 0; // return something other than nil to avoid stopping the pattern - }), - ); - }); - ); - res -}; -*/ - - -//------resource management funcs - -genUID = {Date.seed.asHexString.toLower}; - -seedFunc = {arg func, seed; - var funcArgs, next; - next = Routine({loop{func.valueArray(funcArgs).yield }}); - next.randSeed_(seed); - {arg ...args; funcArgs = args; next.value} -}; - -stringifyToDepth = {arg data, maxDepth = 1; - var prettyString = "", rCount = 0, writeArray, indent; - - if(maxDepth == 0, { - data.asCompileString - }, { - indent = {arg size; size.collect({" "}).join("")}; - writeArray = {arg array; - prettyString = prettyString ++ indent.value(rCount) ++ "[\n"; - rCount = rCount + 1; - if(rCount < maxDepth, { - array.do({arg subArray; writeArray.value(subArray)}); - }, { - prettyString = prettyString ++ array.collect({arg subArray; - indent.value(rCount + 1) ++ subArray.asCompileString - }).join(",\n"); - }); - rCount = rCount - 1; - prettyString = prettyString ++ "\n" ++ indent.value(rCount) ++ "],\n"; - }; - - writeArray.value(data); - prettyString.replace(",\n\n", "\n").drop(-2); - }) -}; - -sanityCheck = {arg motif, index; - //print functions = very helpful - ("----------" + index + "------------").postln; - - motif.flatten.do({arg val, v; - if(v > 0, { - if(motif.flatten[v-1][0].hammingDistance(val[0]) > 1, {"problem 1".postln}); - if(motif.flatten[v-1][0].hammingDistance(val[0]) == 0, {"problem 2".postln}); - }); - val.postln - }); - "***********".postln; -}; - -msgInterpret = {arg in, escapeDoubleQuotes = true, escapeSingleQuotes = true; - var res; - - res = in; - if(res.isNil.not, { - if((res.isArray && res.isString.not), { - res = res.asCompileString; - res = res.replace(" ", "").replace("\n", "").replace("\t", ""); - if(escapeSingleQuotes, {res = res.replace("\'", "")}); - if(escapeDoubleQuotes, {res = res.replace("\"", "")}); - res = res.replace("Rest", "\"Rest\""); - res = res.interpret; - }, { - //res.postln; - if(res.every({arg char; char.isDecDigit}), {res = res.asInteger}); - }); - }); - res -}; - -writeResources = {arg path; - var file, nameSpaces, modelItems, resString; - file = File(path,"w"); - - nameSpaces = [ - "music_data", "last_changes", - "cur_uid", "ref_uid", "order_seed", "dur_seed", "motifs_seed", - "entrances_probs_vals","passages_probs_vals", "exits_probs_vals", - "ranges", "passages_weights", "order", "sus_weights", "order_size", "passages_size" - ]; - - modelItems = [ - seq, lastXChanges, - curUID, refUID, orderSeed, durSeed, motifSeed, - entrancesProbVals, passagesProbVals, exitsProbVals, - ranges, passagesWeights, orders, susWeights, orderSize, passagesSize - ]; - - resString = [nameSpaces, modelItems].flop.collect({arg item; - var nameSpace, modelItem, depth = 0, insert = " "; - # nameSpace, modelItem = item; - if(nameSpace == "music_data", {depth = 3; insert = "\n"}); - if(nameSpace == "last_changes", {depth = 1; insert = "\n"}); - if(nameSpace == "order", {depth = 1; insert = "\n"}); - "\"" ++ nameSpace ++ "\":" ++ insert ++ stringifyToDepth.value(modelItem.postln, depth).postln - }).join(",\n"); - - resString = "{\n" ++ resString ++ "\n}"; - - file.write(resString); - file.close; - resString -}; - -loadModelFile = {arg path; loadModelJSON.value(File(path, "r").readAllString.parseJSON)}; - -loadModelJSON = {arg jsonObject; - var nameSpaces, data; - - //model = File(path, "r").readAllString.parseJSON; - - nameSpaces = [ - "cur_uid", "ref_uid", "order_seed", "dur_seed", "motifs_seed", - "entrances_probs_vals","passages_probs_vals", "exits_probs_vals", - "ranges", "passages_weights", "order", "sus_weights", "order_size", "passages_size" - ]; - - //data = nameSpaces.collect({arg nS; msgInterpret.value(jsonObject[nS]).postln}); - model = Dictionary.with(*nameSpaces.collect({arg nS; nS -> msgInterpret.value(jsonObject[nS]).postln})); - - data.postln; - - # curUID, refUID, orderSeed, durSeed, motifSeed, - entrancesProbVals, passagesProbVals, exitsProbVals, - ranges, passagesWeights, orders, susWeights, orderSize, passagesSize = data; - - popSize = ranges.size; -}; - -loadLedgerFile = {arg path; - ledgerPath = path; - loadLedgerJSON.value(File(ledgerPath, "r").readAllString.parseJSON) -}; - -loadLedgerJSON = {arg jsonObject; ledger = jsonObject["ledger"]}; - -//------global vars - -primes = [[2, 1], [3, 2], [5, 4], [7, 4], [11, 8], [13, 8]]; -//ranges = [[-2400, 0], [-1200, 1200], [0, 2400], [0, 2400]]; -exPath = thisProcess.nowExecutingPath; -dir = exPath.dirname; -//popSize = 4; -dims = primes.size; -tuples = genTuples.value(); -//refUID = nil; -group = Group.new; -loadLedgerFile.value(dir +/+ ".." +/+ "resources" +/+ "piece_ledger.json"); -//passagesWeights = [1, 1, 1, 1, 1]; -//susWeights = [1, 1, 1]; - - -//------OSC funcs - -OSCdef(\load_ledger, {arg msg, time, addr, port; - loadLedgerFile.value(msg[1].asString); -}, \load_ledger); - -OSCdef(\load_model, {arg msg, time, addr, port; - loadModelFile.value(msg[1].asString); -}, \load_model); - - -OSCdef(\generate, {arg msg, time, addr, port; - var path, refUID, musPath, modelString; - msg.postln; - - path = msg[1].asString; - - loadModelFile.value(path); - - //refUID.postln; - refUID = model["ref_uid"]; - - loadLedgerFile.value(ledgerPath); - if(ledger == nil, {ledger = ["tmp"]}); - if(ledger.last != "tmp", {ledger = ledger.add("tmp")}); - - lastXChanges = if(refUID == nil, { - [initVoices.value().deepCopy]; - }, { - var file; - file = File((dir +/+ ".." +/+ "resources" +/+ refUID +/+ refUID ++ "_mus_model" ++ ".json").standardizePath, "r"); - msgInterpret.value(file.readAllString.parseJSON["last_changes"]); - }); - - # entrancesDurFunc, passagesDurFunc, exitsDurFunc = ["entrances", "passages", "exits"].collect({arg nsPre; - var probsVals = model[nsPre + "_probs_vals"]; - genDurFunc.valueArray(probsVals[..2] ++ [probsVals[3..]]); - }); - - /* - entrancesDurFunc = genDurFunc.valueArray(entrancesProbVals[..2] ++ [entrancesProbVals[3..]]); - passagesDurFunc = genDurFunc.valueArray(passagesProbVals[..2] ++ [passagesProbVals[3..]]); - exitsDurFunc = genDurFunc.valueArray(exitsProbVals[..2] ++ [exitsProbVals[3..]]); - */ - - if(orders == nil, { - orders = seedFunc.value(genOrders, model["order_seed"]).valueArray(orderSize ++ passagesSize); - //addr.sendMsg("/order", stringifyToDepth.value(orders, 1)); - }); - seq = seedFunc.value(genMotif, model["motif_seed"]).value; - - modelString = writeResources.value(path); - - //addr.sendMsg("/generated", musPath, stringifyToDepth.value(seq, 3)); - addr.sendMsg("/generated", path, modelString); -}, \generate); - - -OSCdef(\commit, {arg msg, time, addr, port; - var newLedger, modelPath, musString, musFile, test1, test2; - msg.postln; - - /* - test1 = msg[1].asString.parseJSON; - test2 = (dir +/+ ".." +/+ "resources/tmp/tmp_music" ++ ".json").standardizePath.parseJSONFile; - msgInterpret.value(test1["music"])[0][0][0][1].class.postln; - msgInterpret.value(test2["music_data"])[0][0][0][1].class.postln; - (test1["music"] == test2["music_data"]).postln; - */ - - curUID = genUID.value; - model["cur_uid"] = curUID; - File.mkdir((dir +/+ ".." +/+ "resources" +/+ curUID).standardizePath); - File.copy(exPath, (dir +/+ ".." +/+ "resources" +/+ curUID +/+ curUID ++ "_code" ++ ".scd").standardizePath); - - modelPath = (dir +/+ ".." +/+ "resources" +/+ curUID +/+ curUID ++ "_mus_model" ++ ".json").standardizePath; - writeResources.value(modelPath); - - File.delete(ledgerPath.postln ++ "_bak"); - File.copy(ledgerPath, ledgerPath ++ "_bak"); - File.delete(ledgerPath); - newLedger = File(ledgerPath.postln, "w"); - ledger = ledger.postln.drop(-1).add(curUID); - newLedger.write("{\n\"ledger\":\n" ++ stringifyToDepth.value(ledger, 1) ++ "\n}"); - newLedger.close; - - addr.sendMsg("/committed", curUID, ledgerPath); - //refUID = curUID; -}, \commit); - -OSCdef(\transport, {arg msg, time, addr, port; - msg.postln; - if(msg[1] == 0, { - player.stop; - group.set(\gate, 0); - }, { - // the cued sequence can now be read from file, so this can be cleaned up - var cSize, patterns, pSeq, cuedSeek, indexStart, indexEnd, tmpLedger; - pSeq = []; - cuedSeek = (seq != nil); - indexStart = msg[2].asInteger; - indexEnd = ledger.size - if(cuedSeek, {2}, {1}); - ledger.postln; - if(((indexStart == (ledger.size - 1)) && cuedSeek).not, { - ledger[indexStart..indexEnd].do({arg uid, index; - var file; - (indexStart + index).postln; - file = File((dir +/+ ".." +/+ "resources" +/+ uid +/+ uid ++ "_mus_model" ++ ".json").standardizePath, "r"); - pSeq = pSeq.add([msgInterpret.value(file.readAllString.parseJSON["music_data"]), indexStart + index, uid]); - file.close; - }); - }); - if(cuedSeek, {pSeq = pSeq.add([seq, ledger.size - 1])}); - patterns = genPatterns.value(pSeq, addr); - player = Pfset(pattern: patterns, cleanupFunc: { - addr.sendMsg("/transport", 0); - }); - player = player.play - }); -}, \transport); - -) - -( -SynthDef(\test, {arg freq, gate = 1, sustain, amp, dur; - var trig, exc, sig1, sig2, noHarms; - noHarms = 30; - exc = Saw.ar(freq, TRand.ar(0.5, 1, Impulse.ar(freq))) * 0.001 + Dust.ar(10000, 0.01); - sig1 = (Klank.ar(`[ Array.series(noHarms, freq, freq), - Array.geom(noHarms, 1, 0.2) + Array.fill(noHarms, {rrand(0.01, 0.03)}), - Array.fill(noHarms, {rrand(1, 2)}) ], exc) * 0.5).softclip; - sig1 = HPF.ar(sig1, 300); - Out.ar([0, 1], sig1 * EnvGen.kr(Env.adsr(0.3, 0.3, 0.9, 0.5, 0.9), gate, doneAction: 2)); -}).add; -) - -( -SynthDef(\test, {arg freq, gate = 1, sustain, amp, dur; - var trig, exc, sig1, sig2, noHarms, freqFinal, start, end; - noHarms = 30; - freq = WhiteNoise.ar * 3 + freq; - freqFinal = Duty.ar((1/freq), 0, freq); - trig = Changed.ar(freqFinal); - start = Demand.ar(trig, 0, Dwhite(-1, -0.75)); - end = Demand.ar(trig, 0, Dwhite(0.75, 1)); - exc = Phasor.ar(trig, (end - start) * freqFinal / SampleRate.ir, start, end, 0) * 0.001 + Dust.ar(10000, 0.01); - - sig1 = (Klank.ar(`[ Array.series(noHarms, freq, freq), - Array.geom(noHarms, 1, 0.2) + Array.fill(noHarms, {rrand(0.01, 0.03)}), - Array.fill(noHarms, {rrand(2, 3)}) ], exc) * 0.5).softclip; - sig1 = HPF.ar(sig1, 300); - Out.ar([0, 1], sig1 * EnvGen.kr(Env.adsr(0.3, 0.3, 0.9, 0.5, 0.9), gate, doneAction: 2)); -}).add; -) - - - -"{\"a\": 1}".parseYAML["a"].asInteger; -"{\"a\": 1}".parseJSON["a"].isNumber; - -1223423434123.asHexString.toLower - -Date.getDate.rawSeconds -Date.seed.asHexString.toLower - -n = NetAddr("localhost", 8080); -n.sendMsg("/GET/#", (NetAddr.localAddr.hostname ++ ":" ++ NetAddr.localAddr.port), "/passage_probs_vals"); \ No newline at end of file