14 Commits

Author SHA1 Message Date
c3656f182c Center point saving 2024-08-06 13:59:15 +02:00
446713d5d3 cleaned up example patch 2024-08-05 16:54:59 +02:00
2369ed5ddf instance numbering 2024-08-05 15:32:06 +02:00
071a78dc20 separate css 2024-08-05 10:08:29 +02:00
1d8610fa5f musical timing 2024-07-31 17:02:09 +02:00
ebd09dfd26 parsing for HZ 2024-07-30 15:53:35 +02:00
13cddd8f03 linking indicator 2024-07-29 13:56:45 +02:00
1f3972fc6f bugfix for deenumeration and parsing 2024-07-29 12:10:59 +02:00
b860254884 range instead of amp 2024-07-29 11:56:40 +02:00
a4842b4865 save message 2024-07-29 11:19:18 +02:00
315a8df1a0 denumeration 2024-07-26 13:52:04 +02:00
f9a8c05955 unfinished de enumeration 2024-07-24 19:31:08 +02:00
8381daf468 min and max display 2024-07-23 15:59:56 +02:00
e50e4c1e0c example with djster 2024-07-23 11:07:20 +02:00
9 changed files with 3744 additions and 295 deletions

View File

@@ -1,3 +1,9 @@
function isNumeric(str) {
if (typeof str != "string") return false // we only process strings!
return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...
!isNaN(parseFloat(str)) // ...and ensure strings of whitespace fail
}
function DropDown(props) {
return e('select', {type: "number", onChange: props.onChange, value: props.value},
...props.options.map((item) => Option(item)));
@@ -33,12 +39,12 @@ function Switch(props){
e('span', {className: 'slider round'}, null))
}
function CreateParamChanger(arr, setArr, index, cb=() => {}){
function CreateParamChanger(arr, setArr, index, postCB=() => {}, preCB=(val) => val){
return (event) => {
let newArr = arr.slice();
newArr[index] = event.target.value;
newArr[index] = preCB(event.target.value);
setArr(newArr);
cb();
postCB();
log(`${index} ${event.target.value}`);
}
}

View File

@@ -17,21 +17,36 @@ function EnumeratorItems(index, enumBreakPoints, setEnumBreakPoints, enumNames,
}
function EnumeratorRow(props){
let linkedText = props.linked ? "<- mods" : "";
let content = e('ul', {className: 'lfo-item', id: `${props.djParam}-enum-row`},
ListItem(DropDown({onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
ListItem(DropDown({onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
ListItem(e(NumberBox, {onChange: props.setEnumItemCounts, step:1, value:props.enumItems, className: 'enum-count'}, 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).slice(0, props.enumItems * 2)),
ListItem(e(Button, {text:'+', onClick: props.addEnum}, null)),
ListItem(e(Button, {text:'-', onClick: props.removeEnum}, null))
ListItem(e(Button, {text:'-', onClick: props.removeEnum}, null)),
ListItem(e("div", {className:"linked"}, linkedText))
);
if (props.visible){
return content;
};
}
function denumerate(inval, count, keys, vals){
let output = inval;
for (let i=0; i < count; i++){
log(vals[i]);
if (inval == vals[i]){
output = (parseFloat(keys[i]) + parseFloat(keys[i+1])) / 2; // linear interpolate
}
}
return output;
}
function enumerate(name, inval, count, keys, vals){
function enumerate(name, inst, inval, count, keys, vals){
let output = "OUT OF RANGE";
for (let i=0; i < count + 1; i++){
if (inval <= keys[i]){
@@ -52,6 +67,6 @@ function enumerate(name, inval, count, keys, vals){
}
if (name !== "NONE")
window.max.outlet(name + " " + output);
window.max.outlet(inst + " " + name + " " + output);
}

2680
example-with-dj.maxpat Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
}
,
"classnamespace" : "box",
"rect" : [ 299.0, 99.0, 1220.0, 715.0 ],
"rect" : [ 112.0, 87.0, 1344.0, 869.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
@@ -40,25 +40,488 @@
"assistshowspatchername" : 0,
"boxes" : [ {
"box" : {
"id" : "obj-28",
"id" : "obj-31",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 45.0, 289.0, 104.0, 22.0 ],
"text" : "param 2 scale 0.5"
}
}
, {
"box" : {
"id" : "obj-3",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 45.0, 154.0, 131.0, 22.0 ],
"text" : "param 1 metriclarity 40"
}
}
, {
"box" : {
"id" : "obj-86",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 28.0, 473.0, 115.0, 22.0 ],
"text" : "param 4 meter \"3 4\""
}
}
, {
"box" : {
"id" : "obj-85",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 28.0, 361.5, 139.0, 22.0 ],
"text" : "param 3 attenuation 100"
}
}
, {
"box" : {
"id" : "obj-84",
"linecount" : 2,
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 493.0, 444.0, 161.0, 35.0 ],
"text" : "\"harmoniclarity 0.1955362124045653\""
"patching_rect" : [ 586.0, 713.0, 89.0, 35.0 ],
"text" : "harmoniclarity 20.2"
}
}
, {
"box" : {
"id" : "obj-80",
"linecount" : 2,
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 491.0, 713.0, 85.0, 35.0 ],
"text" : "event_length 70.2"
}
}
, {
"box" : {
"id" : "obj-78",
"linecount" : 2,
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 385.0, 715.0, 84.0, 35.0 ],
"text" : "metriclarity 69.626659"
}
}
, {
"box" : {
"id" : "obj-76",
"maxclass" : "newobj",
"numinlets" : 4,
"numoutlets" : 4,
"outlettype" : [ "", "", "", "" ],
"patching_rect" : [ 410.0, 671.0, 273.0, 22.0 ],
"text" : "routepass metriclarity event_length harmoniclarity"
}
}
, {
"box" : {
"id" : "obj-75",
"linecount" : 6,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 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"
}
}
, {
"box" : {
"id" : "obj-73",
"linecount" : 8,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 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. "
}
}
, {
"box" : {
"id" : "obj-72",
"linecount" : 4,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 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"
}
}
, {
"box" : {
"id" : "obj-66",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 480.5, 613.0, 32.0, 22.0 ],
"text" : "print"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 13.0,
"id" : "obj-63",
"maxclass" : "newobj",
"numinlets" : 5,
"numoutlets" : 5,
"outlettype" : [ "", "", "", "", "" ],
"patching_rect" : [ 626.0, 613.0, 81.0, 23.0 ],
"text" : "route 1 2 3 4"
}
}
, {
"box" : {
"id" : "obj-1",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 684.0, 146.0, 94.0, 22.0 ],
"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" : {
"id" : "obj-37",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 325.0, 17.0, 55.0, 22.0 ],
"text" : "del 1000"
}
}
, {
"box" : {
"id" : "obj-36",
"maxclass" : "newobj",
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 485.0, 40.0, 49.0, 22.0 ],
"text" : "r reload"
}
}
, {
"box" : {
"id" : "obj-34",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 200.0, 807.0, 51.0, 22.0 ],
"text" : "s reload"
}
}
, {
"box" : {
"id" : "obj-32",
"maxclass" : "preset",
"numinlets" : 1,
"numoutlets" : 5,
"outlettype" : [ "preset", "int", "preset", "int", "" ],
"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"
}
}
, {
"box" : {
"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", "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
}
}
}
}
,
"id" : "obj-25",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 4,
"outlettype" : [ "dictionary", "", "", "" ],
"patching_rect" : [ 773.0, 808.0, 166.0, 22.0 ],
"saved_object_attributes" : {
"embed" : 1,
"parameter_enable" : 0,
"parameter_mappable" : 0
}
,
"text" : "dict localStorage2 @embed 1",
"varname" : "dict"
}
}
, {
"box" : {
"id" : "obj-47",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 9,
"outlettype" : [ "int", "int", "float", "float", "float", "", "int", "float", "" ],
"patching_rect" : [ 744.815790414810181, 107.0, 103.0, 22.0 ],
"text" : "transport"
}
}
, {
"box" : {
"id" : "obj-40",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 980.368419170379639, 702.0, 22.0, 22.0 ],
"text" : "t b"
}
}
, {
"box" : {
"id" : "obj-38",
"maxclass" : "dict.view",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 1107.0, 573.0, 263.0, 384.0 ]
}
}
, {
"box" : {
"bubble" : 1,
"id" : "obj-30",
"linecount" : 4,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 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"
}
}
, {
"box" : {
"id" : "obj-22",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 22.0, 444.0, 115.0, 22.0 ],
"text" : "param 4 meter \"4 4\""
}
}
, {
"box" : {
"id" : "obj-41",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 949.0, 647.0, 156.0, 22.0 ],
"text" : "meter 3 4"
}
}
, {
"box" : {
"id" : "obj-39",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 824.0, 647.0, 101.0, 22.0 ],
"text" : "attenuation 100"
}
}
, {
"box" : {
"id" : "obj-35",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 662.0, 647.0, 157.0, 22.0 ],
"text" : "scale minor"
}
}
, {
"box" : {
"id" : "obj-27",
"maxclass" : "newobj",
"numinlets" : 3,
"numoutlets" : 3,
"outlettype" : [ "", "", "" ],
"patching_rect" : [ 423.5, 588.0, 133.0, 22.0 ],
"text" : "routepass saved debug"
}
}
, {
"box" : {
"id" : "obj-17",
"linecount" : 2,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 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"
}
}
, {
"box" : {
"id" : "obj-10",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 423.5, 552.0, 71.0, 22.0 ],
"text" : "fromsymbol"
}
}
, {
"box" : {
"id" : "obj-19",
"linecount" : 2,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 541.52631402015686, 69.0, 150.0, 20.0 ],
"text" : "self explanatory"
"patching_rect" : [ 548.52631402015686, 80.0, 150.0, 33.0 ],
"text" : "see below for why we use separate names..."
}
}
@@ -69,7 +532,7 @@
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 817.0, 45.0, 150.0, 47.0 ],
"patching_rect" : [ 781.0, 17.0, 150.0, 47.0 ],
"text" : "self explanatory. Warning-will overwrite whatever is saved."
}
@@ -77,25 +540,25 @@
, {
"box" : {
"id" : "obj-11",
"linecount" : 4,
"linecount" : 7,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 1039.0, 50.0, 150.0, 60.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"
}
}
, {
"box" : {
"bubble" : 1,
"id" : "obj-7",
"linecount" : 3,
"linecount" : 5,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 109.0, 285.0, 197.0, 47.0 ],
"presentation_linecount" : 3,
"text" : "This parameter is defined in the enumerators but not the modulators"
"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"
}
}
@@ -106,56 +569,46 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 146.0, 334.0, 94.0, 22.0 ],
"text" : "param scale 1.6"
}
}
, {
"box" : {
"id" : "obj-25",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 454.0, 27.5, 48.0, 22.0 ],
"text" : "del 200"
"patching_rect" : [ 45.0, 256.0, 104.0, 22.0 ],
"text" : "param 2 scale 1.6"
}
}
, {
"box" : {
"bubble" : 1,
"id" : "obj-24",
"linecount" : 3,
"linecount" : 4,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 89.0, 358.0, 254.0, 47.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"
}
}
, {
"box" : {
"bubble" : 1,
"id" : "obj-23",
"linecount" : 3,
"linecount" : 4,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 115.0, 201.0, 197.0, 47.0 ],
"text" : "This parameter is defined in the modulators, and when sent will act as the low value for that LFO"
"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"
}
}
, {
"box" : {
"id" : "obj-21",
"linecount" : 10,
"linecount" : 11,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 89.0, 463.0, 254.0, 141.0 ],
"text" : "The operation runs\n\nInput > 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"
"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"
}
}
@@ -166,8 +619,8 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 135.0, 259.0, 121.0, 22.0 ],
"text" : "param metriclarity 40"
"patching_rect" : [ 45.0, 180.0, 131.0, 22.0 ],
"text" : "param 1 metriclarity 20"
}
}
@@ -178,8 +631,8 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 115.0, 409.0, 129.0, 22.0 ],
"text" : "param attenuation 200"
"patching_rect" : [ 28.0, 331.0, 139.0, 22.0 ],
"text" : "param 3 attenuation 200"
}
}
@@ -190,35 +643,26 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 438.52631402015686, 69.0, 101.0, 22.0 ],
"text" : "load localStorage"
"patching_rect" : [ 438.52631402015686, 69.0, 108.0, 22.0 ],
"text" : "load localStorage2"
}
}
, {
"box" : {
"data" : {
"data" : {
"enumArrays" : [ [ 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "2", 2, 2, 2, "2", "2", "2", "2", "2", "2" ], [ "event_length", "meter", "stream", "scale", "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 ] ], [ [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "3 4", "7 8", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "0", "1", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "pentatonic", "major", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "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 ], [ "Sine", "SawUp", "SawDown", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine" ], [ "metriclarity", "stream", "meter", "harmoniclarity", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation" ], [ "0.6", "0.3", "0.1", "0.6", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "30", "2", "2", "1", "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" ] ]
}
}
,
"id" : "obj-4",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 4,
"outlettype" : [ "dictionary", "", "", "" ],
"patching_rect" : [ 22.0, 102.0, 159.0, 22.0 ],
"patching_rect" : [ 980.368419170379639, 726.0, 97.0, 22.0 ],
"saved_object_attributes" : {
"embed" : 1,
"embed" : 0,
"parameter_enable" : 0,
"parameter_mappable" : 0
}
,
"text" : "dict localStorage @embed 1"
"text" : "dict localStorage"
}
}
@@ -233,28 +677,16 @@
"text" : "required due to the asynchronous operation"
}
}
, {
"box" : {
"id" : "obj-3",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 374.157894849777222, 27.5, 55.0, 22.0 ],
"text" : "del 1000"
}
}
, {
"box" : {
"id" : "obj-45",
"linecount" : 5,
"linecount" : 8,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 31.0, 18.0, 150.0, 74.0 ],
"text" : "Storage for the matrix. Unfortunately, jsweb dictionary handling isn't great, so we can't use it like a native dict object"
"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"
}
}
@@ -301,7 +733,7 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 438.52631402015686, 115.0, 643.105266809463501, 318.0 ],
"patching_rect" : [ 402.0, 173.0, 838.631580829620361, 368.0 ],
"rendermode" : 0,
"url" : "file://lfogui.html"
}
@@ -309,6 +741,20 @@
}
],
"lines" : [ {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-1", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-27", 0 ],
"source" : [ "obj-10", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-12", 0 ]
@@ -338,7 +784,7 @@
}
, {
"patchline" : {
"destination" : [ "obj-28", 1 ],
"destination" : [ "obj-10", 0 ],
"source" : [ "obj-2", 0 ]
}
@@ -353,7 +799,7 @@
}
, {
"patchline" : {
"destination" : [ "obj-3", 0 ],
"destination" : [ "obj-37", 0 ],
"order" : 0,
"source" : [ "obj-20", 0 ]
}
@@ -361,8 +807,64 @@
}
, {
"patchline" : {
"destination" : [ "obj-15", 0 ],
"source" : [ "obj-25", 0 ]
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-22", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-25", 0 ],
"source" : [ "obj-26", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-40", 0 ],
"source" : [ "obj-27", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-63", 0 ],
"source" : [ "obj-27", 2 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-66", 0 ],
"source" : [ "obj-27", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-3", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-31", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-34", 0 ],
"source" : [ "obj-32", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-16", 0 ],
"source" : [ "obj-36", 0 ]
}
}
@@ -370,15 +872,52 @@
"patchline" : {
"destination" : [ "obj-16", 0 ],
"order" : 1,
"source" : [ "obj-3", 0 ]
"source" : [ "obj-37", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-47", 0 ],
"order" : 0,
"source" : [ "obj-37", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-25", 0 ],
"order" : 1,
"source" : [ "obj-4", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-38", 0 ],
"order" : 0,
"source" : [ "obj-3", 0 ]
"source" : [ "obj-4", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-4", 0 ],
"source" : [ "obj-40", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-1", 0 ],
"source" : [ "obj-47", 5 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-52", 0 ],
"source" : [ "obj-47", 4 ]
}
}
@@ -388,6 +927,62 @@
"source" : [ "obj-5", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-52", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-35", 1 ],
"source" : [ "obj-63", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-39", 1 ],
"source" : [ "obj-63", 2 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-41", 1 ],
"source" : [ "obj-63", 3 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-76", 0 ],
"source" : [ "obj-63", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-78", 1 ],
"source" : [ "obj-76", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-80", 1 ],
"source" : [ "obj-76", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-84", 1 ],
"source" : [ "obj-76", 2 ]
}
}
, {
"patchline" : {
@@ -395,6 +990,20 @@
"source" : [ "obj-8", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-85", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-86", 0 ]
}
}
],
"dependency_cache" : [ ],

181
lfogui.css Normal file
View File

@@ -0,0 +1,181 @@
html,
body {
width: 100%;
height: 100%;
margin: 0px;
border: 0;
overflow: hidden; /* Disable scrollbars */
display: block; /* No floating content on sides */
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333333;
}
li {
float: left;
}
input[type=number] {
width: 50px;
margin: 0;
padding: 0;
}
input[type=text] {
width: 60px;
margin: 0;
padding: 0;
font-weight: bold;
}
.timeInput {
width: 80px;
margin: 0;
padding: 0;
}
#matrix {
background-color: aquamarine;
height: 100%;
width: 100%;
}
.numbox-unclicked {
user-select: none;
border: solid;
font-size: 12vw;
}
.numbox-clicked {
user-select: none;
border : solid;
font-size: 12vw;
}
.param-input-label {
width: 93%;
font-size: 5vw;
}
.lfo-input-label {
width: 40%;
font-size: 5vw;
}
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 30px;
height: 17px;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 13px;
width: 13px;
left: 2px;
bottom: 2px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(13px);
-ms-transform: translateX(13px);
transform: translateX(13px);
}
/* Rounded sliders */
.slider.round {
border-radius: 17px;
}
.slider.round:before {
border-radius: 50%;
}
h5 {
margin: 0;
padding: 0;
}
.enum-count {
background-color: aquamarine;
}
.label {
background-color: aliceblue;
padding: 0 4px 0 4px;
margin: 0 2px 0 2px;
border-color: #333333;
border-width: 1px;
}
.base-val {
background-color: lightgray;
border-color: #333333;
border-width: 1px;
width: 50px;
margin-left: 2px;
margin-top: 1px;
}
.linked {
color: red;
border-width: 1px;
width: 50px;
font-size: small;
margin-left: 2px;
margin-top: 5px;
}
@keyframes pulse-animation {
0% {
color: black;
}
100% {
color: red;
}
}
#pulse {
animation: pulse-animation 0.2s normal;
}

View File

@@ -7,167 +7,7 @@
-->
<head>
<style>
html,
body {
width: 100%;
height: 100%;
margin: 0px;
border: 0;
overflow: hidden; /* Disable scrollbars */
display: block; /* No floating content on sides */
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333333;
}
li {
float: left;
}
input[type=number] {
width: 50px;
margin: 0;
padding: 0;
}
input[type=text] {
width: 60px;
margin: 0;
padding: 0;
font-weight: bold;
}
#matrix {
background-color: aquamarine;
height: 100%;
width: 100%;
}
.numbox-unclicked {
user-select: none;
border: solid;
font-size: 12vw;
}
.numbox-clicked {
user-select: none;
border : solid;
font-size: 12vw;
}
.param-input-label {
width: 93%;
font-size: 5vw;
}
.lfo-input-label {
width: 40%;
font-size: 5vw;
}
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 30px;
height: 17px;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 13px;
width: 13px;
left: 2px;
bottom: 2px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(13px);
-ms-transform: translateX(13px);
transform: translateX(13px);
}
/* Rounded sliders */
.slider.round {
border-radius: 17px;
}
.slider.round:before {
border-radius: 50%;
}
h5 {
margin: 0;
padding: 0;
}
.enum-count {
background-color: aquamarine;
}
.label {
background-color: aliceblue;
padding: 0 4px 0 4px;
margin: 0 2px 0 2px;
border-color: #333333;
border-width: 1px;
}
@keyframes pulse-animation {
0% {
color: black;
}
100% {
color: red;
}
}
#pulse {
animation: pulse-animation 0.2s normal;
}
</style>
<link rel="stylesheet" href="./lfogui.css">
</head>
<body>
@@ -175,6 +15,7 @@
<script src="./react.js"></script>
<script src="./react-dom.js"></script>
<script src="./moment.js"></script>
<script src="./common.js"></script>
<script src="./enums.js"></script>
<script src="./modulators.js"></script>

142
lfogui.js
View File

@@ -4,7 +4,7 @@ var log;
if (DEBUG)
log = console.log;
else
log = window.max.outlet;
log = (msg) => {window.max.outlet("debug " + msg)};
const e = React.createElement;
@@ -24,8 +24,10 @@ const ViewModes = Object.freeze({
var modPhases = Array(MAXLFOS).fill(0);
var firstUpdateTime = Date.now();
const MODULATORLABELS = ["-type-", "---shape---", "-------param-------", "--freq--", "--amp--", "--phase--"];
const ENUMERATORLABELS = ["---parameter---", "-# points-"];
const MODULATORLABELS = ["inst", "-type-", "---shape---", "-------param-------", "--timebase--", "-min-", "-max", "-phase-", "center"];
const ENUMERATORLABELS = ["inst", "---parameter---", "-# points-"];
function MasterLfoHandler(){
@@ -44,23 +46,32 @@ function MasterLfoHandler(){
/// MODULATOR ARRAYS
const [modVisibleArr, setModVisibleArr] = React.useState(initVisArr);
const [modInstanceNumArr, setModInstanceNumArr] = React.useState(Array(MAXLFOS).fill('1'));
const [modCenterVals, setModCenterVals] = React.useState({});
const [modCenterVals, setModCenterVals] = React.useState({'1':{}, '2':{}, '3':{}, '4':{}});
const [bpm, setBpm] = React.useState(100);
const [beatsInMeasure, setBeatsInMeasure] = React.useState(4);
const [shapeArr, setShapeArr] = React.useState(Array(MAXLFOS).fill('Sine'));
const [djParamArr, setDjParamArr] = React.useState(Array(MAXLFOS).fill('NONE'));
const [freqArr, setFreqArr] = React.useState(Array(MAXLFOS).fill('1'));
const [ampArr, setAmpArr] = React.useState(Array(MAXLFOS).fill('1'));
const [freqArr, setFreqArr] = React.useState(Array(MAXLFOS).fill('1hz'));
// const [ampArr, setAmpArr] = React.useState(Array(MAXLFOS).fill('1'));
const [minArr, setMinArr] = React.useState(Array(MAXLFOS).fill('0'));
const [maxArr, setMaxArr] = React.useState(Array(MAXLFOS).fill('1'));
const [phaseArr, setPhaseArr] = React.useState(Array(MAXLFOS).fill('0'));
const allModArrays = [modVisibleArr, shapeArr, djParamArr, freqArr, ampArr, phaseArr];
const allModSetters = [setModVisibleArr, setShapeArr, setDjParamArr, setFreqArr, setAmpArr, setPhaseArr];
const modBlankVals = [true, SHAPETYPES[0], MODPARAMOPTIONS[0], '1', '1', '0'];
const allModArrays = [modVisibleArr, modInstanceNumArr, shapeArr, djParamArr, freqArr, minArr, maxArr, phaseArr];
const allModSetters = [setModVisibleArr, setModInstanceNumArr, setShapeArr, setDjParamArr, setFreqArr, setMinArr, setMaxArr, setPhaseArr];
const modBlankVals = [true, '1', SHAPETYPES[0], MODPARAMOPTIONS[0], '1hz', '0', '1', '0'];
/// ENUMERATOR ARRAYS
const [enumVisibleArr, setEnumVisibleArr] = React.useState(initVisArr);
const [enumInstanceNumArr, setEnumInstanceNumArr] = React.useState(Array(MAXLFOS).fill('1'));
const [enumItemCounts, setEnumItemCounts] = React.useState(Array(MAXENUMPOINTS).fill('2'));
const [enumDjParamArr, setEnumDjParamArr] = React.useState(Array(MAXENUMPOINTS).fill('attenuation'));
@@ -84,14 +95,14 @@ function MasterLfoHandler(){
let baseEnumNames = Array(MAXENUMS).fill(0).map(x => Array(MAXENUMPOINTS).fill('param'));
const [enumNames, setEnumNames] = React.useState(baseEnumNames);
const allEnumArrays = [enumVisibleArr, enumItemCounts, enumDjParamArr];
const allEnumArrSetters = [setEnumVisibleArr, setEnumItemCounts, setEnumDjParamArr];
const allEnumArrays = [enumVisibleArr, enumInstanceNumArr, enumItemCounts, enumDjParamArr];
const allEnumArrSetters = [setEnumVisibleArr, setEnumInstanceNumArr, setEnumItemCounts, setEnumDjParamArr];
const allEnumMats = [enumBreakPoints, enumNames];
const allEnumMatSetters = [setEnumBreakPoints, setEnumNames];
const allGetEnumMatBlankVals = [getBlankEnumBreakPointRow, getBlankEnumNameRow]
const enumBlankVals = [true, 2, MODPARAMOPTIONS[0]];
const enumBlankVals = [true, '1', 2, MODPARAMOPTIONS[0]];
const [render, rerender] = React.useState(false); // BAD. I SHOULDN'T BE DOING THIS
@@ -113,40 +124,41 @@ function MasterLfoHandler(){
for (let i = 0; i<allEnumMats.length; i++) {
allEnumMatSetters[i](dict.data.enumMats[i]);
}
})
setModCenterVals(dict.data.modCenters);
})
}
function handleSave(event) {
let data = {
'modArrays' : allModArrays,
'enumArrays' : allEnumArrays,
'enumMats' : allEnumMats
'enumMats' : allEnumMats,
'modCenters': modCenterVals
}
window.max.setDict(event.detail, {"data" : data});
window.max.outlet("saved");
}
// only called internally by 1. Handler after modulator processing 2. LFO outputs
function handleEnum(event){
let name = event.detail[0];
let val = event.detail[1];
let inst = event.detail[0];
let name = event.detail[1];
let val = event.detail[2];
// if none of the Enums use this param, then we output it
let i = 0;
while (i < MAXENUMS){
if (enumVisibleArr[i] && enumDjParamArr[i] == name)
if (enumVisibleArr[i] && enumDjParamArr[i] == name && enumInstanceNumArr[i] == inst)
break;
i++
}
if (i == MAXENUMS){
window.max.outlet(name + ' ' + val);
window.max.outlet(inst + ' ' + name + ' ' + val);
}
else {
enumerate(name, val, enumItemCounts[i], enumBreakPoints[i], enumNames[i]);
enumerate(name, inst, val, enumItemCounts[i], enumBreakPoints[i], enumNames[i]);
}
@@ -154,32 +166,50 @@ function MasterLfoHandler(){
function handleParam(event) {
let name = event.detail[0];
let val = event.detail[1];
let inst = event.detail[0]; // djster instance
let name = event.detail[1];
let val = event.detail[2];
// CHECK FOR INDEX OF THIS NAME IN ENUM MATRIX, AND IF IT IS THERE DENUMERATE
let index = -1;
for (let i = 0; i < MAXENUMS; i++){
if (enumDjParamArr[i] == name && enumInstanceNumArr[i] == inst)
index = i;
}
if (index != -1){
val = denumerate(val, enumItemCounts[index], enumBreakPoints[index], enumNames[index]);
}
// if none of the LFOs use this param, then we send it straight to the enum
let i = 0;
while (i < MAXLFOS){
if (modVisibleArr[i] && djParamArr[i] == name)
if (modVisibleArr[i] && djParamArr[i] == name && modInstanceNumArr[i] == inst)
break;
i++
i++;
}
if (i == MAXLFOS){
window.dispatchEvent(new CustomEvent('enum', {'detail' : [name, val]}));
window.dispatchEvent(new CustomEvent('enum', {'detail' : [inst, name, val]}));
}
modCenterVals[name] = val;
modCenterVals[inst][name] = val;
setModCenterVals(modCenterVals);
rerender(!render); // BAD! SHOULD NOT BE DOING THIS!
}
function handleTick(event) {
let time = (Date.now() - firstUpdateTime) / 1000;
operateModulators(modVisibleArr, djParamArr, modCenterVals, freqArr, ampArr, shapeArr, phaseArr, time);
operateModulators(modVisibleArr, modInstanceNumArr, djParamArr, modCenterVals, freqArr, minArr, maxArr, shapeArr, phaseArr, time, bpm, beatsInMeasure);
}
function handleBpm(event) {
setBpm(event.detail);
}
function handleTimeSig(event) {
setBeatsInMeasure(parseFloat(event.detail[0]) * parseFloat(event.detail[1])/ 4);
}
@@ -188,6 +218,8 @@ function MasterLfoHandler(){
window.addEventListener('tick', handleTick);
window.addEventListener('param', handleParam);
window.addEventListener('enum', handleEnum);
window.addEventListener('tempo', handleBpm);
window.addEventListener('timesig', handleTimeSig);
return () => {
window.removeEventListener('loadDict', handleLoad);
@@ -195,33 +227,54 @@ function MasterLfoHandler(){
window.removeEventListener('tick', handleTick);
window.removeEventListener('param', handleParam);
window.removeEventListener('enum', handleEnum);
window.removeEventListener('tempo', handleBpm);
window.removeEventListener('timesig', handleTimeSig);
};
}, [...allModArrays, ...allEnumArrays, ...allEnumMats, modCenterVals]);
}, [...allModArrays, ...allEnumArrays, ...allEnumMats, modCenterVals, render, bpm, beatsInMeasure]);
function CheckLinked(inst, param, checkInstArr, checkParamArr){
for (let i = 0; i < checkInstArr.length; i++){
if (checkInstArr[i] == inst && checkParamArr[i] == param)
return true;
}
return false;
}
///////
// Generate Modulators
///////
let modContents = []
for (var i = 0; i<MAXLFOS; i++){
let id = i;
modContents.push(
e(LfoRow, {
instanceNum : modInstanceNumArr[i],
setInstanceNum: CreateParamChanger(modInstanceNumArr, setModInstanceNumArr, i),
shape: shapeArr[i],
setShape: CreateParamChanger(shapeArr, setShapeArr, i),
djParam: djParamArr[i],
setDjParam: CreateParamChanger(djParamArr, setDjParamArr, i),
centerVals: modCenterVals,
freq: freqArr[i],
setFreq: CreateParamChanger(freqArr, setFreqArr, i),
amp: ampArr[i],
setAmp: CreateParamChanger(ampArr, setAmpArr, i),
//amp: ampArr[i],
//setAmp: CreateParamChanger(ampArr, setAmpArr, i),
min: minArr[i],
setMin : CreateParamChanger(minArr, setMinArr, i),
max: maxArr[i],
setMax: CreateParamChanger(maxArr, setMaxArr, i),
phase: phaseArr[i],
setPhase: CreateParamChanger(phaseArr, setPhaseArr, i),
visible: modVisibleArr[i],
linked: CheckLinked(modInstanceNumArr[i], djParamArr[i], enumInstanceNumArr, enumDjParamArr),
addLfo: () => {
if (id < MAXLFOS - 1){
if (modVisibleArr[id + 1]){
@@ -270,6 +323,9 @@ function MasterLfoHandler(){
enumContents.push(
e(EnumeratorRow, {
index: i,
instanceNum : enumInstanceNumArr[i],
setInstanceNum: CreateParamChanger(enumInstanceNumArr, setEnumInstanceNumArr, i),
enumItems: enumItemCounts[i],
setEnumItemCounts: CreateParamChanger(enumItemCounts, setEnumItemCounts, i),
enumBreakPoints: enumBreakPoints,
@@ -279,6 +335,7 @@ function MasterLfoHandler(){
visible: enumVisibleArr[i],
djParam: enumDjParamArr[i],
setDjParam: CreateParamChanger(enumDjParamArr, setEnumDjParamArr, i),
linked: CheckLinked(enumInstanceNumArr[i], enumDjParamArr[i], modInstanceNumArr, djParamArr),
addEnum: () => {
if (id < MAXLFOS - 1){
if (enumVisibleArr[id + 1]){ // if we need to open up space
@@ -365,8 +422,17 @@ if (!DEBUG){
window.dispatchEvent(new CustomEvent('saveDict', {'detail' : dictId}));
});
window.max.bindInlet("param", (paramName, val) => {
window.dispatchEvent(new CustomEvent('param', {'detail' : [paramName, val]}));
window.max.bindInlet("param", (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.dispatchEvent(new CustomEvent('timesig', {'detail' : [top, bottom]}));
});
setInterval(() => {

View File

@@ -3,6 +3,9 @@
/////////////////////////
var SHAPETYPES = ["Sine", "SawUp", "SawDown", "Tri", "Square"];
var INSTANCEOPTIONS = ["1", "2", "3", "4"];
const MODPARAMOPTIONS = ["NONE", "stream", "pulse_length", "eventfulness", "event_length", "metriclarity",
"harmoniclarity", "melodic_cohesion", "melody_scope", "tonic_pitch", "pitch_center", "pitch_range", "dynamics",
"attenuation", "chordal_weight", "tonality-profile", "ostinato-buffer", "ostinato", "meter", "scale"];
@@ -14,16 +17,27 @@ function ControlType(){
function LfoRow(props){
let content = e('ul', {className: 'lfo-item'},
let linkedText = props.linked ? "-> enums" : "";
let center = props.centerVals[props.instanceNum][props.djParam];
if (!center)
center = 0;
let content = e('ul', {className: 'lfo-item'},
ListItem(DropDown({onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
ListItem(ControlType()),
ListItem(DropDown({onChange: props.setShape, value:props.shape, options: SHAPETYPES})),
ListItem(DropDown({onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
ListItem(e(NumberBox, {onChange:props.setFreq, value:props.freq, step: 0.1}, null)),
ListItem(e(NumberBox, {onChange:props.setAmp, value:props.amp, step:0.1}, 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.setMax, value:props.max, step:0.1}, null)),
//ListItem(e(NumberBox, {onChange:props.setAmp, value:props.amp, step:0.1}, null)),
ListItem(e(NumberBox, {onChange:props.setPhase, value:props.phase, step:0.1}, null)),
ListItem(e("input", {type: 'range', min: 0, max: 1, step: 0.01, readonly: true, id: `slider-${props.djParam}`})),
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(Button, {text:'+', onClick: props.addLfo}, null)),
ListItem(e(Button, {text:'-', onClick: props.removeLfo}, null))
ListItem(e(Button, {text:'-', onClick: props.removeLfo}, null)),
ListItem(e("div", {className:"linked"}, linkedText)),
);
if (props.visible){
return content
@@ -45,29 +59,64 @@ function indexWave(type, phase){
}
}
function operateModulators(visibleArr, paramNames, centers, freqs, amps, waveTypes, phaseArr, time){
function operateModulators(visibleArr, instanceNumArr, paramNames, centers, freqs, mins, maxs, waveTypes, phaseArr, currTime, bpm, beatsInMeasure){
for (let i=0; i<paramNames.length; i++){
if (visibleArr[i]){
let name = paramNames[i];
let inst = instanceNumArr[i];
let center = 0;
if (centers.hasOwnProperty(name)){
center = centers[name];
if (centers[inst].hasOwnProperty(name)){
center = centers[inst][name];
}
let output = operateModulator(center, freqs[i], amps[i], waveTypes[i], phaseArr, i, name, time);
let output = operateModulator(center, inst, freqs[i], mins[i], maxs[i], waveTypes[i], phaseArr, i, name, currTime, bpm, beatsInMeasure);
if (name !== "NONE")
window.dispatchEvent(new CustomEvent('enum', {'detail' : [name, output]}));
window.dispatchEvent(new CustomEvent('enum', {'detail' : [inst, name, output]}));
}
}
}
function operateModulator(center, freq, amp, waveType, phaseArr, phaseI, name, time){
function operateModulator(center, inst, freq, min, max, waveType, phaseArr, phaseI, name, currTime, bpm, beatsInMeasure){
let amp = parseFloat(max) - parseFloat(min);
let phase = (time * freq + parseFloat(phaseArr[phaseI])) % 1.00;
freq = parseLfoTime(freq, bpm, beatsInMeasure);
let phase = (currTime * freq + parseFloat(phaseArr[phaseI])) % 1.00;
let unscaled = indexWave(waveType, phase);
let el = document.getElementById(`slider-${name}`);
let el = document.getElementById(`slider-${inst}-${name}`);
if (el)
el.value = unscaled;
return unscaled * amp + center;
}
return unscaled * amp + center + parseFloat(min);
}
function parseLfoTime(lfoTime, bpm, beatsInMeasure){
if (lfoTime.slice(-2) == "hz"){
return parseFloat(lfoTime.slice(0, -2));
}
else if (lfoTime.slice(-2) == "ms"){
return 1000 / parseFloat(lfoTime.slice(0, -2));
}
else if (lfoTime.slice(-1) == "s"){
return 1 / parseFloat(lfoTime.slice(0, -1));
}
else if ((lfoTime.match(/:/g) || []).length == 2){
return 1 / moment.duration(lfoTime).asSeconds();
}
else if ((lfoTime.match(/\./g) || []).length == 2){
return musicalTimingToFreq(...lfoTime.split('.'), bpm, beatsInMeasure)
}
else {
return 0;
}
}
function musicalTimingToFreq(bars, beats, ticks, bpm, beatsInMeasure){
let totalTicks = (parseFloat(bars) * parseFloat(beatsInMeasure) + beats) * 480 + parseFloat(ticks);
let tpm = bpm * 480;
let cyclesPerMinute = tpm / totalTicks;
let hz = cyclesPerMinute / 60;
return hz;
}

2
moment.js Normal file

File diff suppressed because one or more lines are too long