Changing Color Over Time With MIDI

edited July 2017 in Library Questions

I have some shapes drawn, and I'd like to change the color inside the shapes after the shapes are already drawn, doing it in real-time, in the java window, and using MIDI to control the shades of color. Could someone please provide an example of how I would go about doing this, or point me in the right direction? I appreciate any help.



  • Using MIDI to control the shades of color

    You could start with:

    1. a basic shape color sketch controlled by something else (like the mouse)
    2. a separate basic MIDI sketch using the MIDI library

    Have you tried either of these things? Combining them is easy once you understand the principles of each.

  • I haven't tried doing either, yet. I'll give it a shot.

  • If you get stuck with either or stuck with combining them, respond in this thread and share your latest code.

  • And stop rejecting answers, it's insulting. Nothing Jeremy has said is unhelpful.

  • I have some shapes drawn...

    Could someone please provide an example of ...

    See the problem here is that you already have code, but we'd have to start from scratch. Which is a) a lot more work for us and b) there's no guarantee that what we come up with will be compatible with what you already have.

    You can help yourself by posting what you already have.

  • And you probably want the midibus library

    I've never used it and don't know how up to date it is. They are useful looking examples.

  • I'm not "rejecting" answers, I'm trying to get as much input as possible, so stop assuming, it's insulting. I appreciate the response, and from Jeremy too.

  • edited July 2017

    AFAIK, regular members can't see whether a reply has been rejected or not.

    In order for a reply to be accepted or rejected, either the OP or some moderator or administrator needs to click at Yes or No from "Did this answer the question?"

  • I'm not "rejecting" answers,

    every time you hit 'no' the post gets marked like this (at least in my view):


    which looks like the forum equiv of a black eye or something, which people don't deserve. but gotoloop's right in that i can't see these when logged out.

    (the 'you have answered questions' nag thing doesn't help matters in that it encourages people to choose when the 'do nothing' option is better than 'no'. i've just adblocked it on my pc.)

  • edited July 2017

    I think some people coming from environments like StackExchange have learned that "accept" means "no further help wanted." They don't necessarily know that isn't how it works here.

    I'm happy that I can't see the black eyes, by the way -- including the image you posted, which I'm guessing is mod-UI-view-restricted. Sounds like a stressful UI for the mod.

    Edit Yeah, I can see that now. ouch.

    Might be nice to just replace that "Rejected Answer" string in Vanilla with some other text like "More help please?"

  • Answer ✓

    This example uses the input from the mic.


    float ampt;
    PImage photo;
    void setup() {
      size(1200, 800);
      amp = new Amplitude(this);
      in = new AudioIn(this, 0);
      photo = loadImage("fig.jpg");
    void draw() {
      ampt = amp.analyze();
      float myColor = ampt*256; 
      tint((myColor), (myColor), (myColor));
      image(photo, 0, 0, width, height);
      int halfImage = width*height/2;
      for (int i = 0; i < halfImage; i++) {
        pixels[i+halfImage] = color(constrain((pixels[i]>>16)*round(random(ampt)*100), 0, 255) & 0xff, pixels[i]>>8 & 0xff, pixels[i]&0xff);
Sign In or Register to comment.