1 Commits

Author SHA1 Message Date
c3656f182c Center point saving 2024-08-06 13:59:15 +02:00
6 changed files with 378 additions and 640 deletions

View File

@@ -5,8 +5,7 @@ function isNumeric(str) {
} }
function DropDown(props) { function DropDown(props) {
let className = props.locked ? 'locked-component' : ''; return e('select', {type: "number", onChange: props.onChange, value: props.value},
return e('select', {className, type: "number", onChange: props.onChange, value: props.value},
...props.options.map((item) => Option(item))); ...props.options.map((item) => Option(item)));
} }
@@ -19,13 +18,11 @@ function Label(text){
} }
function NumberBox(props){ function NumberBox(props){
let extraClassName = props.locked ? ' locked-component' : ''; return e('input', {type: "number", onChange: props.onChange, step: props.step, value: props.value, className: props.className}, null);
return e('input', {type: "number", onChange: props.onChange, step: props.step, value: props.value, className: props.className + extraClassName}, null);
} }
function TextBox(props){ function TextBox(props){
let className = props.locked ? 'locked-component' : ''; return e('input', {type: "text", value: props.value, onChange: props.onChange, id: props.id});
return e('input', {className, type: "text", value: props.value, onChange: props.onChange, id: props.id});
} }
function Option(str, value){ function Option(str, value){
@@ -33,8 +30,7 @@ function Option(str, value){
} }
function Button(props){ function Button(props){
let className = props.locked ? 'locked-component' : ''; return e('button', {onClick: props.onClick}, props.text);
return e('button', {onClick: props.onClick, className}, props.text);
} }
function Switch(props){ function Switch(props){

View File

@@ -5,13 +5,13 @@
// NOT A REACT FUNCTIONAL COMPONENT. MERELY RETURNS AN ARRAY WHICH IS UNPACKED // NOT A REACT FUNCTIONAL COMPONENT. MERELY RETURNS AN ARRAY WHICH IS UNPACKED
function EnumeratorItems(index, enumBreakPoints, setEnumBreakPoints, enumNames, setEnumNames, djParam, locked){ function EnumeratorItems(index, enumBreakPoints, setEnumBreakPoints, enumNames, setEnumNames, djParam){
let items = []; let items = [];
for (let i = 0; i < MAXENUMPOINTS; i++){ for (let i = 0; i < MAXENUMPOINTS; i++){
items.push(ListItem(e(TextBox, {locked, onChange: CreateMatrixParamChanger(enumNames, setEnumNames, index, i), value: enumNames[index][i], id:`text-${djParam}-${enumNames[index][i]}`}, null))); items.push(ListItem(e(TextBox, {onChange: CreateMatrixParamChanger(enumNames, setEnumNames, index, i), value: enumNames[index][i], id:`text-${djParam}-${enumNames[index][i]}`}, null)));
// Add 1 to make up for the lower enum bound // Add 1 to make up for the lower enum bound
items.push(ListItem(e(NumberBox, {locked, onChange: CreateMatrixParamChanger(enumBreakPoints, setEnumBreakPoints, index, i + 1), value:enumBreakPoints[index][i + 1]}, null))); items.push(ListItem(e(NumberBox, {onChange: CreateMatrixParamChanger(enumBreakPoints, setEnumBreakPoints, index, i + 1), value:enumBreakPoints[index][i + 1]}, null)));
} }
return items; return items;
} }
@@ -20,13 +20,13 @@ function EnumeratorRow(props){
let linkedText = props.linked ? "<- mods" : ""; let linkedText = props.linked ? "<- mods" : "";
let content = e('ul', {className: 'lfo-item', id: `${props.djParam}-enum-row`}, let content = e('ul', {className: 'lfo-item', id: `${props.djParam}-enum-row`},
ListItem(DropDown({locked:props.locked, onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})), ListItem(DropDown({onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
ListItem(DropDown({locked:props.locked, onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})), ListItem(DropDown({onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
ListItem(e(NumberBox, {locked:props.locked, onChange: props.setEnumItemCounts, step:1, value:props.enumItems, className: 'enum-count'}, null)), ListItem(e(NumberBox, {onChange: props.setEnumItemCounts, step:1, value:props.enumItems, className: 'enum-count'}, null)),
ListItem(e(NumberBox, {locked:props.locked, onChange: CreateMatrixParamChanger(props.enumBreakPoints, props.setEnumBreakPoints, props.index, 0), value:props.enumBreakPoints[props.index][0], step:0.1}, null)), ListItem(e(NumberBox, {onChange: CreateMatrixParamChanger(props.enumBreakPoints, props.setEnumBreakPoints, props.index, 0), value:props.enumBreakPoints[props.index][0], step:0.1}, null)),
...(EnumeratorItems(props.index, props.enumBreakPoints, props.setEnumBreakPoints, props.enumNames, props.setEnumNames, props.djParam, props.locked).slice(0, props.enumItems * 2)), ...(EnumeratorItems(props.index, props.enumBreakPoints, props.setEnumBreakPoints, props.enumNames, props.setEnumNames, props.djParam).slice(0, props.enumItems * 2)),
ListItem(e(Button, {locked:props.locked, text:'+', onClick: props.addEnum}, null)), ListItem(e(Button, {text:'+', onClick: props.addEnum}, null)),
ListItem(e(Button, {locked:props.locked, text:'-', onClick: props.removeEnum}, null)), ListItem(e(Button, {text:'-', onClick: props.removeEnum}, null)),
ListItem(e("div", {className:"linked"}, linkedText)) ListItem(e("div", {className:"linked"}, linkedText))
); );
if (props.visible){ if (props.visible){

View File

@@ -3,14 +3,14 @@
"fileversion" : 1, "fileversion" : 1,
"appversion" : { "appversion" : {
"major" : 8, "major" : 8,
"minor" : 6, "minor" : 5,
"revision" : 2, "revision" : 6,
"architecture" : "x64", "architecture" : "x64",
"modernui" : 1 "modernui" : 1
} }
, ,
"classnamespace" : "box", "classnamespace" : "box",
"rect" : [ 34.0, 76.0, 1155.0, 763.0 ], "rect" : [ 112.0, 87.0, 1344.0, 869.0 ],
"bglocked" : 0, "bglocked" : 0,
"openinpresentation" : 0, "openinpresentation" : 0,
"default_fontsize" : 12.0, "default_fontsize" : 12.0,
@@ -40,98 +40,25 @@
"assistshowspatchername" : 0, "assistshowspatchername" : 0,
"boxes" : [ { "boxes" : [ {
"box" : { "box" : {
"fontname" : "Arial", "id" : "obj-31",
"fontsize" : 13.0, "maxclass" : "message",
"id" : "obj-29",
"maxclass" : "newobj",
"numinlets" : 2, "numinlets" : 2,
"numoutlets" : 1, "numoutlets" : 1,
"outlettype" : [ "bang" ], "outlettype" : [ "" ],
"patching_rect" : [ 465.0, 141.0, 210.0, 23.0 ], "patching_rect" : [ 45.0, 289.0, 104.0, 22.0 ],
"text" : "metro @interval 40 ticks @active 1" "text" : "param 2 scale 0.5"
}
}
, {
"box" : {
"id" : "obj-28",
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 826.0, 79.0, 24.0, 24.0 ]
} }
} }
, { , {
"box" : { "box" : {
"id" : "obj-3", "id" : "obj-3",
"maxclass" : "newobj", "maxclass" : "message",
"numinlets" : 1, "numinlets" : 2,
"numoutlets" : 1, "numoutlets" : 1,
"outlettype" : [ "" ], "outlettype" : [ "" ],
"patching_rect" : [ 817.0, 147.0, 80.0, 22.0 ], "patching_rect" : [ 45.0, 154.0, 131.0, 22.0 ],
"text" : "prepend ticks" "text" : "param 1 metriclarity 40"
}
}
, {
"box" : {
"id" : "obj-54",
"maxclass" : "newobj",
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 44.0, 528.5, 49.0, 22.0 ],
"text" : "r reload"
}
}
, {
"box" : {
"id" : "obj-50",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 233.5, 589.0, 150.0, 20.0 ],
"text" : "user definted LFO shape"
}
}
, {
"box" : {
"id" : "obj-48",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 118.0, 606.5, 109.0, 22.0 ],
"text" : "prepend userWave"
}
}
, {
"box" : {
"candicane2" : [ 0.145098, 0.203922, 0.356863, 1.0 ],
"candicane3" : [ 0.290196, 0.411765, 0.713726, 1.0 ],
"candicane4" : [ 0.439216, 0.619608, 0.070588, 1.0 ],
"candicane5" : [ 0.584314, 0.827451, 0.431373, 1.0 ],
"candicane6" : [ 0.733333, 0.035294, 0.788235, 1.0 ],
"candicane7" : [ 0.878431, 0.243137, 0.145098, 1.0 ],
"candicane8" : [ 0.027451, 0.447059, 0.501961, 1.0 ],
"contdata" : 1,
"id" : "obj-33",
"maxclass" : "multislider",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "", "" ],
"parameter_enable" : 0,
"patching_rect" : [ 118.0, 528.5, 162.0, 52.0 ],
"peakcolor" : [ 0.498039, 0.498039, 0.498039, 1.0 ],
"setminmax" : [ 0.0, 127.0 ],
"settype" : 0,
"size" : 50
} }
} }
@@ -167,8 +94,8 @@
"numinlets" : 2, "numinlets" : 2,
"numoutlets" : 1, "numoutlets" : 1,
"outlettype" : [ "" ], "outlettype" : [ "" ],
"patching_rect" : [ 586.0, 713.0, 89.0, 36.0 ], "patching_rect" : [ 586.0, 713.0, 89.0, 35.0 ],
"text" : "harmoniclarity 14.213599" "text" : "harmoniclarity 20.2"
} }
} }
@@ -180,8 +107,8 @@
"numinlets" : 2, "numinlets" : 2,
"numoutlets" : 1, "numoutlets" : 1,
"outlettype" : [ "" ], "outlettype" : [ "" ],
"patching_rect" : [ 491.0, 713.0, 85.0, 36.0 ], "patching_rect" : [ 491.0, 713.0, 85.0, 35.0 ],
"text" : "event_length 55.786401" "text" : "event_length 70.2"
} }
} }
@@ -193,8 +120,8 @@
"numinlets" : 2, "numinlets" : 2,
"numoutlets" : 1, "numoutlets" : 1,
"outlettype" : [ "" ], "outlettype" : [ "" ],
"patching_rect" : [ 385.0, 715.0, 84.0, 36.0 ], "patching_rect" : [ 385.0, 715.0, 84.0, 35.0 ],
"text" : "metriclarity 79.192955" "text" : "metriclarity 69.626659"
} }
} }
@@ -217,7 +144,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 1066.052632331848145, 53.0, 99.894735336303711, 89.0 ], "patching_rect" : [ 1066.052632331848145, 53.0, 99.894735336303711, 87.0 ],
"text" : "You can use Hz, seconds, ms, hh:mm:ss, or bars.beats.ticks for the period/frequency" "text" : "You can use Hz, seconds, ms, hh:mm:ss, or bars.beats.ticks for the period/frequency"
} }
@@ -229,7 +156,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 1181.315790414810181, 40.0, 81.0, 117.0 ], "patching_rect" : [ 1181.315790414810181, 40.0, 81.0, 114.0 ],
"text" : "Min and max must be ADDED to the center value to determine the true bounds. " "text" : "Min and max must be ADDED to the center value to determine the true bounds. "
} }
@@ -241,7 +168,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 913.0, 107.0, 150.0, 62.0 ], "patching_rect" : [ 913.0, 107.0, 150.0, 60.0 ],
"text" : "center values are read only, they must be configured by an upstream value" "text" : "center values are read only, they must be configured by an upstream value"
} }
@@ -282,6 +209,18 @@
"text" : "prepend timesig" "text" : "prepend timesig"
} }
}
, {
"box" : {
"id" : "obj-52",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 545.0, 135.0, 89.0, 22.0 ],
"text" : "prepend tempo"
}
} }
, { , {
"box" : { "box" : {
@@ -313,7 +252,7 @@
"maxclass" : "newobj", "maxclass" : "newobj",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 939.0, 69.0, 51.0, 22.0 ], "patching_rect" : [ 200.0, 807.0, 51.0, 22.0 ],
"text" : "s reload" "text" : "s reload"
} }
@@ -325,7 +264,74 @@
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 5, "numoutlets" : 5,
"outlettype" : [ "preset", "int", "preset", "int", "" ], "outlettype" : [ "preset", "int", "preset", "int", "" ],
"patching_rect" : [ 934.0, 27.0, 100.0, 40.0 ] "patching_rect" : [ 190.0, 752.0, 100.0, 40.0 ],
"pattrstorage" : "storage"
}
}
, {
"box" : {
"id" : "obj-28",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 460.0, 789.0, 116.0, 22.0 ],
"saved_object_attributes" : {
"client_rect" : [ 903, 252, 1512, 568 ],
"parameter_enable" : 0,
"parameter_mappable" : 0,
"storage_rect" : [ 780, 524, 1380, 824 ]
}
,
"text" : "pattrstorage storage",
"varname" : "storage"
}
}
, {
"box" : {
"id" : "obj-26",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 3,
"outlettype" : [ "", "", "" ],
"patching_rect" : [ 643.0, 770.0, 40.0, 22.0 ],
"restore" : [ {
"data" : {
"enumArrays" : [ [ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "2", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "2", "4", "2", "2", "2", "2", "2", "2", "2", "2" ], [ "scale", "meter", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation" ] ],
"enumMats" : [ [ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ], [ [ "major", "minor", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "4 4", "3 4", "7 8", "2 4", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ] ] ],
"modArrays" : [ [ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "1", "1", "1", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "Sine", "SawUp", "SawUp", "Tri", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine" ], [ "metriclarity", "event_length", "harmoniclarity", "meter", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE" ], [ "0.2hz", "2s", "0:0:02", "0.5.0", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz" ], [ "-10", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ "30", "100", "100", "2", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "0", "0", "0.5", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ] ],
"modCenters" : {
"1" : {
"metriclarity" : 40
}
,
"2" : {
"scale" : 1.6
}
,
"3" : {
"attenuation" : 100
}
,
"4" : {
"meter" : 0.5
}
}
}
}
],
"saved_object_attributes" : {
"parameter_enable" : 0,
"parameter_mappable" : 0
}
,
"text" : "pattr",
"varname" : "u560003760"
} }
} }
@@ -333,9 +339,28 @@
"box" : { "box" : {
"data" : { "data" : {
"data" : { "data" : {
"enumArrays" : [ [ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "2", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "2", "4", 2, "2", "2", "2", "2", "2", "2", "2" ], [ "scale", "meter", "NONE", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation" ] ], "enumArrays" : [ [ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "2", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "2", "4", "2", "2", "2", "2", "2", "2", "2", "2" ], [ "scale", "meter", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation" ] ],
"enumMats" : [ [ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ], [ [ "major", "minor", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "4 4", "3 4", "7 8", "2 4", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ] ] ], "enumMats" : [ [ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ], [ [ "major", "minor", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "4 4", "3 4", "7 8", "2 4", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ] ] ],
"modArrays" : [ [ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "1", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "Sine", "Tri", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine" ], [ "metriclarity", "meter", "event_length", "harmoniclarity", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE" ], [ "1hz", "0.4.0", "3s", "00:00:03", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz" ], [ "20", "0", "20", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ "80", "2", "70", "50", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "0", "0", "0", "0.5", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ] ] "modArrays" : [ [ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "1", "1", "1", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "Sine", "SawUp", "SawUp", "Tri", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine" ], [ "metriclarity", "event_length", "harmoniclarity", "meter", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE" ], [ "0.2hz", "2s", "0:0:02", "0.5.0", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz" ], [ "-10", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ "30", "100", "100", "2", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "0", "0", "0.5", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ] ],
"modCenters" : {
"1" : {
"metriclarity" : 40
}
,
"2" : {
"scale" : 1.6
}
,
"3" : {
"attenuation" : 100
}
,
"4" : {
"meter" : 0.5
}
}
} }
} }
@@ -343,12 +368,11 @@
"id" : "obj-25", "id" : "obj-25",
"maxclass" : "newobj", "maxclass" : "newobj",
"numinlets" : 2, "numinlets" : 2,
"numoutlets" : 5, "numoutlets" : 4,
"outlettype" : [ "dictionary", "", "", "", "" ], "outlettype" : [ "dictionary", "", "", "" ],
"patching_rect" : [ 773.0, 808.0, 166.0, 22.0 ], "patching_rect" : [ 773.0, 808.0, 166.0, 22.0 ],
"saved_object_attributes" : { "saved_object_attributes" : {
"embed" : 1, "embed" : 1,
"legacy" : 1,
"parameter_enable" : 0, "parameter_enable" : 0,
"parameter_mappable" : 0 "parameter_mappable" : 0
} }
@@ -400,7 +424,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 137.5, 440.0, 246.0, 66.0 ], "patching_rect" : [ 137.5, 440.0, 246.0, 64.0 ],
"text" : "this param is sent in its already enumerated form, so it will first be turned into a number halfway between the enumeration boundaries" "text" : "this param is sent in its already enumerated form, so it will first be turned into a number halfway between the enumeration boundaries"
} }
@@ -437,7 +461,7 @@
"numoutlets" : 1, "numoutlets" : 1,
"outlettype" : [ "" ], "outlettype" : [ "" ],
"patching_rect" : [ 824.0, 647.0, 101.0, 22.0 ], "patching_rect" : [ 824.0, 647.0, 101.0, 22.0 ],
"text" : "attenuation 200" "text" : "attenuation 100"
} }
} }
@@ -472,7 +496,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 504.0, 546.5, 268.0, 34.0 ], "patching_rect" : [ 504.0, 546.5, 268.0, 33.0 ],
"text" : "we can only output symbols from jweb, so this turns them into lists" "text" : "we can only output symbols from jweb, so this turns them into lists"
} }
@@ -496,7 +520,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 548.52631402015686, 80.0, 150.0, 34.0 ], "patching_rect" : [ 548.52631402015686, 80.0, 150.0, 33.0 ],
"text" : "see below for why we use separate names..." "text" : "see below for why we use separate names..."
} }
@@ -508,7 +532,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 781.0, 17.0, 150.0, 48.0 ], "patching_rect" : [ 781.0, 17.0, 150.0, 47.0 ],
"text" : "self explanatory. Warning-will overwrite whatever is saved." "text" : "self explanatory. Warning-will overwrite whatever is saved."
} }
@@ -520,7 +544,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 1261.315790414810181, 47.0, 78.0, 103.0 ], "patching_rect" : [ 1261.315790414810181, 47.0, 78.0, 100.0 ],
"text" : "You can use the `phase` control to phase offset two LFOs of the same frequency" "text" : "You can use the `phase` control to phase offset two LFOs of the same frequency"
} }
@@ -533,7 +557,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 161.5, 261.0, 197.0, 79.0 ], "patching_rect" : [ 169.0, 246.0, 197.0, 78.0 ],
"text" : "This parameter is defined in the enumerators but not the modulators. It will be enumerated and immediately output" "text" : "This parameter is defined in the enumerators but not the modulators. It will be enumerated and immediately output"
} }
@@ -545,7 +569,7 @@
"numinlets" : 2, "numinlets" : 2,
"numoutlets" : 1, "numoutlets" : 1,
"outlettype" : [ "" ], "outlettype" : [ "" ],
"patching_rect" : [ 59.0, 256.0, 104.0, 22.0 ], "patching_rect" : [ 45.0, 256.0, 104.0, 22.0 ],
"text" : "param 2 scale 1.6" "text" : "param 2 scale 1.6"
} }
@@ -554,11 +578,11 @@
"box" : { "box" : {
"bubble" : 1, "bubble" : 1,
"id" : "obj-24", "id" : "obj-24",
"linecount" : 3, "linecount" : 4,
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 159.0, 347.0, 254.0, 52.0 ], "patching_rect" : [ 169.0, 332.5, 226.0, 64.0 ],
"text" : "This parameter is not defined by either the Modulators or Enumerators, so it will be passed directly to the output" "text" : "This parameter is not defined by either the Modulators or Enumerators, so it will be passed directly to the output"
} }
@@ -571,7 +595,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 159.0, 190.0, 197.0, 66.0 ], "patching_rect" : [ 183.0, 154.0, 197.0, 64.0 ],
"text" : "This parameter is defined in the modulators, and when sent will act as the center value for that LFO" "text" : "This parameter is defined in the modulators, and when sent will act as the center value for that LFO"
} }
@@ -583,7 +607,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 59.0, 634.0, 254.0, 158.0 ], "patching_rect" : [ 45.0, 564.0, 254.0, 154.0 ],
"text" : "The operation runs\n\nInput > Denumeration > Modulators > Enumerators > Output\n\nA parameter from the input not established by a Modulator will be passed directly to the Enumerators\n\nLikewise, the Enumerators will pass not established parameters" "text" : "The operation runs\n\nInput > Denumeration > Modulators > Enumerators > Output\n\nA parameter from the input not established by a Modulator will be passed directly to the Enumerators\n\nLikewise, the Enumerators will pass not established parameters"
} }
@@ -629,12 +653,11 @@
"id" : "obj-4", "id" : "obj-4",
"maxclass" : "newobj", "maxclass" : "newobj",
"numinlets" : 2, "numinlets" : 2,
"numoutlets" : 5, "numoutlets" : 4,
"outlettype" : [ "dictionary", "", "", "", "" ], "outlettype" : [ "dictionary", "", "", "" ],
"patching_rect" : [ 980.368419170379639, 726.0, 97.0, 22.0 ], "patching_rect" : [ 980.368419170379639, 726.0, 97.0, 22.0 ],
"saved_object_attributes" : { "saved_object_attributes" : {
"embed" : 0, "embed" : 0,
"legacy" : 1,
"parameter_enable" : 0, "parameter_enable" : 0,
"parameter_mappable" : 0 "parameter_mappable" : 0
} }
@@ -650,7 +673,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 504.0, 6.0, 150.0, 34.0 ], "patching_rect" : [ 504.0, 6.0, 150.0, 33.0 ],
"text" : "required due to the asynchronous operation" "text" : "required due to the asynchronous operation"
} }
@@ -662,7 +685,7 @@
"maxclass" : "comment", "maxclass" : "comment",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 773.0, 692.0, 150.0, 117.0 ], "patching_rect" : [ 773.0, 692.0, 150.0, 114.0 ],
"text" : "Storage for the matrix. Unfortunately, jsweb dictionary handling isn't great, so we can't use it like a native dict object and need to do this wild hack for usage with pattrstorage" "text" : "Storage for the matrix. Unfortunately, jsweb dictionary handling isn't great, so we can't use it like a native dict object and need to do this wild hack for usage with pattrstorage"
} }
@@ -788,6 +811,13 @@
"source" : [ "obj-22", 0 ] "source" : [ "obj-22", 0 ]
} }
}
, {
"patchline" : {
"destination" : [ "obj-25", 0 ],
"source" : [ "obj-26", 1 ]
}
} }
, { , {
"patchline" : { "patchline" : {
@@ -812,22 +842,15 @@
} }
, { , {
"patchline" : { "patchline" : {
"destination" : [ "obj-47", 0 ], "destination" : [ "obj-2", 0 ],
"source" : [ "obj-28", 0 ] "source" : [ "obj-3", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-47", 0 ],
"source" : [ "obj-29", 0 ]
} }
} }
, { , {
"patchline" : { "patchline" : {
"destination" : [ "obj-2", 0 ], "destination" : [ "obj-2", 0 ],
"source" : [ "obj-3", 0 ] "source" : [ "obj-31", 0 ]
} }
} }
@@ -837,13 +860,6 @@
"source" : [ "obj-32", 1 ] "source" : [ "obj-32", 1 ]
} }
}
, {
"patchline" : {
"destination" : [ "obj-48", 0 ],
"source" : [ "obj-33", 0 ]
}
} }
, { , {
"patchline" : { "patchline" : {
@@ -851,14 +867,6 @@
"source" : [ "obj-36", 0 ] "source" : [ "obj-36", 0 ]
} }
}
, {
"patchline" : {
"destination" : [ "obj-15", 0 ],
"order" : 3,
"source" : [ "obj-37", 0 ]
}
} }
, { , {
"patchline" : { "patchline" : {
@@ -867,14 +875,6 @@
"source" : [ "obj-37", 0 ] "source" : [ "obj-37", 0 ]
} }
}
, {
"patchline" : {
"destination" : [ "obj-22", 0 ],
"order" : 5,
"source" : [ "obj-37", 0 ]
}
} }
, { , {
"patchline" : { "patchline" : {
@@ -883,22 +883,6 @@
"source" : [ "obj-37", 0 ] "source" : [ "obj-37", 0 ]
} }
}
, {
"patchline" : {
"destination" : [ "obj-5", 0 ],
"order" : 2,
"source" : [ "obj-37", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-8", 0 ],
"order" : 4,
"source" : [ "obj-37", 0 ]
}
} }
, { , {
"patchline" : { "patchline" : {
@@ -932,15 +916,8 @@
} }
, { , {
"patchline" : { "patchline" : {
"destination" : [ "obj-3", 0 ], "destination" : [ "obj-52", 0 ],
"source" : [ "obj-47", 7 ] "source" : [ "obj-47", 4 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-48", 0 ]
} }
} }
@@ -953,8 +930,8 @@
} }
, { , {
"patchline" : { "patchline" : {
"destination" : [ "obj-33", 0 ], "destination" : [ "obj-2", 0 ],
"source" : [ "obj-54", 0 ] "source" : [ "obj-52", 0 ]
} }
} }

View File

@@ -1,272 +1,181 @@
* { html,
--locked-color: #5fadbf; body {
--unlocked-color: #ff5153; width: 100%;
} height: 100%;
margin: 0px;
border: 0;
overflow: hidden; /* Disable scrollbars */
display: block; /* No floating content on sides */
}
html, body { ul {
width: 100%; list-style-type: none;
height: 100%; margin: 0;
margin: 0px; padding: 0;
border: 0; overflow: hidden;
overflow: hidden; /* Disable scrollbars */ background-color: #333333;
display: block; /* No floating content on sides */ }
}
ul { li {
list-style-type: none; float: left;
margin: 0; }
padding: 0;
overflow: hidden;
background-color: #333333;
}
li {
float: left;
}
input[type=number] { input[type=number] {
width: 50px; width: 50px;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
input[type=text] { input[type=text] {
width: 60px; width: 60px;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-weight: bold; font-weight: bold;
} }
.timeInput { .timeInput {
width: 80px; width: 80px;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#matrix { #matrix {
background-color: aquamarine; background-color: aquamarine;
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
.numbox-unclicked { .numbox-unclicked {
user-select: none; user-select: none;
border: solid; border: solid;
font-size: 12vw; font-size: 12vw;
} }
.numbox-clicked { .numbox-clicked {
user-select: none; user-select: none;
border : solid; border : solid;
font-size: 12vw; font-size: 12vw;
} }
.param-input-label { .param-input-label {
width: 93%; width: 93%;
font-size: 5vw; font-size: 5vw;
} }
.lfo-input-label { .lfo-input-label {
width: 40%; width: 40%;
font-size: 5vw; font-size: 5vw;
} }
/* The switch - the box around the slider */ /* The switch - the box around the slider */
.switch { .switch {
position: relative; position: relative;
display: inline-block; display: inline-block;
width: 30px; width: 30px;
height: 17px; height: 17px;
} }
/* Hide default HTML checkbox */ /* Hide default HTML checkbox */
.switch input { .switch input {
opacity: 0; opacity: 0;
width: 0; width: 0;
height: 0; height: 0;
} }
/* The slider */ /* The slider */
.slider { .slider {
position: absolute; position: absolute;
cursor: pointer; cursor: pointer;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: #ccc; background-color: #ccc;
-webkit-transition: .4s; -webkit-transition: .4s;
transition: .4s; transition: .4s;
} }
.slider:before { .slider:before {
position: absolute; position: absolute;
content: ""; content: "";
height: 13px; height: 13px;
width: 13px; width: 13px;
left: 2px; left: 2px;
bottom: 2px; bottom: 2px;
background-color: white; background-color: white;
-webkit-transition: .4s; -webkit-transition: .4s;
transition: .4s; transition: .4s;
} }
input:checked + .slider { input:checked + .slider {
background-color: #2196F3; background-color: #2196F3;
} }
input:focus + .slider { input:focus + .slider {
box-shadow: 0 0 1px #2196F3; box-shadow: 0 0 1px #2196F3;
} }
input:checked + .slider:before { input:checked + .slider:before {
-webkit-transform: translateX(13px); -webkit-transform: translateX(13px);
-ms-transform: translateX(13px); -ms-transform: translateX(13px);
transform: translateX(13px); transform: translateX(13px);
} }
/* Rounded sliders */ /* Rounded sliders */
.slider.round { .slider.round {
border-radius: 17px; border-radius: 17px;
} }
.slider.round:before { .slider.round:before {
border-radius: 50%; border-radius: 50%;
} }
h5 { h5 {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.enum-count { .enum-count {
background-color: aquamarine; background-color: aquamarine;
} }
.label { .label {
background-color: aliceblue; background-color: aliceblue;
padding: 0 4px 0 4px; padding: 0 4px 0 4px;
margin: 0 2px 0 2px; margin: 0 2px 0 2px;
border-color: #333333; border-color: #333333;
border-width: 1px; border-width: 1px;
} }
.base-val { .base-val {
background-color: lightgray; background-color: lightgray;
border-color: #333333; border-color: #333333;
border-width: 1px; border-width: 1px;
width: 50px; width: 50px;
margin-left: 2px; margin-left: 2px;
margin-top: 1px; margin-top: 1px;
} }
.linked { .linked {
color: red; color: red;
border-width: 1px; border-width: 1px;
width: 50px; width: 50px;
font-size: small; font-size: small;
margin-left: 2px; margin-left: 2px;
margin-top: 5px; margin-top: 5px;
} }
@keyframes pulse-animation { @keyframes pulse-animation {
0% { 0% {
color: black; color: black;
} }
100% { 100% {
color: red; color: red;
} }
} }
#pulse { #pulse {
animation: pulse-animation 0.2s normal; animation: pulse-animation 0.2s normal;
} }
/* :::::::::::::: LOCK CSS */
.locked-component {
pointer-events: none;
background-color: #333333;
color : white;
}
.container {
display: flex;
width: 100%;
justify-content: space-between;
}
/* Locked */
.lock {
margin-top: 14px;
width: 24px;
height: 21px;
border: 3px solid var(--locked-color);
border-radius: 5px;
position: relative;
cursor: pointer;
-webkit-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
.lock:after {
content: "";
display: block;
background: var(--locked-color);
width: 3px;
height: 7px;
position: absolute;
top: 50%;
left: 50%;
margin: -3.5px 0 0 -2px;
-webkit-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
.lock:before {
content: "";
display: block;
width: 10px;
height: 10px;
bottom: 100%;
position: absolute;
left: 50%;
margin-left: -8px;
border: 3px solid var(--locked-color);
border-top-right-radius: 50%;
border-top-left-radius: 50%;
border-bottom: 0;
-webkit-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
/* Locked Hover */
.lock:hover:before {
height: 12px;
}
/* Unlocked */
.unlocked {
transform: rotate(10deg);
}
.unlocked:before {
bottom: 130%;
left: 31%;
margin-left: -11.5px;
transform: rotate(-45deg);
}
.unlocked,
.unlocked:before {
border-color: var(--unlocked-color);
}
.unlocked:after {
background: var(--unlocked-color);
}
/* Unlocked Hover */
.unlocked:hover {
transform: rotate(3deg);
}
.unlocked:hover:before {
height: 10px;
left: 40%;
bottom: 124%;
transform: rotate(-30deg);
}

107
lfogui.js
View File

@@ -20,11 +20,6 @@ const ViewModes = Object.freeze({
ENUM: 1 ENUM: 1
}); });
const LockModes = Object.freeze({
UNLOCK: 0,
LOCK: 1
});
var modPhases = Array(MAXLFOS).fill(0); var modPhases = Array(MAXLFOS).fill(0);
var firstUpdateTime = Date.now(); var firstUpdateTime = Date.now();
@@ -48,28 +43,16 @@ function MasterLfoHandler(){
setViewMode(ViewModes.MOD); setViewMode(ViewModes.MOD);
}; };
const [lockMode, setLockMode] = React.useState(LockModes.LOCK);
const toggleLockMode = () => {
if (lockMode === LockModes.UNLOCK)
setLockMode(LockModes.LOCK);
else
setLockMode(LockModes.UNLOCK);
};
/// MODULATOR ARRAYS /// MODULATOR ARRAYS
const [userDefinedWave, setUserDefinedWave] = React.useState(Array(50).fill(0));
const [modVisibleArr, setModVisibleArr] = React.useState(initVisArr); const [modVisibleArr, setModVisibleArr] = React.useState(initVisArr);
const [modTypeArr, setModTypeArr] = React.useState(Array(MAXLFOS).fill('LFO'));
const [modInstanceNumArr, setModInstanceNumArr] = React.useState(Array(MAXLFOS).fill('1')); const [modInstanceNumArr, setModInstanceNumArr] = React.useState(Array(MAXLFOS).fill('1'));
const [modCenterVals, setModCenterVals] = React.useState({'1':{}, '2':{}, '3':{}, '4':{}}); const [modCenterVals, setModCenterVals] = React.useState({'1':{}, '2':{}, '3':{}, '4':{}});
const [ticks, setTicks] = React.useState(0); const [bpm, setBpm] = React.useState(100);
const [beatsInMeasure, setBeatsInMeasure] = React.useState(4); const [beatsInMeasure, setBeatsInMeasure] = React.useState(4);
const [noiseTypeArr, setNoiseTypeArr] = React.useState(Array(MAXLFOS).fill('Sine Int.'));
const [shapeArr, setShapeArr] = React.useState(Array(MAXLFOS).fill('Sine')); const [shapeArr, setShapeArr] = React.useState(Array(MAXLFOS).fill('Sine'));
const [djParamArr, setDjParamArr] = React.useState(Array(MAXLFOS).fill('NONE')); const [djParamArr, setDjParamArr] = React.useState(Array(MAXLFOS).fill('NONE'));
@@ -79,15 +62,11 @@ function MasterLfoHandler(){
const [minArr, setMinArr] = React.useState(Array(MAXLFOS).fill('0')); const [minArr, setMinArr] = React.useState(Array(MAXLFOS).fill('0'));
const [maxArr, setMaxArr] = React.useState(Array(MAXLFOS).fill('1')); const [maxArr, setMaxArr] = React.useState(Array(MAXLFOS).fill('1'));
const [initPhaseArr, setInitPhaseArr] = React.useState(Array(MAXLFOS).fill('0')); const [phaseArr, setPhaseArr] = React.useState(Array(MAXLFOS).fill('0'));
const [lastPhaseArr, setLastPhaseArr] = React.useState(Array(MAXLFOS).fill(0));
const [cachedNoiseValueArr, setCachedNoiseValueArr] = React.useState(Array(MAXLFOS).fill([0, 0]));
const allModArrays = [modVisibleArr, modInstanceNumArr, shapeArr, djParamArr, freqArr, minArr, maxArr, phaseArr];
const allModSetters = [setModVisibleArr, setModInstanceNumArr, setShapeArr, setDjParamArr, setFreqArr, setMinArr, setMaxArr, setPhaseArr];
const allModArrays = [modVisibleArr, modTypeArr, modInstanceNumArr, shapeArr, noiseTypeArr, djParamArr, freqArr, minArr, maxArr, initPhaseArr, lastPhaseArr, cachedNoiseValueArr]; const modBlankVals = [true, '1', SHAPETYPES[0], MODPARAMOPTIONS[0], '1hz', '0', '1', '0'];
const allModSetters = [setModVisibleArr, setModTypeArr, setModInstanceNumArr, setShapeArr, setNoiseTypeArr, setDjParamArr, setFreqArr, setMinArr, setMaxArr, setInitPhaseArr, lastPhaseArr, cachedNoiseValueArr];
const modBlankVals = [true, 'LFO', '1', SHAPETYPES[0], MODPARAMOPTIONS[0], "Sine Int.", '1hz', '0', '1', '0', 0, [0, 0]];
/// ENUMERATOR ARRAYS /// ENUMERATOR ARRAYS
@@ -131,6 +110,7 @@ function MasterLfoHandler(){
React.useEffect(() => { React.useEffect(() => {
function handleLoad(event) { function handleLoad(event) {
window.max.getDict(event.detail, (dict) => { window.max.getDict(event.detail, (dict) => {
for (let i = 0; i<allModArrays.length; i++) { for (let i = 0; i<allModArrays.length; i++) {
@@ -144,6 +124,8 @@ function MasterLfoHandler(){
for (let i = 0; i<allEnumMats.length; i++) { for (let i = 0; i<allEnumMats.length; i++) {
allEnumMatSetters[i](dict.data.enumMats[i]); allEnumMatSetters[i](dict.data.enumMats[i]);
} }
setModCenterVals(dict.data.modCenters);
}) })
} }
@@ -151,7 +133,8 @@ function MasterLfoHandler(){
let data = { let data = {
'modArrays' : allModArrays, 'modArrays' : allModArrays,
'enumArrays' : allEnumArrays, 'enumArrays' : allEnumArrays,
'enumMats' : allEnumMats 'enumMats' : allEnumMats,
'modCenters': modCenterVals
} }
window.max.setDict(event.detail, {"data" : data}); window.max.setDict(event.detail, {"data" : data});
window.max.outlet("saved"); window.max.outlet("saved");
@@ -218,31 +201,25 @@ function MasterLfoHandler(){
function handleTick(event) { function handleTick(event) {
let time = (Date.now() - firstUpdateTime) / 1000; let time = (Date.now() - firstUpdateTime) / 1000;
let noiseData = {lastPhaseArr, setLastPhaseArr, cachedNoiseValueArr, setCachedNoiseValueArr, noiseTypeArr}; operateModulators(modVisibleArr, modInstanceNumArr, djParamArr, modCenterVals, freqArr, minArr, maxArr, shapeArr, phaseArr, time, bpm, beatsInMeasure);
operateModulators(modVisibleArr, modTypeArr, modInstanceNumArr, djParamArr, modCenterVals, freqArr, minArr, maxArr, shapeArr, initPhaseArr, noiseData, userDefinedWave, time, beatsInMeasure, ticks); }
function handleBpm(event) {
setBpm(event.detail);
} }
function handleTimeSig(event) { function handleTimeSig(event) {
setBeatsInMeasure(parseFloat(event.detail[0]) * parseFloat(event.detail[1])/ 4); setBeatsInMeasure(parseFloat(event.detail[0]) * parseFloat(event.detail[1])/ 4);
} }
function handleChangeUserWave(event){
setUserDefinedWave(event.detail);
}
function handleMaxTicks(event){
setTicks(event.detail);
}
window.addEventListener('loadDict', handleLoad); window.addEventListener('loadDict', handleLoad);
window.addEventListener('saveDict', handleSave); window.addEventListener('saveDict', handleSave);
window.addEventListener('tick', handleTick); window.addEventListener('tick', handleTick);
window.addEventListener('param', handleParam); window.addEventListener('param', handleParam);
window.addEventListener('enum', handleEnum); window.addEventListener('enum', handleEnum);
window.addEventListener('tempo', handleBpm);
window.addEventListener('timesig', handleTimeSig); window.addEventListener('timesig', handleTimeSig);
window.addEventListener('userWave', handleChangeUserWave);
window.addEventListener('maxTicks', handleMaxTicks);
return () => { return () => {
window.removeEventListener('loadDict', handleLoad); window.removeEventListener('loadDict', handleLoad);
@@ -250,11 +227,10 @@ function MasterLfoHandler(){
window.removeEventListener('tick', handleTick); window.removeEventListener('tick', handleTick);
window.removeEventListener('param', handleParam); window.removeEventListener('param', handleParam);
window.removeEventListener('enum', handleEnum); window.removeEventListener('enum', handleEnum);
window.removeEventListener('tempo', handleBpm);
window.removeEventListener('timesig', handleTimeSig); window.removeEventListener('timesig', handleTimeSig);
window.removeEventListener('userWave', handleChangeUserWave);
window.removeEventListener('maxTicks', handleMaxTicks);
}; };
}, [...allModArrays, ...allEnumArrays, ...allEnumMats, userDefinedWave, modCenterVals, render, beatsInMeasure, ticks]); }, [...allModArrays, ...allEnumArrays, ...allEnumMats, modCenterVals, render, bpm, beatsInMeasure]);
function CheckLinked(inst, param, checkInstArr, checkParamArr){ function CheckLinked(inst, param, checkInstArr, checkParamArr){
@@ -275,17 +251,10 @@ function MasterLfoHandler(){
modContents.push( modContents.push(
e(LfoRow, { e(LfoRow, {
locked : lockMode,
instanceNum : modInstanceNumArr[i], instanceNum : modInstanceNumArr[i],
setInstanceNum: CreateParamChanger(modInstanceNumArr, setModInstanceNumArr, i), setInstanceNum: CreateParamChanger(modInstanceNumArr, setModInstanceNumArr, i),
type: modTypeArr[i],
setType: CreateParamChanger(modTypeArr, setModTypeArr, i),
shape: shapeArr[i], shape: shapeArr[i],
setShape: CreateParamChanger(shapeArr, setShapeArr, i), setShape: CreateParamChanger(shapeArr, setShapeArr, i),
noise: noiseTypeArr[i],
setNoise: CreateParamChanger(noiseTypeArr, setNoiseTypeArr, i),
djParam: djParamArr[i], djParam: djParamArr[i],
setDjParam: CreateParamChanger(djParamArr, setDjParamArr, i), setDjParam: CreateParamChanger(djParamArr, setDjParamArr, i),
centerVals: modCenterVals, centerVals: modCenterVals,
@@ -301,15 +270,13 @@ function MasterLfoHandler(){
max: maxArr[i], max: maxArr[i],
setMax: CreateParamChanger(maxArr, setMaxArr, i), setMax: CreateParamChanger(maxArr, setMaxArr, i),
phase: initPhaseArr[i], phase: phaseArr[i],
setPhase: CreateParamChanger(initPhaseArr, setInitPhaseArr, i), setPhase: CreateParamChanger(phaseArr, setPhaseArr, i),
visible: modVisibleArr[i], visible: modVisibleArr[i],
linked: CheckLinked(modInstanceNumArr[i], djParamArr[i], enumInstanceNumArr, enumDjParamArr), linked: CheckLinked(modInstanceNumArr[i], djParamArr[i], enumInstanceNumArr, enumDjParamArr),
addLfo: () => { addLfo: () => {
if (id < MAXLFOS - 1){ if (id < MAXLFOS - 1){
if (modVisibleArr[id + 1]){ if (modVisibleArr[id + 1]){
let emptyIndex = modVisibleArr.findIndex((item) => !item); let emptyIndex = modVisibleArr.findIndex((item) => !item);
@@ -325,7 +292,6 @@ function MasterLfoHandler(){
} }
} }
else { else {
log("adding lfo");
for (var j = 0; j < allModArrays.length; j++){ // no space below, easy. for (var j = 0; j < allModArrays.length; j++){ // no space below, easy.
let array = allModArrays[j]; let array = allModArrays[j];
array[id + 1] = modBlankVals[j]; array[id + 1] = modBlankVals[j];
@@ -357,7 +323,7 @@ function MasterLfoHandler(){
enumContents.push( enumContents.push(
e(EnumeratorRow, { e(EnumeratorRow, {
index: i, index: i,
locked : lockMode,
instanceNum : enumInstanceNumArr[i], instanceNum : enumInstanceNumArr[i],
setInstanceNum: CreateParamChanger(enumInstanceNumArr, setEnumInstanceNumArr, i), setInstanceNum: CreateParamChanger(enumInstanceNumArr, setEnumInstanceNumArr, i),
enumItems: enumItemCounts[i], enumItems: enumItemCounts[i],
@@ -439,19 +405,8 @@ function MasterLfoHandler(){
labels = ENUMERATORLABELS; labels = ENUMERATORLABELS;
} }
let lockClass;
if (lockMode == LockModes.LOCK){
lockClass = 'lock';
}
else {
lockClass = 'lock unlocked';
}
return e('div', null, return e('div', null,
e('div', {className: 'container'}, e(Switch, {ontoggle: toggleViewMode}, null),
e(Switch, {ontoggle: toggleViewMode}, null),
e('span', {className: lockClass, onClick: toggleLockMode}, null)),
e('h5', null, title), e('h5', null, title),
e('ul', null, ...labels.map(x => ListItem(Label(x)))), e('ul', null, ...labels.map(x => ListItem(Label(x)))),
e('div', {id: 'grid'}, ...grid) e('div', {id: 'grid'}, ...grid)
@@ -472,24 +427,14 @@ if (!DEBUG){
window.dispatchEvent(new CustomEvent('param', {'detail' : [inst, paramName, val]})); window.dispatchEvent(new CustomEvent('param', {'detail' : [inst, paramName, val]}));
}); });
window.max.bindInlet("tempo", (val) => {
window.dispatchEvent(new CustomEvent('tempo', {'detail' : val}));
});
window.max.bindInlet("timesig", (top, bottom) => { window.max.bindInlet("timesig", (top, bottom) => {
window.dispatchEvent(new CustomEvent('timesig', {'detail' : [top, bottom]})); window.dispatchEvent(new CustomEvent('timesig', {'detail' : [top, bottom]}));
}); });
window.max.bindInlet("ticks", (val) => {
window.dispatchEvent(new CustomEvent('maxTicks', {'detail' : val}));
});
window.max.bindInlet("userWave", (...points) => {
window.dispatchEvent(new CustomEvent('userWave', {'detail' : points}));
});
/* window.max.binInlet("userWave", (...points) => {
window.dispatchEvent(new CustomEvent('userWave', {'detail' : [points]}));
log("received user points");
}); */
setInterval(() => { setInterval(() => {
window.dispatchEvent(new CustomEvent('tick')); window.dispatchEvent(new CustomEvent('tick'));
}, 200); }, 200);

View File

@@ -2,10 +2,7 @@
// MODULATORS // MODULATORS
///////////////////////// /////////////////////////
var SHAPETYPES = ["Sine", "SawUp", "SawDown", "Tri", "Square"];
var TYPEOPTIONS = ["LFO", "Noise"];
var SHAPETYPES = ["Sine", "SawUp", "SawDown", "Tri", "Square", "Custom"];
var NOISETYPES = ["Rand", "Line Int.", "Sine Int."]
var INSTANCEOPTIONS = ["1", "2", "3", "4"]; var INSTANCEOPTIONS = ["1", "2", "3", "4"];
@@ -13,11 +10,6 @@ const MODPARAMOPTIONS = ["NONE", "stream", "pulse_length", "eventfulness", "even
"harmoniclarity", "melodic_cohesion", "melody_scope", "tonic_pitch", "pitch_center", "pitch_range", "dynamics", "harmoniclarity", "melodic_cohesion", "melody_scope", "tonic_pitch", "pitch_center", "pitch_range", "dynamics",
"attenuation", "chordal_weight", "tonality-profile", "ostinato-buffer", "ostinato", "meter", "scale"]; "attenuation", "chordal_weight", "tonality-profile", "ostinato-buffer", "ostinato", "meter", "scale"];
const PhaseTypes = Object.freeze({
MUSICAL: Symbol("musical"),
TIME: Symbol("time")
});
function ControlType(){ function ControlType(){
return e('select', {className: 'control-type'}, Option("LFO")); return e('select', {className: 'control-type'}, Option("LFO"));
} }
@@ -31,20 +23,11 @@ function LfoRow(props){
if (!center) if (!center)
center = 0; center = 0;
let typeOption = null;
if (props.type == "LFO"){
typeOption = ListItem(DropDown({locked:props.locked, onChange: props.setShape, value:props.shape, options: SHAPETYPES}));
}
else if (props.type == "Noise"){
typeOption = ListItem(DropDown({locked:props.locked, onChange: props.setNoise, value:props.noise, options: NOISETYPES}));
}
let content = e('ul', {className: 'lfo-item'}, let content = e('ul', {className: 'lfo-item'},
ListItem(DropDown({locked:props.locked, onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})), ListItem(DropDown({onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
ListItem(DropDown({locked:props.locked, options: TYPEOPTIONS, onChange: props.setType, value:props.type})), ListItem(ControlType()),
typeOption, ListItem(DropDown({onChange: props.setShape, value:props.shape, options: SHAPETYPES})),
ListItem(DropDown({locked:props.locked, onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})), ListItem(DropDown({onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
ListItem(e("input", {onChange:props.setFreq, value:props.freq, className:"timeInput"}, null)), ListItem(e("input", {onChange:props.setFreq, value:props.freq, className:"timeInput"}, null)),
ListItem(e(NumberBox, {onChange:props.setMin, value:props.min, step:0.1}, null)), ListItem(e(NumberBox, {onChange:props.setMin, value:props.min, step:0.1}, null)),
ListItem(e(NumberBox, {onChange:props.setMax, value:props.max, step:0.1}, null)), ListItem(e(NumberBox, {onChange:props.setMax, value:props.max, step:0.1}, null)),
@@ -52,8 +35,8 @@ function LfoRow(props){
ListItem(e(NumberBox, {onChange:props.setPhase, value:props.phase, step:0.1}, null)), ListItem(e(NumberBox, {onChange:props.setPhase, value:props.phase, step:0.1}, null)),
ListItem(e("div", {className:"base-val"}, center.toString())), ListItem(e("div", {className:"base-val"}, center.toString())),
ListItem(e("input", {type: 'range', min: 0, max: 1, step: 0.01, readonly: true, id: `slider-${props.instanceNum}-${props.djParam}`})), ListItem(e("input", {type: 'range', min: 0, max: 1, step: 0.01, readonly: true, id: `slider-${props.instanceNum}-${props.djParam}`})),
ListItem(e(Button, {text:'+', onClick: props.addLfo, locked: props.locked}, null)), ListItem(e(Button, {text:'+', onClick: props.addLfo}, null)),
ListItem(e(Button, {text:'-', onClick: props.removeLfo, locked: props.locked}, null)), ListItem(e(Button, {text:'-', onClick: props.removeLfo}, null)),
ListItem(e("div", {className:"linked"}, linkedText)), ListItem(e("div", {className:"linked"}, linkedText)),
); );
if (props.visible){ if (props.visible){
@@ -61,7 +44,7 @@ function LfoRow(props){
}; };
} }
function indexWave(type, phase, userDefinedWave){ function indexWave(type, phase){
switch (type){ switch (type){
case "Sine": case "Sine":
return (Math.sin(phase * Math.PI * 2) / 2) + 0.5; return (Math.sin(phase * Math.PI * 2) / 2) + 0.5;
@@ -73,12 +56,10 @@ function indexWave(type, phase, userDefinedWave){
return phase > 0.5? (1-phase) * 2 : phase * 2; return phase > 0.5? (1-phase) * 2 : phase * 2;
case "Square": case "Square":
return +(phase > 0.5); return +(phase > 0.5);
case "Custom":
return parseFloat(userDefinedWave[Math.floor(phase * 50)]) / 127
} }
} }
function operateModulators(visibleArr, typeArr, instanceNumArr, paramNames, centers, freqs, mins, maxs, waveTypes, phaseArr, noiseData, userDefinedWave, currTime, beatsInMeasure, ticks){ function operateModulators(visibleArr, instanceNumArr, paramNames, centers, freqs, mins, maxs, waveTypes, phaseArr, currTime, bpm, beatsInMeasure){
for (let i=0; i<paramNames.length; i++){ for (let i=0; i<paramNames.length; i++){
if (visibleArr[i]){ if (visibleArr[i]){
@@ -88,124 +69,54 @@ function operateModulators(visibleArr, typeArr, instanceNumArr, paramNames, cent
if (centers[inst].hasOwnProperty(name)){ if (centers[inst].hasOwnProperty(name)){
center = centers[inst][name]; center = centers[inst][name];
} }
let output = operateModulator(center, inst, freqs[i], mins[i], maxs[i], waveTypes[i], phaseArr, i, name, currTime, bpm, beatsInMeasure);
let output = 0;
if (typeArr[i] == "LFO")
output = operateLFO(center, inst, freqs[i], mins[i], maxs[i], waveTypes[i], phaseArr, i, userDefinedWave, name, currTime, beatsInMeasure, ticks);
else
output = operateNoise(center, inst, freqs[i], mins[i], maxs[i], waveTypes[i], phaseArr, i, name, noiseData, currTime, beatsInMeasure, ticks);
if (name !== "NONE") if (name !== "NONE")
window.dispatchEvent(new CustomEvent('enum', {'detail' : [inst, name, output]})); window.dispatchEvent(new CustomEvent('enum', {'detail' : [inst, name, output]}));
} }
} }
} }
function operateLFO(center, inst, timeBaseStr, min, max, waveType, phaseArr, phaseIndex, userDefinedWave, name, currTime, beatsInMeasure, maxTicks){ function operateModulator(center, inst, freq, min, max, waveType, phaseArr, phaseI, name, currTime, bpm, beatsInMeasure){
let amp = parseFloat(max) - parseFloat(min); let amp = parseFloat(max) - parseFloat(min);
let phaseType;
let timeBase;
[timeBase, phaseType] = parseLfoTime(timeBaseStr, beatsInMeasure); freq = parseLfoTime(freq, bpm, beatsInMeasure);
let phase; let phase = (currTime * freq + parseFloat(phaseArr[phaseI])) % 1.00;
let unscaled = indexWave(waveType, phase);
if (phaseType === PhaseTypes.TIME)
phase = (currTime * timeBase + parseFloat(phaseArr[phaseIndex])) % 1.00;
else if (phaseType === PhaseTypes.MUSICAL)
phase = (maxTicks % timeBase) / timeBase;
let unscaled = indexWave(waveType, phase, userDefinedWave);
syncDisplay(inst, name, unscaled);
return unscaled * amp + center + parseFloat(min);
}
function syncDisplay(inst, name, val) {
let el = document.getElementById(`slider-${inst}-${name}`); let el = document.getElementById(`slider-${inst}-${name}`);
if (el) if (el)
el.value = val; el.value = unscaled;
}
// For now, we're only using sine interpolation
function operateNoise(center, inst, timeBaseStr, min, max, waveType, phaseArr, index, name, noiseData, currTime, beatsInMeasure, maxTicks){
let amp = parseFloat(max) - parseFloat(min);
let phaseType;
let timeBase;
let noiseType = noiseData.noiseTypeArr[index];
[timeBase, phaseType] = parseLfoTime(timeBaseStr, beatsInMeasure);
let phase;
if (phaseType === PhaseTypes.TIME)
phase = (currTime * timeBase + parseFloat(phaseArr[index])) % 1.00;
else if (phaseType === PhaseTypes.MUSICAL)
phase = (maxTicks % timeBase) / timeBase;
if (noiseData.cachedNoiseValueArr[index][0] == 0 || noiseData.lastPhaseArr[index] > phase){ // occurs if the phase reset to 0 or at the very start
noiseData.cachedNoiseValueArr[index][0] = noiseData.cachedNoiseValueArr[index][1];
if (noiseData.cachedNoiseValueArr[index][0] == 0)
noiseData.cachedNoiseValueArr[index][0] = center;
noiseData.cachedNoiseValueArr[index][1] = Math.random();
noiseData.setCachedNoiseValueArr(noiseData.cachedNoiseValueArr);
}
noiseData.lastPhaseArr[index] = phase;
noiseData.setLastPhaseArr(noiseData.lastPhaseArr);
let sinePhase = (Math.sin(Math.PI + Math.PI * phase) + 1) / 2
//let unscaled = (noiseData.cachedNoiseValueArr[index][1] - noiseData.cachedNoiseValueArr[index][0]) * sinePhase + noiseData.cachedNoiseValueArr[index][0];
let unscaled = interpolateNoise(noiseData.noiseTypeArr[index], noiseData.cachedNoiseValueArr[index][0], noiseData.cachedNoiseValueArr[index][1], phase);
syncDisplay(inst, name, unscaled);
return unscaled * amp + center + parseFloat(min); return unscaled * amp + center + parseFloat(min);
} }
function interpolateNoise(type, cachedVal1, cachedVal2, phase){
let interpVal;
switch (type){ function parseLfoTime(lfoTime, bpm, beatsInMeasure){
case "Sine Int.":
interpVal = (Math.sin(Math.PI + Math.PI * phase) + 1) / 2;
break;
case "Rand":
interpVal = 0;
break;
case "Line Int.":
interpVal = phase;
break;
}
return (cachedVal2 - cachedVal1) * interpVal + cachedVal1;
}
// actual returns the period for musical timing, to avoid floating point errors
function parseLfoTime(lfoTime, beatsInMeasure){
if (lfoTime.slice(-2) == "hz"){ if (lfoTime.slice(-2) == "hz"){
return [parseFloat(lfoTime.slice(0, -2)), PhaseTypes.TIME]; return parseFloat(lfoTime.slice(0, -2));
} }
else if (lfoTime.slice(-2) == "ms"){ else if (lfoTime.slice(-2) == "ms"){
return [1000 / parseFloat(lfoTime.slice(0, -2)), PhaseTypes.TIME]; return 1000 / parseFloat(lfoTime.slice(0, -2));
} }
else if (lfoTime.slice(-1) == "s"){ else if (lfoTime.slice(-1) == "s"){
return [1 / parseFloat(lfoTime.slice(0, -1)), PhaseTypes.TIME]; return 1 / parseFloat(lfoTime.slice(0, -1));
} }
else if ((lfoTime.match(/:/g) || []).length == 2){ else if ((lfoTime.match(/:/g) || []).length == 2){
return [1 / moment.duration(lfoTime).asSeconds(), PhaseTypes.TIME]; return 1 / moment.duration(lfoTime).asSeconds();
} }
else if ((lfoTime.match(/\./g) || []).length == 2){ else if ((lfoTime.match(/\./g) || []).length == 2){
return [musicalTimingToFreq(...lfoTime.split('.'), beatsInMeasure), PhaseTypes.MUSICAL]; return musicalTimingToFreq(...lfoTime.split('.'), bpm, beatsInMeasure)
} }
else { else {
return [0, PhaseTypes.TIME]; return 0;
} }
} }
function musicalTimingToFreq(bars, beats, ticks, beatsInMeasure){ function musicalTimingToFreq(bars, beats, ticks, bpm, beatsInMeasure){
let totalTicks = (parseFloat(bars) * parseFloat(beatsInMeasure) + parseFloat(beats)) * 480 + parseFloat(ticks); let totalTicks = (parseFloat(bars) * parseFloat(beatsInMeasure) + beats) * 480 + parseFloat(ticks);
return totalTicks; let tpm = bpm * 480;
let cyclesPerMinute = tpm / totalTicks;
let hz = cyclesPerMinute / 60;
return hz;
} }