A windows console application that plays midi
music based upon an input text file. The text
file can be created with any text editor
(notepad, for example).
Here's an example
text file, the structure of the file format is as follows:
A comment begins with '/' and continues to the end of the line
A song is => one or more commands
A command is => a note command OR
a silence command OR
a repeat command OR
a shift command OR
a group command
A note command is => a note name or number AND a duration
optional volume setting
optional instrument setting
A note name is => key AND octave
A key is => c, c#, db, d, d#, eb, e, f, f#, gb, g, g#, ab, a, a#, bb, b
An octave is => m1, 0, 1, 2, 3, 4, 5, 6, 7, 8 (also 9 for c through g)
A note number is => 1 - 128
A duration is => integer greater than zero
A volume setting is => 'v' AND integer greater than zero
An instrument setting is => 'i' AND 1 - 128 OR
'i' AND instrument name
A silence command is => 'x' AND duration
A repeat command is => 'r' AND integer greater than zero AND command
A group command is => '(' AND one or more command lists AND ')'
A command list is => '(' one or more commands ')'
A shift command is => 's' AND (+ / - ) integer
Notes:
------
A group command is surrounded by '(' ')' and contains one
or more lists, each surrounded by '(' ')'. Those lists
consist of commands to be executed simultaneously:
- ( ( cmd1 cmd2 ) ( cmd3 ) ( cmd4 cmd5 cmd6) )
The default grouping characters are '(' and ')' but
all of the following are also allowed:
'[' and ']'
'<' and '>'
'{' and '}'
with the stipulation that you can only use one set of
grouping characters in a given file (i.e. you can't
have both '(' ')' and '[' ']' in the same file).
Examples:
---------
play e2 (guitar's low e string) for 2 seconds:
e2 2000
1/2 second rest
x 500
play e2 (guitar's a string) using an oboe at volume 100 for 1 sec
e2 1000 v 100 i oboe
play EGB chord for 3 seconds, rest one second, play again
at a higher octave
((e2 3000) (g2 3000) (b3 3000))
x 1000
((e3 3000) (g3 3000) (b4 3000))
or alternatively ...
((e3 3000) (g3 3000) (b4 3000))
x 1000
s 12 ((((e3 3000) (g3 3000) (b4 3000))))
Distribution (Pre-Built Windows Exe, Examples, Source Code)
Return to Main |