MIDI Scripter (v0.5.0) ReadmeMIDI Scripter (v0.5.0) Readme

Copyright © 2005 Emanuel Borsboom
Thanks to Philip Bennefall for the idea.

Home Page: http://www.epiphyte.ca/code/midi_scripter.html

Table of ContentsTable of Contents

  1. Overview
  2. Requirements and Setup
    1. Windows
    2. Other
  3. Usage
  4. Input Song File Format
    1. Basic Commands
    2. Advanced Commands
  5. Constants
    1. General MIDI Program Numbers
    2. General MIDI Drum Notes
    3. Lengths
  6. Examples
  7. License

OverviewOverview

This program generates a MIDI file from simple commands in text files. It was specifically created for someone who is visually impaired, so it is intended to be accessible to anyone.

Requirements and SetupRequirements and Setup

The first thing to do is unzip the distribution you downloaded (whether binary or source). Then, follow the platform-specific instructions below.

Windows

The easiest way to setup the program on Windows requires no installation at all. If you downloaded the win32 binary zip file, just unzip it and you're done.

If for some reason you don't want to use the binary, you must install the Ruby interpreter and the wxRuby library. The easiest way to do that is to use the "One-Click Ruby Installer" at http://rubyforge.org/frs/download.php/2407/ruby182-14.exe, and then the "wxRuby One Click Installer" at http://rubyforge.org/frs/download.php/1984/wxruby-0.6.0-mswin.exe.

Other

This program should run on any platform that supports Ruby and wxWidgets (and will run in command-line mode without wxWidgets). It has been tested with Ruby 1.8.2, wxWidgets 2.4.2, and wxRuby 0.6.0. First, you must install Ruby, which you can download from http://ruby-lang.org/. Then, install wxRuby, which you can download from http://wxruby.rubyforge.org/. wxRuby requires wxWidgets, which is available at http://wxwidgets.org/.

UsageUsage

To start the program on Windows (if you are using the win32 binary package), simply run MidiScripter.exe (for example, by double clicking on it in Windows Explorer).

Otherwise, run MidiScripter.rb. For example, type "ruby MidiScipter.rb" on the command-line.

Once it's running, it's a snap to use - just select your input file, then your output file, and then click "Generate MIDI File". If you want to listen to the MIDI file immediately after generating it, click "Generate and Play" instead. Note that while the MIDI player is running, MIDI Scripter will be unresponsive until you exit it.

For playing the MIDI file to work, you must have your MIDI player configured correctly. The default should work if you are running Windows and have Windows Media Player installed.

You can also specify the input and output files on the command-line, in which case the GUI is skipped (and wxRuby is not required). For example:

ruby MidiScripter.rb example.song example.mid

By default, the input files are run in safe mode, which prevents them from accessing your system. If you want the input file to be able to access your system, you can run the program in unsafe mode by adding the --unsafe command-line argument. For example:

ruby MidiScripter.rb --unsafe

or

ruby MidiScripter.rb --unsafe example.song example.mid

Warning: this will allow the input file to do things like erase your hard drive or send e-mails, so only use it for songs from people you trust!

Input Song File FormatInput Song File Format

Each input song file is, in fact, a Ruby (www.ruby-lang.org) program. It is interpreted in an environment that has a bunch of simple commands defined for generating a MIDI sequence. The input is divided into tracks. Each track has an independent timeline. Most commands affect only the current track, but there are some commands that affect all tracks. Each track is normally stored in a separate file, and the main input file specifies where to load them. Comments are started with # and continue until the end of the line. You may use any valid Ruby expression in the file. Commands are case sensitive!

Basic Commands

Advanced Commands

ConstantsConstants

General MIDI Program Numbers

	#PIANO                           
Acoustic_Grand = 0
Bright_Acoustic = 1
Electric_Grand = 2
Honky_Tonk = 3
Electric_Piano_1 = 4
Electric_Piano_2 = 5
Harpsichord = 6
Clavinet = 7
	#CHROMATIC PERCUSSION
Celesta = 8
Glockenspiel = 9
Music_Box = 10
Vibraphone = 11
Marimba = 12
Xylophone = 13
Tubular_Bells = 14
Dulcimer = 15
	#ORGAN                          
Drawbar_Organ = 16
Percussive_Organ = 17
Rock_Organ = 18
Church_Organ = 19
Reed_Organ = 20
Accoridan = 21
Harmonica = 22
Tango_Accordian = 23
	#GUITAR
Nylon_String_Guitar = 24
Steel_String_Guitar = 25
Electric_Jazz_Guitar = 26
Electric_Clean_Guitar = 27
Electric_Muted_Guitar = 28
Overdriven_Guitar = 29
Distortion_Guitar = 30
Guitar_Harmonics = 31
	#BASS
Acoustic_Bass = 32
Electric_Bass_Finger = 33
Electric_Bass_Pick = 34
Fretless_Bass = 35
Slap_Bass_1 = 36
Slap_Bass_2 = 37
Synth_Bass_1 = 38
Synth_Bass_2 = 39
	#SOLO_STRINGS
