Skip to content

Commit

Permalink
Dev/test (#6)
Browse files Browse the repository at this point in the history
* Add some test commands to `mpe_out`

* Move assets folder to `./project/test`

* Set up test

- install tdd-max
- Rename `common` folder as `abstractions`
- Add test for `convert_nn_to_freq`

* Minor change

- Fix typo
  • Loading branch information
szk2s authored May 30, 2019
1 parent 3027bc3 commit d008d4d
Show file tree
Hide file tree
Showing 35 changed files with 485 additions and 52 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To remove them, take the following step.
"cacheDirs": [
"/Users/UserName/Library/Application Support/Cycling '74/Max 8/Settings/temp64-live/mxt",
"/Users/UserName/Documents/Max 8/Max for Live Devices",
"/Users/UserName/.Trash",
"/Users/UserName/.Trash"
]
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
,
"classnamespace" : "box",
"rect" : [ 34.0, 78.0, 855.0, 788.0 ],
"rect" : [ 112.0, 78.0, 855.0, 788.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
Expand Down Expand Up @@ -39,25 +39,37 @@
"subpatcher_template" : "",
"boxes" : [ {
"box" : {
"id" : "obj-2",
"id" : "obj-6",
"linecount" : 2,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 283.0, 527.0, 177.0, 33.0 ],
"text" : "Bending up one semitone: 1 \nBending down one semitone: -1"
}

}
, {
"box" : {
"id" : "obj-3",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "int", "float" ],
"patching_rect" : [ 44.25, 591.0, 60.0, 22.0 ],
"text" : "unpack i f"
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 250.0, 273.0, 90.0, 22.0 ],
"text" : "loadmess 8192"
}

}
, {
"box" : {
"id" : "obj-1",
"id" : "obj-4",
"maxclass" : "newobj",
"numinlets" : 2,
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 44.25, 564.0, 99.75, 22.0 ],
"text" : "pak i f"
"patching_rect" : [ 416.0, 268.0, 70.0, 22.0 ],
"text" : "loadmess 2"
}

}
Expand Down Expand Up @@ -112,12 +124,12 @@
, {
"box" : {
"id" : "obj-75",
"linecount" : 5,
"linecount" : 3,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 177.0, 527.0, 104.0, 74.0 ],
"text" : "Pitch bend value is represented as float num whose range is between -1 and 1."
"patching_rect" : [ 177.0, 527.0, 104.0, 47.0 ],
"text" : "Pitch bend value is represented as float num."
}

}
Expand Down Expand Up @@ -238,20 +250,21 @@
"maxclass" : "inlet",
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"outlettype" : [ "" ],
"patching_rect" : [ 44.25, 40.0, 30.0, 30.0 ]
}

}
, {
"box" : {
"comment" : "pitch_bend: int (from 0 to 16383)",
"cool" : 1,
"id" : "obj-86",
"index" : 2,
"maxclass" : "inlet",
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"outlettype" : [ "" ],
"patching_rect" : [ 125.0, 40.0, 30.0, 30.0 ]
}

Expand Down Expand Up @@ -285,22 +298,15 @@
],
"lines" : [ {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"source" : [ "obj-1", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-76", 1 ],
"source" : [ "obj-2", 1 ]
"destination" : [ "obj-63", 0 ],
"source" : [ "obj-3", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-76", 0 ],
"source" : [ "obj-2", 0 ]
"destination" : [ "obj-45", 0 ],
"source" : [ "obj-4", 0 ]
}

}
Expand Down Expand Up @@ -348,7 +354,7 @@
}
, {
"patchline" : {
"destination" : [ "obj-1", 1 ],
"destination" : [ "obj-76", 1 ],
"source" : [ "obj-74", 0 ]
}

Expand All @@ -369,7 +375,7 @@
}
, {
"patchline" : {
"destination" : [ "obj-1", 0 ],
"destination" : [ "obj-76", 0 ],
"source" : [ "obj-85", 0 ]
}

Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"author": "spectral-lab",
"license": "MIT",
"devDependencies": {
"chai": "^4.2.0",
"note-parser": "^2.0.1",
"rimraf": "^2.6.3"
},
"dependencies": {
"tdd-max": "^1.0.3"
}
}
50 changes: 28 additions & 22 deletions projects/mpe_out/main.maxpat
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@
"style" : "",
"subpatcher_template" : "",
"boxes" : [ {
"box" : {
"id" : "obj-14",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 184.0, 43.0, 79.0, 22.0 ],
"presentation" : 1,
"presentation_rect" : [ 184.0, 43.0, 79.0, 22.0 ],
"text" : "update-menu"
}

}
, {
"box" : {
"id" : "obj-25",
"maxclass" : "comment",
Expand Down Expand Up @@ -147,21 +161,11 @@
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 27.0, 56.0, 75.0, 22.0 ],
"presentation" : 1,
"presentation_rect" : [ 27.0, 56.0, 75.0, 22.0 ],
"text" : "get_track_id"
}

}
, {
"box" : {
"id" : "obj-31",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 460.0, 236.0, 61.0, 22.0 ],
"text" : "send-midi"
}

}
, {
"box" : {
Expand Down Expand Up @@ -242,7 +246,7 @@
"numinlets" : 1,
"numoutlets" : 3,
"outlettype" : [ "bang", "int", "int" ],
"patching_rect" : [ 277.0, 168.0, 83.0, 22.0 ],
"patching_rect" : [ 277.0, 13.0, 83.0, 22.0 ],
"text" : "live.thisdevice"
}

Expand Down Expand Up @@ -274,7 +278,7 @@
, {
"box" : {
"id" : "obj-13",
"items" : [ "IAC Driver Bus 1", ",", "nanoKEY2 CTRL", ",", "to Max 1", ",", "to Max 2" ],
"items" : [ "IAC Driver Bus 1", ",", "nanoKEY2 CTRL", ",", "Analog Four Elektron MIDI", ",", "to Max 1", ",", "to Max 2" ],
"maxclass" : "umenu",
"numinlets" : 1,
"numoutlets" : 3,
Expand All @@ -293,7 +297,9 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 277.0, 247.0, 64.0, 22.0 ],
"patching_rect" : [ 277.0, 56.0, 64.0, 22.0 ],
"presentation" : 1,
"presentation_rect" : [ 277.0, 56.0, 64.0, 22.0 ],
"text" : "script start"
}

Expand Down Expand Up @@ -346,6 +352,13 @@
"source" : [ "obj-13", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-1", 0 ],
"source" : [ "obj-14", 0 ]
}

}
, {
"patchline" : {
Expand Down Expand Up @@ -410,13 +423,6 @@
"source" : [ "obj-3", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-1", 0 ],
"source" : [ "obj-31", 0 ]
}

}
, {
"patchline" : {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions projects/test/code/convert_nn_to_freq.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { assert, expect } = require('chai');
// @ts-ignore
const parser = require('note-parser');

module.exports = {
target: 'convert_nn_to_freq',
initPatcher: function*(maxAPI) {
maxAPI.outlet({ convert_nn_to_freq: { 'inlet0': 69, 'inlet1':8192, 'inlet2':2 } });
assert.notEqual(yield, null, 'isOk');
},
testNoBend: function*(maxAPI) {
maxAPI.outlet({ convert_nn_to_freq: { 'inlet0': 60 } });
expect(yield, 'Do nothing on C=60').to.be.closeTo(parser.freq(60), 0.1);
},
testBendUpToTheEnd: function*(maxAPI) {
maxAPI.outlet({ convert_nn_to_freq: { 'inlet0': 62, 'inlet1':16383 } });
expect(yield, 'Bend up from D=62 to E=64').to.be.closeTo(parser.freq(64), 0.1);
},
testBendDownToTheEnd: function*(maxAPI) {
maxAPI.outlet({ convert_nn_to_freq: { 'inlet0': 65, 'inlet1':0 } });
expect(yield, 'Bend down from F=65 to Eb=63').to.be.closeTo(parser.freq(63), 0.1);
},
testBendWithRange8: function*(maxAPI) {
maxAPI.outlet({ convert_nn_to_freq: { 'inlet0': 48, 'inlet1':16383, 'inlet2': 8 } });
expect(yield, 'Bend up from C=48 to Ab=56').to.be.closeTo(parser.freq(56), 0.1);
maxAPI.outlet({ convert_nn_to_freq: { 'inlet0': 48, 'inlet1':0, 'inlet2': 8 } });
expect(yield, 'Bend down from C=48 to E=40').to.be.closeTo(parser.freq(40), 0.1);
maxAPI.outlet({ convert_nn_to_freq: { 'inlet0': 48, 'inlet1':12288, 'inlet2': 8 } });
expect(yield, 'Bend up from C=48 to E=52').to.be.closeTo(parser.freq(52), 0.1);
maxAPI.outlet({ convert_nn_to_freq: { 'inlet0': 48, 'inlet1':4096, 'inlet2': 8 } });
expect(yield, 'Bend down from C=48 to Ab=44').to.be.closeTo(parser.freq(44), 0.1);
}
};
Loading

0 comments on commit d008d4d

Please sign in to comment.