The MSQ Project

The MSQ Project was originally created by Siegfried Koepf and Bernd Haerpfer in 1998 needing a MIDI compatible computer system for algorithmic composition and score synthesis. It was carried on to the current level MSQ 2.0 by Siegfried Koepf. The idea was to have a platform independent, easily readable and editable file format qualified for algorithmic manipulation and composition as well as for real time controlling MIDI instruments.
The MSQ file format, a plain ASCII text file format, represents sequences of MIDI commands in strictly chronological order even when multiple MIDI tracks are present. It does not only allow the translation of MIDI files to some readable text (and vice versa) but is a well defined and MIDI compatible file format itself.
Programmers, composers and musicians are invited to develop tools processing MSQ files or just to use the existing system!

The MSQ package now consists of the following elements:

msq.htm MSQ documentation (this page)
Describes the MSQ file format and MSQ tools
Platform
msq2midMSQ to MIDI converter
Converts MSQ files to Standard MIDI files
WINDOWS/LINUX
mid2msqMIDI to MSQ converter
Converts Standard MIDI files to MSQ files
WINDOWS/LINUX
merge MSQ file merge
Merges two MSQ files together
WINDOWS/LINUX
play MSQ file player (sequencer)
Plays MSQ files on any MIDI device
WINDOWS
mmid Multi Media device ID finder
Finds the IDs of currently available Multi Media devices on the running system to use with play
WINDOWS

All MSQ Tools are console applications.

Download the MSQ package



The MSQ 2.0 Specification

The MSQ 2.0 standard supports the MIDI file formats 0 and 1. It is compatible with what is known as 'The MIDI Standard' as described in many resources on the web. Not supported at this moment is anything related to SMPTE! Jeff Glatt's MIDI site used to be a good place to learn more about The MIDI Standard. A collection of those pages is now available here.

The MSQ file format
MSQ files are plain ASCII text files. To simplify their identification, MSQ files usually have the extension .MSQ.
The first line of a MSQ file must contain a MIDI TICKS setting as:

TICKS = 120

where the tokens may be separated by white spaces (not tabulators). The TICKS value sets the maximal number of subdivisions of a quarter note. About limits of the TICKS value see Ranges and Conditions.
Each further line consists of a complete MIDI message with an absolute time value in ticks, followed by a track number, followed by a MSQ symbol (see The MSQ Symbols), followed by a channel number in case of a channel message and appropriate further data (see The MSQ Symbols). For a detailed description of the line syntax, see The Form of a MSQ Line. The tokens must be separated by one or more white spaces (not tabulators). There is no limit for the overall size of an MSQ file but the maximum number of characters in a line is 256 (this value has been increased from 128 to 256 in August 2007 - only MSQ tools with version 0.5.0 and higher will accept this new limit). For visual reasons, empty lines are allowed.



The Form of a MSQ Line

xxx xxx xxx xx xxx xxx etc...
|   |   |   |  |   |
|   |   |   |  |   data byte (optional)
|   |   |   |  data byte (optional)
|   |   |   channel number (optional: Channel Messages only)
|   |   MSQ symbol
|   track number
time value of the event in ticks
Examples of MSQ lines:

1. Channel Messages
0 1 NOF 0 64 100
0 1 NON 0 64 100
0 1 PCH 0 2


2. System Messages
0 1 SEX 67 16 53 13 0 0 17 0 64
0 1 ASE


3. Meta Events
0 0 _CR some text
0 0 _ST 500000
0 0 _TS 3 2 24 8


Example of a valid MSQ 2.0 file:

gloter2.msq GLOCKENTERROR II for Piano 1997, Copyright (c) 1997 by Siegfried Koepf. All rights reserved!



The MSQ Symbols

The first column shows the MSQ symbol, the second one shows the name of the corresponding MIDI message, the last one shows the data expected:

MSQ 1. Channel MessagesMSQ DATA
NOFNote Off channel number, 2 data bytes
NONNote On channel number, 2 data bytes
PAFPoly Aftertouch channel number, 2 data bytes
CCHController channel number, 2 data bytes
PCHProgram Change channel number, 1 data byte
CAFChannel Aftertouch channel number, 1 data byte
PWHPitch Wheel channel number, 2 data bytes
MSQ 2. System Messages MSQ DATA
SEXSystem Exclusive ? data bytes
MTCMTC Quarter Frame Message 1 data byte
SPPSong Position Pointer 2 data bytes
SELSong Select 1 data byte
TRETune Request no data
MCLMIDI Clock no data
TICTick no data
STAMIDI Start no data
CONMIDI Continue no data
STOMIDI Stop no data
ASEActive Sense no data
SREReset no data
MSQ 3. Meta Events MSQ DATA
_SNSequence Number 2 data bytes
_TEText Event ASCII text
_CRCopyright Notice ASCII text
_TNSequence/Track Name ASCII text
_INInstrument Name ASCII text
_LYLyric ASCII text
_MAMarker ASCII text
_CUCue Point ASCII text
_CPMIDI Channel Prefix 1 data byte
_MPMIDI Port 1 data byte
_STSet Tempo 1 data DWORD
_SMSMPTE Offset 5 data bytes (not implemented)
_TSTime Signature 4 data bytes
_KSKey Signature 2 data bytes
_SQSequencer Specific ? data bytes



