Edgar Huckert: Music programming

More articles on music programming see here, here and here.

Playing synthesized chords under Windows

Playing sounds under Windows is surprisingly complicated if you want to implement musical applications that go beyond the playing of simple files. I explain in this PDF article how the Windows sound API can be used to play simultaneously sounds via a single audio device, i.e. how to mix sounds. The article discusses the advantages and drawbacks for two different solutions. You will find the code, exes and some sample WAVE files in this ZIP file. The code uses threads, callback functions and events - it is certainly not for beginners.

How to use the ALSA API

When porting my program HUMidi to Linux/Ubuntu I looked for a simple sample program demonstrating how to play notes via the Linux/Alsa sequencer. To my extreme confusion all sample files I found (like pmidi.c, aplaymidi.c etc.) were extremely complicated. Moreover they all demonstrated bad C-programming style. Many of the sample file and tutorials I found confuse the APIs (OSS, Alsa) and concentrate in the largest part on the analysis of MIDI tracks. The organisation of MIDI files in tracks is not a simple MIDI topic and plays a secondary role (if any!) in the production of audible MIDI events. The applications mentioned in those tutorials (among them JACK, PulseAudio etc) have nothing to do with MIDI (but with sound administration in general).

I therefore wrote this small C Program alsa_midieh.c that concentrates on the essential problem: how to hear MIDI sound under Linux using the Alsa interface. This program simply plays some MIDI notes and a chord using the Alsa API. It doesnt use the queue mechanisms offered by the API. The time problem is handled by simple sleep() calls. The queuing of MIDI events and the timing problem can be solved by application features instead of using the corresponding API features - may be at the cost of loosing time precision. Most of the obscure C language features found in the original ALSA sampleprograms (extended use of global variables, use of "static" at many points etc.) have been eliminated.

An important note for MIDI novices in Linux: Linux has no built-in MIDI player. Normally Timidity or a similar player must be running to hear MIDI events. See the comments in my C program. This simple program is the base for my MIDI C++ classes used in HUMidi and in my upcoming notation editor HUNoteEd.

Music notation formats

With my brother Klaus Huckert I wrote an overview paper (in German) that tries to explain the essential music notation formats that are currently in use. The paper is called "Auf dem Weg zu einem universellen Austauschformat für Musiknotation". You will find here information on formats like ABC, Midi or MusicXML.

An extract from the document on music notation

Copyright for all images, texts and software on this page: Dr. E. Huckert


If you want to contact me: this is my
mail address