FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Tools
(Moderator: REAS)
   midi library: is it possible to "share" the input?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: midi library: is it possible to "share" the input?  (Read 910 times)
lunetta

7200475272004752 WWW Email
midi library: is it possible to "share" the input?
« on: Nov 10th, 2004, 9:17pm »

Hello all
 
I have a question regarding the nice midi library.
I haven't tested it yet, because I don't have a midi controller; but I might use one for a project.
 
My question is: is it possible to use the midi input for a standalone synthetiser at the same time I'm using it in Processing?
 
The standalone application would produce the sound, and Processing would take care of the visual.
 
I would be using a USB controller, in a mac environmment (maybe even a PC if necessary)
 
Any ideas?
Thanks!
 
 
tex

WWW
Re: midi library: is it possible to "share" the in
« Reply #1 on: Nov 10th, 2004, 11:43pm »

http://www.midiox.com/index.htm?http://www.midiox.com/myoke.htm
 
try this to route midi between apps on your computer.
 
With Midiyoke you should be able to share the incoming videodata. I used it to controll processing from a sequencer.
 
lunetta

7200475272004752 WWW Email
Re: midi library: is it possible to "share" the in
« Reply #2 on: Nov 12th, 2004, 6:49pm »

That's nice, thanks.
Any ideas for Mac os X?
 
 
mungbean

pixelfrenzy WWW
Re: midi library: is it possible to "share" the in
« Reply #3 on: Nov 13th, 2004, 11:30pm »

Bom dia Lunetta,
 
You don't need an equivalent of MidiYoke for OSX... it can already share MIDI ports.
 
I have a simple P5 MIDI app here running at the same time as SimpleSynth (http://pete.yandell.com/software/), a basic but perfectly useable GM softsynth.  
 
Although you don't need for sharing, I can strongly recommend MIDImonitor (http://www.snoize.com/MIDIMonitor/), which gives you all  kinds of filtering and monitoring options.  Really useful for checking that your app is receiving the data that it should be receiving...
 
Tex - could you email me on pixelfrenzy AT mungbean DOT net then maybe we could co-ordinate testing your MIDI library on OSX?  I've hacked it a little but would like to ask you about some of the code to make sure I didn't break it.
 
 
mungbean

pixelfrenzy WWW
Re: midi library: is it possible to "share" the in
« Reply #4 on: Nov 14th, 2004, 12:52pm »

A quick example using promidi library to visualise incoming MIDI notes using a Goethe-like colour mapping...  works fine from inside the P5 IDE but I can't get this to run in a browser. But this may be my Java installation or something (I'm not seeing anything about security exceptions, just won't load).  Would be interested to know if this works for other people who've been using promidi.
 
I've been using OSX 10.3.6, Processing 68 alpha, and an M-audio Oxygen8 MIDI/USB keyboard for testing.
 
Code:

// visualising  MIDI input 13-Nov-04
// Chris Hand www.mungbean.net
 
// display up to MAXNOTES at a time.
 
MidiIn midiIn; // requires promidi library
 
int MAXNOTES = 16;
 
int note, i;
int x = 0, n = 0;
 
float dec = 1.414; // how much to decrement radius each iteration
float ainc = TWO_PI / 4.0; // how much to rotate around centre each iteration
 
int cx, cy;
int noteNum;
 
float[] sina = new float[MAXNOTES];  // sine of angular position
float[] cosa = new float[MAXNOTES];  // cosine of angular position
float[] ang  = new float[MAXNOTES];  // store current angle
 
color[] col  = new color[MAXNOTES];  // blob colour
float[] rad  = new float[MAXNOTES];    // distance from centre of circle
 
color[] c = new color[12]; // colour look-up table
float[] a = new float[12]; // angle look-up table
 
int MIDIchannel = 0;  // 0 = channel 1
 
void setup()
{
  // basic Goethe-esque colour-mapping for now.
  // position on clock face based on circle of 5ths.
 
  c[ 0] = color(219,  34, 135); a[ 0] =   0; // C
  c[ 1] = color( 53, 146,  91); a[ 1] = 210; // C#
  c[ 2] = color(242,  71,  15); a[ 2] =  60; // D
  c[ 3] = color( 25, 101, 184); a[ 3] = 270; // D#
  c[ 4] = color(255, 241,  12); a[ 4] = 120; // E
  c[ 5] = color(151,  49, 142); a[ 5] = 330; // F
  c[ 6] = color( 65, 142,  12); a[ 6] = 180; // F#
  c[ 7] = color(227,  48,  12); a[ 7] =  30; // G
  c[ 8] = color( 13, 117, 197); a[ 8] = 240; // G#
  c[ 9] = color(248, 125,  11); a[ 9] =  90; // A
  c[10] = color( 71,  56, 140); a[10] = 300; // A#
  c[11] = color(116, 171,  10); a[11] = 150; // B
 
  for (n = 0; n < MAXNOTES; n++) {
    rad[n] = 0;
  }
 
  // Make a new MidiInputObject and open it
  midiIn = new MidiIn();
  midiIn.showAvailableInputs();
  midiIn.openInput(2);
 
  size(320,320);
  ellipseMode(CENTER_DIAMETER);
  noStroke();
 
  framerate(25);
 
}
 
void loop()
{
  if (midiIn.triggered(MIDIchannel)) {
    note = midiIn.getNote(MIDIchannel);
 
    x = ++x % MAXNOTES; // wrap round when max reached
 
    rad[x]  = midiIn.getVelocity(MIDIchannel);
 
    i = note % 12;
    col[x] = c[i];
    ang[x] = a[i];
 
  }
 
  background(#ffffff);
 
  // drawn all blobs
  for (n = 0; n < MAXNOTES; n++) {
    if (rad[n] > 0) {
 cx = int(0.5 + (width / 2)  + (rad[n] * sin(radians(ang[n]))));
 cy = int(0.5 + (height / 2) + (rad[n] * cos(radians(ang[n]))));
 
 fill(red(col[n]), green(col[n]), blue(col[n]), rad[n] * 2);
 ellipse(cx, height - cy, rad[n], rad[n]);
 rad[n] -= dec;
 ang[n] += ainc;
    }
  }
 
}
 
 
 
mungbean

pixelfrenzy WWW
Re: midi library: is it possible to "share" the in
« Reply #5 on: Nov 14th, 2004, 3:11pm »

Just came across this and it's great!
 
MIDIpipe is like Windows' MidiYoke, in that it provides virtual ins and outs and allows routing between apps etc.  It also has a lot more, including DLS softsynth support and even the ability to run ActionScript to process specific MIDI events.  Also plays SMFs. It's freeware.
 
http://www.apple.com/downloads/macosx/audio/midipipe.html
 
 
 
lunetta

7200475272004752 WWW Email
Re: midi library: is it possible to "share" the in
« Reply #6 on: Nov 15th, 2004, 8:00pm »

That's great; thanks for all feedback
(grato mungbean)
 
Pages: 1 

« Previous topic | Next topic »