AMIDI library (small preview)

I haven’t written anything for a long time, so I will try to fix that.
After all it it shouldn’t look that I’m doing nothing at all ;). Last few months were quite busy with real life(tm) and move to new HQ.
Luckily I’ve set up my machines and pushed forward with my project, on which I’m working with smaller or bigger pauses, since beginning of September this year.
So I would like to tell something about it.

Small introduction…

If there are persons who are tracking opensource projects like ScummVM/Exult/DOSbox then for sure
they know about problems with MIDI file replay (in different forms).
Old module software emulation isn’t 100% perfect, instrument sets are different between across MIDI devices (we could take as an example the old Roland MT-32 and newer devices in GM/GS standard) what affects
the overall approach to MIDI file replay.
As I am, from the pretty long time, sharpening teeth on porting the Exult project (Ultima VII (Origin) interpreter) to Atari Falcon 030 I’ve noticed some gaps in Atari software in general.
In spite of having pretty good sequencers for Atari ST/TT/Falcon range like Cubase, Sweet16 and so on, there is:

  1. No good, simple application/library for MID(0,1,2), XMI, SMF replay from playlist (of course using all available RAM (ST-RAM and FastRam)).
  2. No good support for MIDI ports in SDL_mixer library .
  3. No libraries that could replay all the mentioned above file formats in TOS and MiNT OS and that could be used in other projects (with performance and easy operation in mind).
    Current ports of Doom, Hexen, Heretic are without MIDI music. Software emulation of sound synthesis of old modules like MT-32 (MUNT) or newer in GM standard for 16/32 bit Atari’s is not feasible
    (even the fastest PCs aren’t preforming well in this area).
  4. Sequencers doesn’t handle well SysEx data embedded in midi files. You need external programs.

So, what is possible?

  • All Atari 16/32 bit are equipped with MIDI ports(IN/OUT) since ’85 (shocking! like a free beer). I will not mention the fact that sending/receiving midi data is possible through RS232 port, but for our purposes it isn’t essential, because in our approach we are handling one external device at time of given type (Roland MT-32 or GM/GS compatible ).
  • Old modules like Roland MT-32/CM-32L/CM-64/CM-500/SC-55 are freely available. The cost isn’t high (of course it depends).
    In general they are availalable on eBay.
  • Falcon030 has super sophisticated sound matrix, which can be used for mixing sound from the external source (eg. our external MIDI synth).
    So we have the possibility to use our machine as mixer (alternatively we can use external mixer).

Here we are approaching the software topic – there is none I know of… If it is then it’s not free or open ended. It has to be done ;)).. And here is my AMIDI library (some sort of abbreviation from Atari MIDI, I know not very original).
The project isn’t finished yet (I can say that it reached the half completion state, so it’s the reason behind writing this post.
In the first official release I will publish full source code and documentation (under GPL v.3). At this moment everything is written in Pure C, but I plan to migrate the whole code base to gcc 4.3.2 and adding some sort of c++ wrapper.

What has been done:

  • MIDI (0,1,2) decoding, implemented and handled all the essential stuff that can be found in MIDI files.
  • sending MIDI commands (full set) through built in Atari MIDI OUT port
  • basic functions to handle and change settings of Roland modules (LA,GS)
  • fully configurable default MIDI buffer lenght (no more “MIDI buffer overflow”)


  • putting decoded events to the structure optimal for 16/21 bit Atari’s. It will depends on actual module setting. (eg. change of instrument mapping (MT32->GS),(GS->MT32), preloading of SysEx data before music replay )
  • design and implementation of functions which will replay given list of MIDI events from preparied earlier structure (no additional computations, only traversion throught the event list and sending midi data from the MIDI buffer)
  • implementation of external module state management
  • functions for handling Falcon030 sound matrix
  • decoding and handling of special MIDI controllers in XMIDI files
  • SMF decoding (MID written in EA IFF with BE byte order and no byte padding)
  • RMID decoding (or MID written in EA IFF standard and in Little Endian byte order)
  • adding functionality for loading SysEx data from external files (without the need of using external programs/librarians)
  • tests, tests, more tests

After implementation of the main functionality time will come to write client, which will be using this library (I haven’t decided yet if it will be using GEM GUI or custom graphical interface). It will be possible to create Atari midi driver for SDL_mixer.
I will post more info soon….

About this entry