MUSIC 4C (M4C), A Music Synthesis Program for the UNIX Environment

Music 4C (M4C) was orginally written by Scot A. Aurenz in 1985 as an enhanced translation of Music 4BF, a music program created at Princeton University in the late 1960's. Whereas 4BF was written entirely in Fortran and employs instrument definitions written in Fortran, M4C is written entirely in C for the Unix environment and employs instrument definitions written in C. Since 1985 the language has been developed extensively to make it more flexible and easy to use. Versions have been compiled for two different platforms:

 1) Macintosh Terminal; 2) PC Linux. 

M4C produces sequences of sounds organized according to specified start times, durations, pitches, and timbral qualities, with any desired degree of accuracy. There is practically no limit on the number of different timbres that can be generated, and any instrument can play against itself as many times as desired. There may be practical limits, but these would be due to the particular computer being used, not by the program. Moreover, any timbral synthesis algorithm can be programmed in the C language.

Like C Sound and C Music, Music 4C uses a score file which is an "event list", a series of "instrument statements" which designate start time, duration, pitch, amplitude, and other instrument parameters. Unlike C Sound, instruments and parameters are given by their names, although only the instrument names appear explicitly within instrument statements. (However, they are given in instrument definitions.) A typical instrument statement might look like:

/* name  start_time duration oct.pitch amplitude attack decay  */
I(trumpet  0           1)    {8.09      20000     .03    .06}

Note that C-style comments can also be used.

The numbers inside the parentheses () always refer to 'instrument name', 'start time' (in seconds), and 'duration' (in seconds).

The numbers inside the braces ({ }) are parameters defined by an instrument definition file for this particular instrument using, for example:

pitch	(0 16 octpitch 8)
amp	(0 32767 amplitude 20000)
ta	(0 20 sec 0.1)
td	(0 20 sec 0.5)

where on the first item (e.g., 'pitch') is the parameter name and the remaining items inside the parentheses refer to the max and min values, the parameter scale, and a typical value.

The first two parameters are usually pitch and amp, but not always.

An auxiliary program that comes with the M4C package, notepro, can be used to process scores that are alpha-numeric translations of ordinary musical notation into event lists. A simple 'notepro score' might look like this:

'trumpet' C D E/ F#/ G. A/ Bo

which translates into

I(trumpet, 0.000, 1.000) { 8.0000,   1024}
I(trumpet, 1.000, 1.000) { 8.0200,   1024}
I(trumpet, 2.000, 0.500) { 8.0400,   1024}
I(trumpet, 2.500, 0.500) { 8.0600,   1024}
I(trumpet, 3.000, 1.500) { 8.0700,   1024}
I(trumpet, 4.500, 0.500) { 8.0900,   1024}
I(trumpet, 5.000, 2.000) { 8.1100,   1024}

Notepro does not normally handle parameters other than instrument name, start time, duration, pitch, and amplitude, so other parameters must be edited in by hand or by a program, such as the 'scorpro' program provided with the M4C package. However, other versions of notepro have been made which generate score statements compatible with certain instruments.

A number of instruments have been coded for immediate use. For example, the theory and use of ten instruments in the 'Class Orchestra' are described by a tutorial manual, the Music 4C Introduction. Several other instruments, such as the Sample Instrument and the Additive Synthesis Instrument, are also included in the M4C package, although they are not discussed in the tutorial.

Sound synthesis code can be written by the user directly in the C language. The tutorial manual explains how to design instruments and compose orchestras from individual instruments.

Since M4C is a software synthesis language, music is not generally produced in real time. (However, there is a real time playback version of M4C.) The time required to produce a piece depends on the length of a piece, its complexity, the amount of other activity on the computer, and the speed of the computer. It runs on a variety of machines which employ the Unix operating system. As one moves to faster machines, the turn-around time to compute a piece becomes shorter and shorter.

An M4C Introduction manual can be printed from within the package or downloaded from this site, and then to actually make music. Output is normally in the form of snd sound files (monaural or stereo), but aiff and wave are also available.

M4C will run "as is" on both 32-bit and 64-bit PC Linux and Macintosh systems. If the user wishes to modify its C code and compile it on a 64-bit machine, he/she should verify that the i386 library package has been installed. This is because all M4C recompiles (using Makefiles which include the "-m32" option on the cc compile and link lines) require this library. So far, we have found that the i386 library is automatically included with Macintosh OS X 10.5-10.13, but recent Ubuntu Linux versions (e.g., v. 13.04) require special i386 installation. Unix code for implementing this (up to v. 13.04) is "sudo apt-get install g++-multilib", which installs the cc and i386 libraries. The i386 library alone can be installed using "sudo apt-get install libc6-dev-i386". Other necessary or useful downloads are tcsh (for the shell used with M4C) and 'sox' (for changing sound file formats), which can be obtained using "sudo apt-get install tcsh sox".

For an HTML Introduction to Music 4C tutorial click here:
M4C HTML Manual.
Thanks to Art Green for putting this together!

To download a PDF version of the Introduction to Music 4C tutorial click here:
M4C PDF Manual.

If you wish to obtain a source file copy of M4C, please register by sending the following information to James Beauchamp using the email link given below.

Example of what to send:
     Name:        John W. Jones
     Affiliation: University of Canterbury at Kent
     Address:     2136 Ornithology Bldg., 1114 W. Aviary, Kent, AB3 6ZP UK
     Phone:       +44-1344-330730
     Computer:    Pentium II Intel PC 
     Op. Sys.:    Linux (Redhat 8.0)
     Software Requested: Music 4C
     What is your application? bird song synthesis
     How did you hear about Music 4C? from the C Sound list

You will then receive instructions for downloading the software from a web site.

James Beauchamp Homepage

University of Illinois at Urbana-Champaign Homepage

JB's email link

last edited: 11/11/19