public void noteOff(int note, int velocity) {
        //find the voice that corrosponds to this key and release it
        for (int i = 0; i < voices.length; i++) {
            if (voices[i].midiNote == note && voices[i].isPressed) {
                voices[i].release();
                break;
            }
        }
    }