diff -ur fluidsynth-1.1.3.orig/include/fluidsynth/midi.h fluidsynth-1.1.3/include/fluidsynth/midi.h
--- fluidsynth-1.1.3.orig/include/fluidsynth/midi.h	2010-10-10 21:16:30.000000000 -0400
+++ fluidsynth-1.1.3/include/fluidsynth/midi.h	2011-05-04 18:54:50.000000000 -0400
@@ -122,6 +122,7 @@
 };
 
 FLUIDSYNTH_API fluid_player_t* new_fluid_player(fluid_synth_t* synth);
+FLUIDSYNTH_API fluid_player_t* new_fluid_player2(fluid_synth_t* synth, handle_midi_event_func_t user_callback, void* user_data);
 FLUIDSYNTH_API int delete_fluid_player(fluid_player_t* player);
 FLUIDSYNTH_API int fluid_player_add(fluid_player_t* player, const char *midifile);
 FLUIDSYNTH_API int fluid_player_play(fluid_player_t* player);
diff -ur fluidsynth-1.1.3.orig/src/midi/fluid_midi.c fluidsynth-1.1.3/src/midi/fluid_midi.c
--- fluidsynth-1.1.3.orig/src/midi/fluid_midi.c	2010-10-10 21:16:30.000000000 -0400
+++ fluidsynth-1.1.3/src/midi/fluid_midi.c	2011-05-04 18:56:27.000000000 -0400
@@ -1080,6 +1080,9 @@
 			fluid_synth_handle_midi_event (synth, event);
 		else if (player) fluid_player_set_midi_tempo (player, event->param1);
 
+		if (player && player->user_callback)
+			(*player->user_callback)(player->user_data, event);
+
 		fluid_track_next_event(track);
 
 	}
@@ -1133,6 +1136,26 @@
 }
 
 /**
+ * Create a new MIDI player with optional callback function and user data.
+ * @param synth Fluid synthesizer instance to create player for
+ * @param user_callback A callback function to be fired as each midi event is passed to the synth, or NULL for no callback
+ * @param user_data Optional user data passed to the callback function, or NULL if no user data
+ * @return New MIDI player instance or NULL on error (out of memory)
+ */
+fluid_player_t* new_fluid_player2(fluid_synth_t* synth, handle_midi_event_func_t user_callback, void* user_data)
+{
+	fluid_player_t* player;
+
+	player = new_fluid_player(synth);
+	if (player) {
+		player->user_callback = user_callback;
+		player->user_data = user_data;
+	}
+
+	return player;
+}
+
+/**
  * Delete a MIDI player instance.
  * @param player MIDI player instance
  * @return Always returns #FLUID_OK
diff -ur fluidsynth-1.1.3.orig/src/midi/fluid_midi.h fluidsynth-1.1.3/src/midi/fluid_midi.h
--- fluidsynth-1.1.3.orig/src/midi/fluid_midi.h	2010-10-10 21:16:30.000000000 -0400
+++ fluidsynth-1.1.3/src/midi/fluid_midi.h	2011-05-04 18:50:54.000000000 -0400
@@ -291,6 +291,9 @@
   int miditempo;            /* as indicated by MIDI SetTempo: n 24th of a usec per midi-clock. bravo! */
   double deltatime;         /* milliseconds per midi tick. depends on set-tempo */
   unsigned int division;
+  
+  handle_midi_event_func_t user_callback; /* optional user callback function fired on each midi event as it is played */
+  void* user_data;          /* pointer to user-defined data passed to user_callback function */
 };
 
 int fluid_player_add_track(fluid_player_t* player, fluid_track_t* track);
