libmikmod is a library that the MikMod tracker music player uses internally. It is distributed under LGPL. It plays not only modules, but is also capable of playing single samples. It's able to use single files and load things from specified offset from opened file. The user doesn't need to worry of things like actual output drivers, unless they specifically want to. The library supports both software and hardware mixing.

In other words, an one-stop digital audio solution for game/demo musicians and programmers...

The library is available for many platforms - UNIXes and Windows at least. A port of an old - I dare to say ancient - version also exists for Java!

Famous programs that use libmikmod include XMMS and Winamp.

Following is an example of libMikMod code for C.


/*
  simpleplay.c
  (c) WWWWolf 6.2.1999
  Commented better by WWWWolf, 2001-11-13
  Do whatever you want with this, but keep this message here.
  No warranty whatsoever.

  Uses MikMod 3.1 library, no idea if it still compiles =)


  FIXME: Should check that we actually have something in varg[1] and
  that the parameters are correct - and we should bail out in case
  of errors, too. Some messages could do no harm either. =)
 */

#include <unistd.h>
#include <mikmod.h>
     
int main(int carg, char **varg)
{
  /* This is where our module is stored. */
  MODULE *mod;

  /* These will do exactly what's intended: Get all output drivers
      and module/file loaders up and running... */
  MikMod_RegisterAllDrivers();
  MikMod_RegisterAllLoaders();

  /* Initialize libmikmod. */     
  MikMod_Init();

  /* Load the module. */
  mod = Player_Load(varg[1],128,0);

  /* Start playing the module. */
  Player_Start(mod);

  /* While the thing is playing, update the mikmod status. Sleep
     for a while. After we've tossed stuff to the output driver,
     we *could* do stuff here with the output data, display cool
     numeric information, blah blah...
  */
  while(MikMod_Active()) {
    MikMod_Update();
    usleep(500);
  }

  /* Okay, done? Let's stop the module and free the module,
     and mop up the mikmod engine in general... */
  Player_Stop();
  Player_Free(mod);
  MikMod_Exit();
}

"MikMod" is a module playback engine, of which there must be a million different source forks.

It used to be a popular sound engine for demo coders because it was one of the first freely available players with .xm support.

One version that was particular popular amongst wannabe democoders was the turbo pascal edition, MikPas. Unfortunately, since it needed to run in real mode with 640k ram it only supported the Gravis Ultrasound. Not that the GUS is a bad soundcard, far from it, but it's a shame all those old lamerproductions aren't as accessible anymore. (Yes, I know about GUSEmu).

.UNI is the internal mod format used by MikMod, but not all players (MikAmp for WinAmp comes to mind) supports loading this internal format, which is also a shame since you can rip quite a few good soundtracks from demos which unfortunately are in .UNI format.

The original versions were written for DOS and direct hardware access, and could be linked from asm, C and pascal. Later versions were ported to unix and java.

Later, better (as in more accurate playback - true-to-the-tracker playback, higher quality and better hardware support) such as the Inhouse Music System (based on the same codebase as CubicPlayer, which used to be closed source at the time - but now is available as OpenCubicPlayer and possibly has fallen victim of bitrot) were preferred for DOS Demos.

Log in or register to write something here or to contact authors.