Last active
May 30, 2017 19:40
-
-
Save johnty/e82a4e529e35dbb96241534c90ac8913 to your computer and use it in GitHub Desktop.
maps single moisture value (0-100) to tempo and key variables of a simple algorithmic sequencer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id":"98459436.cfd5b8", | |
"type":"ui_slider", | |
"z":"185b40f6.0c777f", | |
"name":"", | |
"label":"moisture level", | |
"group":"e97b599c.1d6968", | |
"order":1, | |
"width":"5", | |
"height":"1", | |
"passthru":true, | |
"topic":"", | |
"min":0, | |
"max":"100", | |
"step":1, | |
"x":170, | |
"y":175, | |
"wires":[ | |
[ | |
"9ae8df7f.95c09", | |
"f49d5120.10fab" | |
] | |
] | |
}, | |
{ | |
"id":"e3f5b51e.0453a8", | |
"type":"inject", | |
"z":"185b40f6.0c777f", | |
"name":"", | |
"topic":"", | |
"payload":"0.02", | |
"payloadType":"num", | |
"repeat":"", | |
"crontab":"", | |
"once":false, | |
"x":195, | |
"y":253, | |
"wires":[ | |
[ | |
"f5677969.cb69c8" | |
] | |
] | |
}, | |
{ | |
"id":"f5677969.cb69c8", | |
"type":"osc", | |
"z":"185b40f6.0c777f", | |
"name":"tempo", | |
"path":"/tempo", | |
"metadata":false, | |
"x":430, | |
"y":252, | |
"wires":[ | |
[ | |
"c42488a5.35a568" | |
] | |
] | |
}, | |
{ | |
"id":"c42488a5.35a568", | |
"type":"udp out", | |
"z":"185b40f6.0c777f", | |
"name":"", | |
"addr":"127.0.0.1", | |
"iface":"", | |
"port":"7002", | |
"ipv":"udp4", | |
"outport":"", | |
"base64":false, | |
"multicast":"false", | |
"x":635, | |
"y":252, | |
"wires":[ | |
] | |
}, | |
{ | |
"id":"9ae8df7f.95c09", | |
"type":"function", | |
"z":"185b40f6.0c777f", | |
"name":"map to musical scale", | |
"func":"if (msg.payload <30) {\n msg.payload = 'minor'\n return msg;\n}\nif (msg.payload <60) {\n msg.payload = 'major'\n return msg;\n}\nelse {\n msg.payload = 'penta'\n return msg;\n}", | |
"outputs":1, | |
"noerr":0, | |
"x":387, | |
"y":175, | |
"wires":[ | |
[ | |
"31535b6a.b90b44", | |
"ec755a12.230e58" | |
] | |
] | |
}, | |
{ | |
"id":"f49d5120.10fab", | |
"type":"function", | |
"z":"185b40f6.0c777f", | |
"name":"exponential tempo map", | |
"func":"var inval = msg.payload\n\nvar beta = 4\nvar base = 3\nx = 100-inval //x from 0 to 100\nout = 100* ( 1-Math.pow(base,beta*x/100)/Math.pow(base,beta));\nmsg.payload = out\nreturn msg", | |
"outputs":1, | |
"noerr":0, | |
"x":185, | |
"y":311, | |
"wires":[ | |
[ | |
"1b210c9b.a106c3" | |
] | |
] | |
}, | |
{ | |
"id":"31535b6a.b90b44", | |
"type":"osc", | |
"z":"185b40f6.0c777f", | |
"name":"key", | |
"path":"/key", | |
"metadata":false, | |
"x":431, | |
"y":215, | |
"wires":[ | |
[ | |
"c42488a5.35a568" | |
] | |
] | |
}, | |
{ | |
"id":"ec755a12.230e58", | |
"type":"ui_text", | |
"z":"185b40f6.0c777f", | |
"group":"e97b599c.1d6968", | |
"order":3, | |
"width":"3", | |
"height":"1", | |
"name":"", | |
"label":"key:", | |
"format":"{{msg.payload}}", | |
"layout":"row-spread", | |
"x":614, | |
"y":174, | |
"wires":[ | |
] | |
}, | |
{ | |
"id":"1b210c9b.a106c3", | |
"type":"range", | |
"z":"185b40f6.0c777f", | |
"minin":"0", | |
"maxin":"100", | |
"minout":"0.01", | |
"maxout":"1", | |
"action":"scale", | |
"round":false, | |
"name":"", | |
"x":378, | |
"y":311, | |
"wires":[ | |
[ | |
"f5677969.cb69c8", | |
"3e85fdc0.62bcf2" | |
] | |
] | |
}, | |
{ | |
"id":"71913148.9dd3f", | |
"type":"comment", | |
"z":"185b40f6.0c777f", | |
"name":"Maps single moisture value to speed and key", | |
"info":"controls python sequencer via OSC. (see IP/port set by udp output node)\n\n* input moisture range from 100 (wet) to 0 (dry)\n* output tempo = ~1 note/sec (wet) to 10 notes/sec (dry)\n* key = pentatonic (wet), major (mid), minor (dry)\n\ntempo is scaled exponentially (see function node for details)", | |
"x":419, | |
"y":49, | |
"wires":[ | |
] | |
}, | |
{ | |
"id":"b63d7d53.83f0a", | |
"type":"range", | |
"z":"185b40f6.0c777f", | |
"minin":"100", | |
"maxin":"200", | |
"minout":"0", | |
"maxout":"100", | |
"action":"clamp", | |
"round":true, | |
"name":"current moisture range is 200-100", | |
"x":196, | |
"y":109, | |
"wires":[ | |
[ | |
"98459436.cfd5b8", | |
"37a8388e.3569b8" | |
] | |
] | |
}, | |
{ | |
"id":"ef89c32f.27e25", | |
"type":"link in", | |
"z":"185b40f6.0c777f", | |
"name":"moisture_in", | |
"links":[ | |
"a1fc1359.a587e" | |
], | |
"x":162, | |
"y":32, | |
"wires":[ | |
[ | |
"b63d7d53.83f0a" | |
] | |
] | |
}, | |
{ | |
"id":"3e85fdc0.62bcf2", | |
"type":"ui_text", | |
"z":"185b40f6.0c777f", | |
"group":"e97b599c.1d6968", | |
"order":4, | |
"width":"3", | |
"height":"1", | |
"name":"beats per minute", | |
"label":"BPM", | |
"format":"{{60/msg.payload | number:1}}", | |
"layout":"row-spread", | |
"x":571, | |
"y":324, | |
"wires":[ | |
] | |
}, | |
{ | |
"id":"37a8388e.3569b8", | |
"type":"ui_text", | |
"z":"185b40f6.0c777f", | |
"group":"e97b599c.1d6968", | |
"order":2, | |
"width":"1", | |
"height":"1", | |
"name":"input moisture", | |
"label":"", | |
"format":"{{msg.payload}}", | |
"layout":"row-spread", | |
"x":545, | |
"y":393, | |
"wires":[ | |
] | |
}, | |
{ | |
"id":"e97b599c.1d6968", | |
"type":"ui_group", | |
"z":"", | |
"name":"MoistureMusicMap", | |
"tab":"5cc74755.c82bf8", | |
"disp":true, | |
"width":"6" | |
}, | |
{ | |
"id":"5cc74755.c82bf8", | |
"type":"ui_tab", | |
"z":"", | |
"name":"MoistureMusicMap", | |
"icon":"dashboard" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment