diff -u jack-keyboard-1.5/jack-keyboard.c jack-keyboard-1.5-channel/jack-keyboard.c
--- jack-keyboard-1.5/jack-keyboard.c	2007-03-06 12:42:46.000000000 +0200
+++ jack-keyboard-1.5-channel/jack-keyboard.c	2007-03-19 15:11:17.000000000 +0200
@@ -90,6 +90,9 @@
 /* Number of currently selected bank. */
 int		bank = 0;
 
+/* Number of currently selected channel (0..15) */
+int		channel = 0;
+
 void draw_note(int key);
 void queue_message(int b0, int b1, int b2);
 
@@ -539,7 +542,7 @@
 	for (i = 0; i < NNOTES; i++) {
 		if (notes[i].currently_playing && !notes[i].sustain) {
 			notes[i].currently_playing = 0;
-			queue_message(NOTE_OFF, i, velocity);
+			queue_message(NOTE_OFF + channel, i, velocity);
 			draw_note(i);
 		}
 	}
@@ -553,7 +556,7 @@
 	for (i = 0; i < NNOTES; i++) {
 		if (notes[i].currently_playing && notes[i].sustain) {
 			notes[i].currently_playing = 0;
-			queue_message(NOTE_OFF, i, velocity);
+			queue_message(NOTE_OFF + channel, i, velocity);
 			draw_note(i);
 		}
 	}
@@ -577,7 +580,7 @@
 
 	notes[key].currently_playing = 1;
 
-	queue_message(NOTE_ON, key, velocity);
+	queue_message(NOTE_ON + channel, key, velocity);
 	draw_note(key);
 
 	return 1;
@@ -604,7 +607,7 @@
 
 	notes[key].currently_playing = 0;
 
-	queue_message(NOTE_OFF, key, velocity);
+	queue_message(NOTE_OFF + channel, key, velocity);
 	draw_note(key);
 
 	return 1;
@@ -619,20 +622,20 @@
 	 * These two have to be sent first, in case we have no room in the
 	 * ringbuffer for all these NOTE_OFF messages sent five lines below.
 	 */
-	queue_message(CONTROLLER, ALL_NOTES_OFF, 0);
-	queue_message(CONTROLLER, ALL_SOUND_OFF, 0);
+	queue_message(CONTROLLER + channel, ALL_NOTES_OFF, 0);
+	queue_message(CONTROLLER + channel, ALL_SOUND_OFF, 0);
 
 	for (i = 0; i < NNOTES; i++) {
 		release_key(i);
 
-		queue_message(NOTE_OFF, i, 0);
+		queue_message(NOTE_OFF + channel, i, 0);
 		usleep(100);
 	}
 
-	queue_message(CONTROLLER, HOLD_PEDAL, 0);
-	queue_message(CONTROLLER, ALL_CONTROLLERS_OFF, 0);
-	queue_message(CONTROLLER, ALL_NOTES_OFF, 0);
-	queue_message(CONTROLLER, ALL_SOUND_OFF, 0);
+	queue_message(CONTROLLER + channel, HOLD_PEDAL, 0);
+	queue_message(CONTROLLER + channel, ALL_CONTROLLERS_OFF, 0);
+	queue_message(CONTROLLER + channel, ALL_NOTES_OFF, 0);
+	queue_message(CONTROLLER + channel, ALL_SOUND_OFF, 0);
 	queue_message(RESET, -1, -1);
 }
 
@@ -737,7 +740,7 @@
 	if (key == '*') {
 		if (event->type == GDK_KEY_PRESS && program < 127) {
 			program++;
-			queue_message(PROGRAM_CHANGE, program, -1);
+			queue_message(PROGRAM_CHANGE + channel, program, -1);
 			update_window_title();
 		}
 
@@ -747,7 +750,7 @@
 	if (key == '/') {
 		if (event->type == GDK_KEY_PRESS && program > 0) {
 			program--;
-			queue_message(PROGRAM_CHANGE, program, -1);
+			queue_message(PROGRAM_CHANGE + channel, program, -1);
 			update_window_title();
 		}
 
@@ -757,7 +760,7 @@
 	if (event->keyval == GDK_Home) {
 		if (event->type == GDK_KEY_PRESS && bank < 127) {
 			bank++;
-			queue_message(CONTROLLER, BANK_SELECT_COARSE, bank);
+			queue_message(CONTROLLER + channel, BANK_SELECT_COARSE, bank);
 			update_window_title();
 		}
 
@@ -767,7 +770,7 @@
 	if (event->keyval == GDK_End) {
 		if (event->type == GDK_KEY_PRESS && bank > 0) {
 			bank--;
-			queue_message(CONTROLLER, BANK_SELECT_COARSE, bank);
+			queue_message(CONTROLLER + channel, BANK_SELECT_COARSE, bank);
 			update_window_title();
 		}
 
@@ -1075,7 +1078,8 @@
 void
 usage(void)
 {
-	fprintf(stderr, "usage: jack-keyboard [-Vnk]\n");
+	fprintf(stderr, "usage: jack-keyboard [-Vnk] [-c <channel>]\n");
+	fprintf(stderr, "   where <channel> is MIDI channel to use for output, from 1 to 16\n");
 
 	exit(EX_USAGE);
 }
@@ -1085,7 +1089,7 @@
 {
 	int ch;
 
-	while ((ch = getopt(argc, argv, "Vnk")) != -1) {
+	while ((ch = getopt(argc, argv, "Vnkc:")) != -1) {
 		switch (ch) {
 			case 'V':
 				show_version();
@@ -1099,6 +1103,15 @@
 				allow_connecting_to_jack_keyboard=1;
 				break;
 				
+			case 'c':
+				channel = atoi(optarg);
+				if (channel < 1 || channel > 16) {
+					break;
+				}
+				printf("channel %d\n", channel);
+				channel--; /* 1..16 -> 0..15 */
+				break;
+				
 			case '?':
 			default:
 				usage();