Violin = 40
Viola = 41
Cello = 42
Contrabass = 43
Tremolo_Strings = 44
Pizzicato_Strings = 45
Orchestral_Strings = 46
Timpani = 47
	#ENSEMBLE
String_Ensemble_1 = 48
String_Ensemble_2 = 49
SynthStrings_1 = 50
SynthStrings_2 = 51
Choir_Aahs = 52
Voice_Oohs = 53
Synth_Voice = 54
Orchestra_Hit = 55
	#BRASS
Trumpet = 56
Trombone = 57
Tuba = 58
Muted_Trumpet = 59
French_Horn = 60
Brass_Section = 61
SynthBrass_1 = 62
SynthBrass_2 = 63
	#REED
Soprano_Sax = 64
Alto_Sax = 65
Tenor_Sax = 66
Baritone_Sax = 67
Oboe = 68
English_Horn = 69
Bassoon = 70
Clarinet = 71
	#PIPE
Piccolo = 72
Flute = 73
Recorder = 74
Pan_Flute = 75
Blown_Bottle = 76
Skakuhachi = 77
Whistle = 78
Ocarina = 79
	#SYNTH_LEAD
Lead_1= 80
Lead_2 = 81
Lead_3 = 82
Lead_4 = 83
Lead_5 = 84
Lead_6 = 85
Lead_7 = 86
Lead_8 = 87
	#SYNTH_PAD
Pad_1 = 88
Pad_2 = 89
Pad_3 = 90
Pad_4 = 91
Pad_5 = 92
Pad_6 = 93
Pad_7 = 94
Pad_8 = 95
	#SYNTH_EFFECTS
FX_1 = 96
FX_2 = 97
FX_3 = 98
FX_4 = 99
FX_5 = 100
FX_6 = 101
FX_7 = 102
FX_8 = 103
	#ETHNIC
Sitar = 104
Banjo = 105
Shamisen = 106
Koto = 107
Kalimba = 108
Bagpipe = 109
Fiddle = 110
Shanai = 111
	#PERCUSSIVE
Tinkle_Bell = 112
Agogo = 113
Steel_Drums = 114
Woodblock = 115
Taiko_Drum = 116
Melodic_Tom = 117
Synth_Drum = 118
Reverse_Cymbal = 119
	#SOUND_EFFECTS
Guitar_Fret_Noise = 120
Breath_Noise = 121
Seashore = 122
Bird_Tweet = 123
Telephone_Ring = 124
Helicopter = 125
Applause = 126
Gunshot = 127

General MIDI Drum Notes

Acoustic_Bass_Drum = 35
Bass_Drum_1 = 36
Side_Stick = 37
Acoustic_Snare = 38
Hand_Clap = 39
Electric_Snare = 40
Low_Floor_Tom = 41
Closed_Hi_Hat = 42
High_Floor_Tom = 43
Pedal_Hi_Hat = 44
Low_Tom = 45
Open_Hi_Hat = 46
Low_Mid_Tom = 47
Hi_Mid_Tom = 48
Crash_Cymbal_1 = 49
High_Tom = 50
Ride_Cymbal_1 = 51
Chinese_Cymbal = 52
Ride_Bell = 53
Tambourine = 54
Splash_Cymbal = 55
Cowbell = 56
Crash_Cymbal_2 = 57
Vibraslap = 58
Ride_Cymbal_2 = 59
Hi_Bongo = 60
Low_Bongo = 61
Mute_Hi_Conga = 62
Open_Hi_Conga = 63
Low_Conga = 64
High_Timbale = 65
Low_Timbale = 66
High_Agogo = 67
Low_Agogo = 68
Cabasa = 69
Maracas = 70
Short_Whistle = 71
Long_Whistle = 72
Short_Guiro = 73
Long_Guiro = 74
Claves = 75
Hi_Wood_Block = 76
Low_Wood_Block = 77
Mute_Cuica = 78
Open_Cuica = 79
Mute_Triangle = 80
Open_Triangle = 81

Lengths

Whole
Half
Quarter
Eighth
Sixteenth
Thirtysecond
Sixtyfourth
Dotted_Whole
Dotted_Half
Dotted_Quarter
Dotted_Eighth
Dotted_Sixteenth
Dotted_Thirtysecond
Dotted_Sixtyfourth
Whole_Triplet
Half_Triplet
Quarter_Triplet
Eighth_Triplet
Sixteenth_Triplet
Thirtysecond_Triplet
Sixtyfourth_Triplet
Dotted_Whole_Triplet
Dotted_Half_Triplet
Dotted_Quarter_Triplet
Dotted_Eighth_Triplet
Dotted_Sixteenth_Triplet
Dotted_Thirtysecond_Triplet
Dotted_Sixtyfourth_Triplet

ExamplesExamples

See the file example.song, and the files which it loads: melody.track, chords.track, and drums.track.

LicenseLicense

Copyright © 2005 Emanuel Borsboom

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.