/** * This example shows how to route playback to an external * MIDI synthesizer. The availible devices are printed, then * the preferred device is set. Playback is controlled by the * slowed down draw thread. * * A SoundCipher example by Andrew R. Brown */ import arb.soundcipher.*; SoundCipher sc1 = new SoundCipher(this); //SoundCipher sc2 = new SoundCipher(); void setup() { SoundCipher.getMidiDeviceInfo(); sc1.setMidiDeviceOutput(1); //sc1.channel(0); //sc2.channel(1); //sc2.setMidiDeviceOutput(1); frameRate(20); } void draw () { } void keyPressed() { if (key == 'w') { //sc1.playNote(60, 100, 1); sc1.sendMidi(sc1.NOTE_ON, 0, 60, 100); } if (key == 'a') { sc1.sendMidi(sc1.NOTE_ON, 0, 62, 100); } if (key == 's') { sc1.sendMidi(sc1.NOTE_ON, 0, 63, 100); } if (key == 'd') { sc1.sendMidi(sc1.NOTE_ON, 0, 65, 100); } if (key == 'f') { sc1.sendMidi(sc1.NOTE_ON, 0, 67, 100); } if (key == 'g') { sc1.sendMidi(sc1.NOTE_ON, 0, 68, 100); } if (key == 'h') { sc1.sendMidi(sc1.NOTE_ON, 0, 70, 100); } if (key == 'j') { sc1.sendMidi(sc1.NOTE_ON, 0, 72, 100); } if (key == CODED) { if (keyCode == UP) { //sc1.sendMidi(sc1.NOTE_ON, 1, 36, 100); sc1.sendMidi(sc1.NOTE_ON, 0, 59, 100); } if (keyCode == DOWN) { //sc1.sendMidi(sc1.NOTE_ON, 1, 37, 100); sc1.sendMidi(sc1.NOTE_ON, 0, 56, 100); } if (keyCode == LEFT) { //sc1.sendMidi(sc1.NOTE_ON, 1, 38, 100); sc1.sendMidi(sc1.NOTE_ON, 0, 55, 100); } if (keyCode == RIGHT) { sc1.sendMidi(sc1.NOTE_ON, 1, 36, 100); } } }