Processing proMIDI

Bookmark this on Google Bookmarks
LINEで送る
Pocket

processingでMIDIデータの送受信を行いたい場合、proMIDIを使う。

proMIDI
http://creativecomputing.cc/p5libs/promidi/

import方法
zipファイルを解凍してprocessingのlibrariesフォルダへ置き、processingメニューのSketchからimport libraryでpromidiを選択する。あるいは、./codeフォルダを作成し解凍したファイルを置く。

input,output機器一覧を表示するサンプル

import promidi.*;

MidiIO midiIO;

void setup(){
  midiIO = MidiIO.getInstance(this);
  println("printPorts of midiIO");
  midiIO.printDevices();
  println();

  /*
   * Does the same like printDevices by
   * printing the input and output devices
   */
  println("printDevices recoded 1");
  midiIO.printInputDevices();
  midiIO.printOutputDevices();
  println("<<<<<<<<<   >>>>>>>>>>>>>>>>>>>>>");
  println();

  /*
   * Does the same like printDevices by iterating
   * over the devices and print out their names
   */
  println("printDevices recoded 2");
  println("<< inputs: >>>>>>>>>>>>>>>>>>>>>>");
  for(int i = 0; i < midiIO.numberOfInputDevices();i++){
    println("input  "+nf(i,2)+": "+midiIO.getInputDeviceName(i));
  }
  println("<< outputs: >>>>>>>>>>>>>>>>>>>>>");
  for(int i = 0; i < midiIO.numberOfOutputDevices();i++){
    println("output "+nf(i,2)+": "+midiIO.getOutputDeviceName(i));
  }
  println("<<<<<<<<<   >>>>>>>>>>>>>>>>>>>>>");
}

MacにAkaiのLPK25を接続して実行した結果は以下。

printPorts of midiIO
<< inputs: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
input 0 : LPK25
<< outputs: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
output 0 : LPK25
output 1 : Java Sound Synthesizer
<<>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

printDevices recoded 1
<< inputs: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
input 0 : LPK25
<< outputs: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
output 0 : LPK25
output 1 : Java Sound Synthesizer
<<<<<<<<<   >>>>>>>>>>>>>>>>>>>>>

printDevices recoded 2
<< inputs: >>>>>>>>>>>>>>>>>>>>>>
input  00: LPK25
<< outputs: >>>>>>>>>>>>>>>>>>>>>
output 00: LPK25
output 01: Java Sound Synthesizer
<<<<<<<<<   >>>>>>>>>>>>>>>>>>>>>