2021 Grid in Processing?

sorry if this is a repeat question - couldn’t find anything on the forum that matched. I have a new grid (picked up with the most recent drop) and am trying to use it with Processing on my non-M1 mac. following the processing studies I am able to communicate with processing (it’s able to detect keypresses and light up the grid) but the LED brightness is non variable: anything over 0 is fully lit, and 0 is off, no in between. it looks like the Monome Processing lib hasn’t been updated since 2016, so I’m sure it’s just that, but is there any way to set this up so that I can light grid keys up with arbitrary brightnesses?

5 Likes

thanks for checking this out— i’m not sure the processing library has gotten much exercise over the years. but the problem may actually be on a different level (ie, libmonome) so i’ll take a look.

6 Likes

thanks for looking into this! curious if you had any updates on it?

grid makes a very fun control surface for driving Processing animations, but still hoping I can start messing around with the grid LEDs at some point soon :slight_smile:

1 Like

we’re working through getting the studies updated. @dan_derks just overhauled the supercollider lib and study, and work is going into the others.

processing is up soon

10 Likes

any updates?

I’m on a M1 mac with which I can achieve variable brightness through Max, but not through Processing.

Should I wait for a Monome Processing Library update?

apologies for the delay – Processing is truly up next (Max was a small doozy), but just to confirm, i’m able to load Processing study 3.3 and i’m getting varibright response on an M1 Mac.

as we work toward prioritizing the library + study audit, would you (@rosemarrow + @mei) be able to share the sketches you’re running where varibrightness is not occurring? happy to take a look and assist in the meantime! :slight_smile:

3 Likes

hi dan! – i just loaded up processing study 3.3 and can confirm that my grid is not doing varibright at all. it’s the same as my first post: 0 is off, any other value is fully lit.

i’m on a non-m1 mac – is there any other stuff i should check?

grid_studies_3_3.pde
import org.monome.Monome;
import oscP5.*;

Monome m;
boolean dirty;

int[][] step;
int timer;
int play_position;
int STEP_TIME = 10;

public void setup() {
  m = new Monome(this);
  
  dirty = true;
  
  step = new int[6][16];
  
  size(360,140);
  background(51);
  stroke(255,204);
}
  
public void draw() {
  fill(51, 60);
  rect(0,0,width,height);
  
  if(timer == STEP_TIME) {
    if(play_position == 15)
      play_position = 0;
    else 
      play_position++;
    
    // TRIGGER SOMETHING
    for(int y=0;y<6;y++)
      if(step[y][play_position] == 1)
        trigger(y);
    
    timer = 0;
    dirty = true;
  }
  else timer++;
  
  if(dirty) {
    int[][] led = new int[8][16];
    int highlight;
    
    // display steps
    for(int x=0;x<16;x++) {
      // highlight the play position
      if(x == play_position)
        highlight = 4;
      else 
        highlight = 0;
        
      for(int y=0;y<6;y++)
        led[y][x] = step[y][x] * 11 + highlight;
    }
    
    // draw trigger bar and on-states
    for(int x=0;x<16;x++)
      led[6][x] = 4;    
    for(int y=0;y<6;y++)
      if(step[y][play_position] == 1)
        led[6][y] = 15;
        
    
    // update grid
    m.refresh(led);
    dirty = false;
  }
}

public void key(int x, int y, int s) {
  // toggle steps
  if(s == 1 && y < 6) {
    step[y][x] ^= 1;
    
    dirty = true; 
  }
}

public void trigger(int i) {
  line(20,20+i*20,width-20,20+i*20);
}