Connecting Processing.js drawing app and midibridge

edited November 2014 in JavaScript Mode

Hi, I have a very simple drawing app in processing.js and want to control the brushsize via my physical midicontroller.

Since there is no midi-libary in processing that is supported in processing.js I thought of using the midibridge javascript API.

You can read about it here: http://abumarkub.net/abublog/?page_id=399 and see a very simple example here: http://abumarkub.net/midibridge/example/basic-example.html

Is that possible or does the drawing app have to be coded in pure javascript? Here is my code

float R = 0, G = 0, B = 0;
float brushsize = 5;


    void setup() {
      colorMode(RGB);
      size(300, 300);
      background(255);
    }

    void draw() {
    if (mousePressed){
          strokeWeight(brushsize);
          stroke(R, G, B);
          line(mouseX, mouseY, pmouseX, pmouseY);
        }
    }

Answers

  • Answer ✓

    Well, this "JS" library is relying on a Java applet. So:

    • You can as well write your sketch in classical Processing and generate the applet of the result;
    • In both cases (JS or Java), you will have trouble with most browsers that tend to block applets, nowadays.

    Beside, I fail to see the interest of having inline programs that relying on specific hardware on the computer of the visitor...

  • edited November 2014

    Hi PhiLho, makes sense, I didn't realize you could export the java applet and run it in a browser. :\"> That makes things alot easier, because I can just use the midibus library for processing.

    Thank you

    Edit: one last question, as far as I can see there is a web midi standard developed that that doesn't use a Java applet w3.org/TR/webmidi/ Is that right? As long as you activate it under chrome://flags/#enable-web-midi

  • Interesting. Indeed, it supposes the browser do direct system access to a potential Midi device.

Sign In or Register to comment.