We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
RGB MIDI controlled mixer (Read 557 times)
RGB MIDI controlled mixer
Sep 8th, 2006, 10:56pm
 
A simple RGB video mixer controlled via MIDI. By default it uses your 1st midi device as input through channel 1, but you can modify this in the "MIDI assignments" section of the code.

This requires the promidi library (http://www.texone.org/promidi/) and 2 videos in the data folder ("street.mov" and "station.mov")

http://video.google.com/videoplay?docid=-2527645162496072676

Quote:


// MIDI Video Mix
// by Monosylabik <http://www.myspace.com/djmonosylabik>

// Use MIDI CC to mix two video sources

// Created 7 Sept 2006

import processing.video.*;
import promidi.*;

MidiIO midiIO;
Movie movie1;
Movie movie2;

int[] cc = new int[128];

int maxpval=256;
int maxval=255;
int maxpmidval=128;
int maxmidval=127;

float step=maxpval/maxpmidval;

//Midi assignments
int device=0;
int chan=0;
int xfcc=15;
int f1cc=13;
int f2cc=14;
int r1cc=2;
int g1cc=3;
int b1cc=4;
int r2cc=5;
int g2cc=6;
int b2cc=7;

float xfade=0;
float fade1=0;
float fade2=0;

float r1=0;
float g1=0;
float b1=0;

float r2=0;
float g2=0;
float b2=0;

void setup(){
 size(320 ,240);
 framerate(30);
 background(0);

 //get an instance of MidiIO
 midiIO = MidiIO.getInstance(this);
 println("printPorts of midiIO");

 //print a list of all available devices
 midiIO.printDevices();

 //open the first midi channel of the first device
 midiIO.openInput(device,chan);

 movie1 = new Movie(this, "station.mov");
 movie1.loop();

 movie2 = new Movie(this, "street.mov");
 movie2.loop();
}

void controllerIn(Controller controller, int device, int chan){
 int num = controller.getNumber();
 int val = controller.getValue();
 cc[num] = val;
}

void draw(){
 background(0);

 xfade=cc[xfcc]*step;
 fade1=cc[f1cc]*step;
 fade2=cc[f2cc]*step;

 r1=cc[r1cc]*step;
 g1=cc[g1cc]*step;
 b1=cc[b1cc]*step;
 r2=cc[r2cc]*step;
 g2=cc[g2cc]*step;
 b2=cc[b2cc]*step;

 tint(r1*fade1/maxval,g1*fade1/maxval,b1*fade1/maxval,xfade);
 image(movie1, 0,0,width, height);

 tint(r2*fade2/maxval,g2*fade2/maxval,b2*fade2/maxval,maxval-xfade);  
 image(movie2,0,0,width,height);

}

void movieEvent(Movie m) {
 if(m == movie1) {
   movie1.read();
 }
 else if(m == movie2) {
   movie2.read();
 }
}


Page Index Toggle Pages: 1