Web Midi

From EMC23 - Satellite Of Love
Revision as of 11:53, 15 May 2019 by Techbot (talk | contribs) (Created page with "function setup() { // put setup code here WebMidi.enable(function (err) { if (err) { console.log("WebMidi could not be enabled.", err); } else { console.log("WebMidi enabled!...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

function setup() { // put setup code here WebMidi.enable(function (err) { if (err) { console.log("WebMidi could not be enabled.", err); } else {

console.log("WebMidi enabled!"); console.log(WebMidi.inputs); //console.log(WebMidi.outputs); // Retrieve an input by name, id or index //var input = WebMidi.getInputByName("Launch Control"); var input = WebMidi.getInputById("input-0"­);

input.addListener('controlchange', "all", function (e) { console.log("Received 'controlchange' message.", e.data[2]); // console.log("Received 'controlchange' message.", e);


} ); // Check for the presence of an event listener (n such cases, you cannot use anonymous functions). function test(e) { console.log(e); } // input.addListener('programchange', 12, test); input.addListener('controlchange', "all",function(e) { console.log("value: " + e.value); draw(e) }); } } ); } function draw(e) { ellipse(50, 50, 80, e.value); // put drawing code here }