Problems connecting a MIDI controller

Hi all. As a general disclaimer I'm still pretty new to programming in general, and to audio stuff in particular.

I have a sketch that plays a random note from a selection when the user presses a key on the computer keyboard. It uses the soundCipher library and it works just the way I want it to. The next thing that I'm trying to do is exactly the same thing, but using a USB MIDI controller [akai LPK25] instead of the computer keyboard. Seems straighforward enough. I am trying to set it up using the promidi library. When I use promidi to printDevices() I can see that the controller [akai LPK25] is recognised (as both an input and an output, though it's just a controller):

<< inputs: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> input 0 : LPK25 << outputs: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> output 0 : Gervill output 1 : LPK25

The controller is definitely recognised for eg. drawing random circles and printing to the console, but I can't get any sound. All of the sketches that I have which generate sound go mute as soon as I plug in the USB controller. Am I overlooking something really obvious?

I've attached my code below. This is supposed to play a random note from the list chooseFrom and draw a random ellipse when a note is pressed. I get the ellipse, but I don't get the note.

All and any help is greatly appreciated :)


    import promidi.*;
    import arb.soundcipher.*;

    MidiIO midiIO;


    SoundCipher sc = new SoundCipher(this);
    int[] chooseFrom = {36,38,40,43,45,48,50,52,55,57};

    void setup(){
      size(100,100);
      stroke(2);
      midiIO = MidiIO.getInstance(this);
      midiIO.printDevices();
      midiIO.openInput(0,0);
      midiIO.getMidiOut(0,0);
    }

    void noteOn(Note note, int device, int channel){
      int choice = int(random(chooseFrom.length));
      sc.sendMidi(sc.NOTE_ON,0,chooseFrom[choice], 100);
      ellipse(random(width),random(height), random(100), random(100));
      println("yep");
    }


    void draw(){
    }
Sign In or Register to comment.