#include <signal.h> /* for kill */
#include <unistd.h> /* fork & execlp */
#define MID "YOURMIDIFILE.mid"
int play_midi(void) {
  int pid; /* process id of playmidi */
  if ((pid=fork()))
    return(pid); /* return process id */
  execlp("playmidi","playmidi",MID,00);
  return 0; /* to placate gcc */
}
int main(void) {
  int pid; /* playmidi process id */
  long int c; /* just a counter */
  pid=play_midi(); /* here we go! */
  for (c=1; c>0; c++) {
    /* this counts for a while as the music
     * plays. you could do anything here,
     * ie a scrolltext and artsy animation!
     */
  }
  kill(pid,1); /* kill playmidi process */
  return 1; /* and exit our program */
}