Ranges and Conditions

Ranges of MSQ values:

MSQ values min. max.
TICKS in the first line of a MSQ file: 1 32767
Number of characters in a line in a MSQ file: 0 256
Time value in ticks, the first row in a MSQ file: 0 4294967295
Difference of two successive time values: 0 268435455
Track number, the second row in a MSQ file: 0 65535
Channel number in Channel Messages: 0 15
Channel number, the value in META EVENT _CP (MIDI Channel Prefix): 0 15
Tempo, the value in META EVENT _ST (Set Tempo): 1 16777215
Numerator, first value in META EVENT _TS (Time Signature): 1 127
Exponent, second value in META EVENT _TS (Time Signature): 0 7
Clocks, third value in META EVENT _TS (Time Signature): 1 127
32nds, fourth value in META EVENT _TS (Time Signature): 1 127
Flats/sharps, first value in META EVENT _KS (Key Signature): -7 7
Scale, second value in META EVENT _KS (Key Signature): 0 1
Other data bytes: 0 127

The META EVENT _SN (Sequence Number) must occur at the beginning of a track.



MSQ Tools

msq2mid (for WINDOWS 9x/NT/2000/XP/LINUX)
Description:MSQ to MIDI converter
Converts MSQ files to Standard MIDI files
Usage: msq2mid msq-file midi-file
where msq-file is the source and midi-file is the target file name
Example: msq2mid gloter2.msq gloter2.mid
Version: 0.5.0
Copyright: 2000-2007 by Siegfried Koepf
Last update:August 31, 2007


mid2msq (for WINDOWS 9x/NT/2000/XP/LINUX)
Description:MIDI to MSQ converter
Converts Standard MIDI files to MSQ files.
Usage: mid2msq midi-file msq-file
where midi-file is the source and msq-file is the target file name
Example: mid2msq gloter2.mid gloter2.msq
Version: 0.5.0
Copyright: 2000-2007 by Siegfried Koepf
Last update:August 31, 2007


merge (for WINDOWS 9x/NT/2000/XP/LINUX)
Description:MSQ file merge
Merges two MSQ files together
Usage: merge msq-file1 msq-file2 msq-file3
where msq-file1 and msq-file2 are the source and msq-file3 is the target file name
Version: 0.5.0
Copyright: 2003-2007 by Siegfried Koepf
Last update:August 31, 2007


play (for WINDOWS 9x/NT/2000/XP)
Description: MSQ file player (sequencer)
Plays MSQ files on any MIDI device
Usage: play <msq-file> [-d<device-id>] [-s<n>] [-v] [-h]
where <msq-file> is the name of the MSQ file to be played
Options: -d<device-id> where <device-id> is the ID of the MIDI device to use (to find available devices on a running system use mmid). Without -d play uses the default MIDI device
-s<n> where <n> is a ticks value from where the playback will be started
-v shows a tick counter while playing
-h shows a help screen
Example: play gloter2.msq -d0 -s2112 -v
Hotkeys: [ESC] to stop the program
[SPACE] toggles between pause and continue
Version: 0.5.0
Copyright: 2000-2007 by Siegfried Koepf
Last update:August 31, 2007


mmid (for WINDOWS 9x/NT/2000/XP)
Description:Multi Media device ID finder
Finds the IDs of currently available Multi Media devices on the running system to use with play
Usage: mmid
Version: 0.5.0
Copyright: 2000-2007 by Siegfried Koepf
Last update:August 31, 2007



Terms

The MSQ package may be used for non-commercial purposes and freely distributed in the format originally released. It is provided "as is", you get no guarantees because all standard disclaimers apply!
All programs and documentation are Copyright (c) 2000-2009 by Siegfried Koepf. Please send your feedback to: msq[at]aconnect[dot]de

Download: msq.zip (WINDOWS)
Download: msq.tar.gz (LINUX)

(Last update: March 10, 2010)


[WebCounter]

[back to KOEPF'S WRITINGS]