Midi files with Debian GNU/Linux (was: Midi files S.O.S.)
Rodolfo Medina <rodolfo.medina@gmail.com> writes:
> I'm looking for a program that allows to modify
> midi files, i.e. adjust tone and speed and cancel
> traces
I'm reporting how I managed the problem.
Improvements and corrections welcome.
Rodolfo
-----------------------------------------
Operating system: Debian GNU/Linux 3.1 ("Sarge") r2, kernel 2.4.
After the Debian base installation, I had chosen the manual
packages selection and installed the following packages:
make gcc less x-window-system gnome-session gnome-panel nautilus gnome-applets gnome-control-center gnome-system-tools gnome-core epiphany-browser libc6-dev kernel-source-2.4.27 cvs autotools-dev build-essential dpatch dpkg-dev g++ g++-3.3 libice-dev libjpeg62-dev liblockfile-dev libncurses5-dev libpng12-dev libpng3-dev libsm-dev libstdc++5-3.3-dev libtiff4-dev libtiffxx0 libungif4-dev libungif4g libx11-dev libxaw7-dev libxext-dev libxi-dev libxmu-dev libxmuu-dev libxp-dev libxpm-dev libxrandr-dev libxrender-dev libxt-dev libxtrap-dev libxtst-dev libxv-dev patch pm-dev render-dev texinfo x-dev xaw3dg xaw3dg-dev xlibs-dev xlibs-static-dev zlib1g-dev cupsys cupsys-bsd cupsys-client libcupsimage2 cupsys-driver-gimpprint cupsys-driver-gimpprint-data gs-esp libgtk1.2 libgtk1.2-dev xpdf-reader openoffice.org
From:
http://www.fourmilab.ch/webtools/midicsv/
I downloaded midicsv-1.0.tar.gz and put it in ~/tmp. To install it,
the packages perl and libc6-dev are necessary. I did:
$ cd ~/tmp
$ tar xzvf midicsv-1.0.tar.gz
$ cd midicsv-1.0
$ make
$ make check
All tests passed.
$ make torture
perl torture.pl | ./csvmidi | tee /tmp/w.mid | ./midicsv | ./csvmidi >/tmp/w1.mid
Torture test passed.
# make install
install -d -m 755 /usr/local/bin
install -m 755 midicsv csvmidi /usr/local/bin
install -d -m 755 /usr/local/man/man1
install -m 644 midicsv.1 csvmidi.1 /usr/local/man/man1
install -d -m 755 /usr/local/man/man5
install -m 644 midicsv.5 /usr/local/man/man5
. So the package was successfully installed. Before removing the
~/tmp/midicsv-1.0 directory I saved apart all the .pl files included in it.
Besides, I created the file cancelchannel.pl and filled it with:
$which_channel = 3;
while ($a = <>) {
if (!($a =~ m/\s*[\#\;]/)) { # Ignore comment lines
if ($a =~ m/\s*\d+\s*,\s*\d+\s*,\s*\w+_c\s*,\s*(\d+)/) {
if ($1 != $which_channel){
print($a);
}
} else {
print($a);
}
}
}
. Look at:
http://www.fourmilab.ch/webtools/midicsv/
. To transpose key of song.mid, I did:
$ midicsv song.mid | perl transpose.pl | csvmidi > tsong.mid
; to cancel the sing channel from song.mid, I did:
$ midicsv song.mid | perl cancelchannel.pl | csvmidi > tsong.mid
; to change the speed of song.mid I did:
$ midicsv song.mid tsong.txt
, then edited the file tsong.txt with my desired tempo
(see `Tempo', section 'midicsv File Format' at:
http://www.fourmilab.ch/webtools/midicsv/
) and then:
$ csvmidi tsong.txt tsong.mid
; to change the speed and also cancel the sing channel, I did:
$ midicsv song.mid tsong.txt
, then edited the file tsong.txt with my desired tempo (see `Tempo',
section 'midicsv File Format' at
http://www.fourmilab.ch/webtools/midicsv/
) and then
$ perl cancelchannel.pl tsong.txt | csvmidi > tsong.mid
. Then,
# apt-get install timidity freepats
. To play mysong.mid, just say:
$ timidity mysong.mid
. To transpose the song one half tone up,
$ timidity -K 1 mysong.mid
. To transpose the song one half tone down,
$ timidity -K -1 mysong.mid
. This will play mysong.mid with 500% volume and trace 4 cancelled:
$ timidity -ia -A500 --trace --mute=4 mysong.mid
. To convert mysong.mid into mysong.wav,
$ timidity -Ow mysong.mid mysong.wav
. Then,
# apt-get install alsaplayer
. To play mysong.wav,
$ alsaplayer mysong.wav
Reply to: