Muzic MIDI sound package
Not logged in

muzic command


muzic - a MIDI sound package compatible with Muzic.


package require Muzic
muzic::subcommand ...


muzic is a Tcl music interface to the Sonivox MIDI rendering (software synthesis) library on Android. The original package was developed by Steve Landers and is Copyright (c) 2005 Eolas Technologies Inc. It is released under a Tcl/BSD style license.

To use Muzic, no special provisions are needed, since it is fully integrated in AndroWish.

The Muzic API contains just five procedures:


Must be called once to initialize audio playback.

muzic::soundfont file

This command exists for compatibility with the original package. It can be called with no arguments or with builtin. Everything else throws an error since the Android software synthesizer has no support for SoundFont files.

muzic::channel channel instrument

Assigns an instrument to a channel. channel is an integer from 0 to 15 identifying the MIDI channel. instrument is the instrument number, typically a MIDI instrument number from 0 to 127.

muzic::playnote channel pitch volume ?duration?

Plays a note on specified channel, at specified pitch and volume. The pitch is the raw MIDI pitch, as per the general midi standard - where middle C is 60 (see which has a table of MIDI pitch values). volume is a number between 0 and 100. duration is optional, and defaults to 500 (i.e. 500 ms). If a negative duration is given, the note is played continuously. If a volume of zero is given, playback of the note ends.


To be called when MIDI audio playback shall be stopped in order to conserve battery power.