GSI: General sound interface


On this page:
Latest changes
Applications using GSI
Test data
What needs to be done...
Example (for the 0.8.x API)

For more information:
Detailed overview of GSI
Applications included with GSI (gsifile, gsiplay).

Suggestions to improve the API or code are welcomed. Help at implementing unfinished stuff too of course..

Latest changes


GSI is an easy to use audio system which can be used over a network and which gives applications, through a very simple API, sample playing with stereo, 3D, doppler effects, music playing (MIDI, HMP, MUS), cd playing and ejecting/changing.

GSI also contains a separately usable sound/music loading/saving/format conversion library libgsif (au/aiff/voc/wav/raw, midi/hmp/mus), although saving/format conversion is not completely done.

GSI runs on any unix system that has generic /dev/audio (8000Hz mono mulaw), OSS, ultrasound project drivers, or NAS (well, it did once, I need to update the NAS stuff), e.g. Linux, OpenBSD and FreeBSD. CD playing is dependant on the OS' ioctl's and structs so that probably works on Linux / *BSD only (solaris may work, as it seems to use the same ioctl's/structs as linux).

The goals of GSI are:
1. Simple to use
2. Support all audio devices
3. No compromises in functionality
This means, advanced stuff should be possible (with the least effort possible), and simple things should be very simple to set up.

Here is an detailed overview of GSI and information on the applications included with GSI (gsifile, gsiplay).

Applications using gsi

Note that these all use the 0.8.x API, not the newer API from 0.9.x.


More or less stable releases: Install note for ultrasound drivers (linux): You must manually copy libgus_icfg.h (ultra-2.99a-devel4/src/driver/libgus/icfg/libgus_icfg.h) to /usr/local/include/ (or where you installed) after installation of these drivers.

Note: OSS upgrade: If you're running a linux 2.0.x kernel and use OSS, get OSS 3.8s9 (earlier OSS versions are NOT usable with GSI, see the README with GSI detailing some of the problems with OSS 3.5): oss-free

Development versions (GSI 0.9.x, largely rewritten and with better API):
Removed due to lack of feedback/interest.

Test data:

Samples: Songs:

Not yet done:

Some of these I'm working on at the moment:
  1. Integrate Keith Packard's midi player for midi/hmp/mus playing on sound cards that don't have a synthesizer.
  2. Saving and samplerate conversion in libgsif is incomplete.
  3. Events (like in X and GGI) instead of callbacks. Much more programmer friendly.
  4. Finish SYSV shared memory use for streams etc.
  5. Assembler sample-mixing code?
  6. If you know windoze & directX, a windoze directsound port of gsi would be great (I should say: interesting ;). I don't know the low level issues involved.
Mail me if you're interested in helping.


  1. Is the (ancient 1995) OSS OPL octave bug fixed or not in OSS 3.8? From a test with musserver it seems not. Haven't had to time to test more on the OPL. Anyone out there know this?

Example (for the 0.8.x API)

gsi_init(NULL); /* connect to gsi_server on the local host (unless the environment variable GSI_HOST is set) */

  /* where all files can be found by the server */

gsi_init_pcm(8000 /* samplerate */, 2 /* channels */, GSI_8BIT /* sample type */, 0 /* fragsize */);
  /* note that channels = 2 means stereo, a fragsize of 0 is used to let the server determine
   * a good fragsize */

gsi_load_sample(0, "");
  /* relative path => loads the file /home/wouter/sounds/ in slot 0 */

gsi_load_sample(1, "/usr/share/games/pool/poolball.voc");
  /* absolute path => loads the file /usr/share/games/pool/poolball.voc in slot 1 */

gsi_play_sound_pan(-1 /* =automatic channel allocation */, 0 /* sound 0 */, 0 /* center */);
  /* plays centered */

gsi_play_sound_pan(0 /* channel 0 */, 1 /* sound 1 */, -256 /* left */);
  /* plays poolball.voc on the left */

  /* sends the above commands to the server (playing will then start immediately) */


Can it be any simpler than this ?

Note that this is only network transparent if files are used from mirrored locations (the server loads files itself to avoid sending them over the network, this is usually possible for files in e.g. /usr/share/). Otherwise the way to do this is as follows:

	gsi_sound *snd;

	snd = gsif_load_sample("../../../gsi_data/sample/au/", 0);
	/* we're only sending block 0 */
	gsi_send_raw_sample(19, snd->block[0]->samplerate, snd->block[0]->channels, snd->block[0]->type, snd->block[0]->data_length, snd->block[0]->data);
This will be all made easier later by
  1. automatic reversal to gsi_send_raw_data by libgsi if the server couldn't load a mirrored file.
  2. addition of gsi_send_sample which loads all blocks (most sample formats use just one block btw.)

Old whs @ (remove the spaces)

Brought to you by: SourceForge Logo