| 1 |
|
| 2 |
MIDI File CSV Editing Tools |
| 3 |
|
| 4 |
by John Walker |
| 5 |
http://www.fourmilab.ch/ |
| 6 |
|
| 7 |
This distribution contains tools which permit you to convert |
| 8 |
standard MIDI files to a CSV (Comma-Separated Format) |
| 9 |
equivalent which preserves all the information in the MIDI file |
| 10 |
and then translate such CSV files back to standard MIDI files. |
| 11 |
|
| 12 |
Exporting MIDI files as CSV makes it easy to manipulate them |
| 13 |
with speadsheets, database utilities, or programs in languages |
| 14 |
such as Perl and C. |
| 15 |
|
| 16 |
The following files are included in the distribution: |
| 17 |
|
| 18 |
C Source Code |
| 19 |
csv.c CSV input parser |
| 20 |
csv.h Definitions for csv.c |
| 21 |
csvmidi.c CSV to MIDI translator |
| 22 |
getopt.c Command line option parser |
| 23 |
getopt.h Definitions for getopt.c |
| 24 |
midicsv.c MIDI to CSV translator |
| 25 |
midifile.h MIDI file definitions |
| 26 |
midio.c MIDI file I/O routines |
| 27 |
midio.h Definitions for midio.c |
| 28 |
types.h Common type definitions |
| 29 |
version.h Version number definition |
| 30 |
|
| 31 |
Build Utilities |
| 32 |
Makefile Make file |
| 33 |
|
| 34 |
Sample MIDI Manipulation Programs and Data |
| 35 |
acomp.pl Simple-minded algorithmic composition |
| 36 |
example. |
| 37 |
bad.csv CSV file chock full of errors to test |
| 38 |
csvmidi error detection and recovery. |
| 39 |
ce3k.csv Sample MIDI file in CSV format: |
| 40 |
"Close Encounters of the Third Kind" |
| 41 |
count_events.pl Perl program which counts events by type |
| 42 |
in a CSV MIDI file and prints the results. |
| 43 |
chorus.pl Perl program which adds a one |
| 44 |
octave lower chorus to all notes in |
| 45 |
a MIDI file. |
| 46 |
drummer.pl Dumbest possible drum machine; illustrates |
| 47 |
MIDI generation from scratch. |
| 48 |
exchannel.pl Perl program which extracts all events on |
| 49 |
a given channel (General MIDI percussion channel |
| 50 |
as supplied), passing through meta-events |
| 51 |
unchanged. |
| 52 |
general_midi.pl Perl include file which defines hashes |
| 53 |
that allow General MIDI patch and percussion |
| 54 |
note assignments to be specified symbolically. |
| 55 |
torture.pl Perl program to generate csvmidi/midicsv |
| 56 |
"torture test". Include all event types and |
| 57 |
verifies handling of long strings and byte |
| 58 |
sequences with arbitrary content. |
| 59 |
transpose.pl Perl program which transposes a MIDI |
| 60 |
file, shifting all notes down one octave |
| 61 |
test.mid Sample MIDI file: "Silent Running" by Mike |
| 62 |
and the Mechanics |
| 63 |
|
| 64 |
Documentation |
| 65 |
README This file |
| 66 |
csvmidi.1 csvmidi manual page |
| 67 |
log.txt Development log |
| 68 |
midicsv.1 midicsv manual page |
| 69 |
midicsv.5 MIDI CSV representation file format documentation |
| 70 |
|
| 71 |
WIN32 Executable Files |
| 72 |
Csvmidi.exe Csvmidi WIN32 executable |
| 73 |
Midicsv.exe Midicsv WIN32 executable |
| 74 |
|
| 75 |
WIN32 Build Files (for Microsoft Visual Studio .NET) |
| 76 |
Midicsv.sln Solution (Workspace) for Csvmidi and Midicsv |
| 77 |
Csvmidi.vcproj Csvmidi project file |
| 78 |
Midicsv.vcproj Midicsv project file |
| 79 |
W32test.bat Test script for WIN32 programs |
| 80 |
|
| 81 |
BUILDING AND INSTALLATION |
| 82 |
|
| 83 |
I can't bring myself to burden such a small, simple set of programs as |
| 84 |
this with a grotesque Autoconf script which would dwarf the source |
| 85 |
code. Just edit the Makefile and change the C compiler and options |
| 86 |
if necessary, and the install directory tree if you wish to use |
| 87 |
the install target. The build the program with: |
| 88 |
|
| 89 |
make |
| 90 |
|
| 91 |
and run the self-test with: |
| 92 |
|
| 93 |
make check |
| 94 |
|
| 95 |
which should report "All tests passed." if all is well. If you're |
| 96 |
patient, have Perl installed on your system, and have lots of free |
| 97 |
disc space, you can run the "torture test" with: |
| 98 |
|
| 99 |
make torture |
| 100 |
|
| 101 |
You may then proceed to install the programs and manual pages |
| 102 |
with |
| 103 |
|
| 104 |
make install |
| 105 |
|
| 106 |
which, unless you've changed the INSTALL_DEST directory in the |
| 107 |
Makefile, will install into /usr/local, which will require you |
| 108 |
to perform the installation with super-user privilege. |
| 109 |
|
| 110 |
COMPATIBILITY NOTES |
| 111 |
|
| 112 |
These programs were originally developed on an MS-DOS system |
| 113 |
with a compiler in which the "int" type was 16 bits, but it's |
| 114 |
been a long time since they've been compiled with such a |
| 115 |
compiler so it's unlikely they'll work with 16 bit ints without |
| 116 |
some tweaking. The programs don't care whether the "char" type |
| 117 |
is signed or unsigned. I've not tested the programs on a |
| 118 |
system in which "int" or "long" is wider than 32 bits, but I |
| 119 |
don't anticipate any problems. |
| 120 |
|
| 121 |
On systems such as WIN32 which distinguish text from binary files, |
| 122 |
it is essential that midicsv.c open its input file and csvmidi.c |
| 123 |
open its output file in *binary* mode, otherwise the MIDI file will |
| 124 |
be corrupted due to end of line sequence translation. If input |
| 125 |
and output file names are specified explicitly, the "b" option supplied |
| 126 |
in the fopen() call should take care of this (and cause no damage on |
| 127 |
modern Unix systems, which ignore this option). When reading or writing |
| 128 |
to standard input/output, however, the open file must be explicitly set |
| 129 |
to binary mode, and the means for doing this vary among development |
| 130 |
systems. The midicsv.c and csvmidi.c contain code conditional on |
| 131 |
_WIN32 which sets binary file mode with the mechanism provided by |
| 132 |
the Microsoft Visual C/C++ library; if you're building with a different |
| 133 |
compiler and library, you may need to change this code accordingly. |
| 134 |
|