PMMLでMMLを書き、コンパイルしてTiMidityでmidiファイルを流す。
TiMidity++ダウンロード
TiMidity++
TiMidity導入
ディレクトリは適当でよい
tar zxvf TiMidity++-2.13.0.tar.gz cd TiMidity++-2.13.0 ./configure --prefix=$HOME/local/yry2 make
サウンドフォント用意
再生時の音源(=サウンドフォント)を用意する
wget ftp://ftp.iij.ad.jp/pub/linux/gentoo/distfiles/shominst-0409.zip mkdir -p ~/local/yry2/share/timidity/ cd ~/local/yry2/share/timidity/ unzip ~/shominst-0409.zip
--- timidity.cfg 2013-06-22 08:25:05.000000000 +0900 +++ timidity.cfg 2013-06-22 08:26:21.000000000 +0900 @@ -30,9 +30,9 @@ #dir /usr/local/lib/timidity # -dir /nethome/sak95/shom/lib/timidity/inst/GUS -dir /nethome/sak95/shom/lib/timidity/inst -dir /nethome/sak95/shom/lib/timidity/inst/test +dir ~/local/yry2/share/timidity/inst/GUS +dir ~/local/yry2/share/timidity/inst +dir ~/local/yry2/share/timidity/inst/test bank 0 source default.cfg
パッチを用意して、patch < hoge.diff.txt
まあ、ここまではよかった。
PMMLの導入と挫折
よくよく考えたら、PMMLはもう随分と前にメンテナンスをやめており、
Macで動くかどうか謎なまま見切り発車していたわけです。
diff -ur pmml-0.2p1/Makefile pmml-0.2p1/Makefile --- pmml-0.2p1/Makefile 1998-07-16 13:51:46.000000000 +0900 +++ pmml-0.2p1/Makefile 2013-06-22 07:23:27.000000000 +0900 @@ -5,10 +5,10 @@ #------ configuration parameters ------ # The directory to which PMML library files are installed. -LIBDIR = /usr/local/lib/pmml +LIBDIR = ~/local/yry2/lib/pmml # The directory to which executable files are installed. -BINDIR = /usr/local/bin +BINDIR = ~/local/yry2/bin # Command name of the C compiler CC = gcc diff -ur pmml-0.2p1/common/util.h pmml-0.2p1/common/util.h --- pmml-0.2p1/common/util.h 1998-07-16 13:51:48.000000000 +0900 +++ pmml-0.2p1/common/util.h 2013-06-22 06:18:35.000000000 +0900 @@ -34,10 +34,6 @@ # endif #endif -char *malloc(); -char *realloc(); -char *strdup(); - /* * dynamically-growing string */ diff -ur pmml-0.2p1/comp/pmml.h pmml-0.2p1/comp/pmml.h --- pmml-0.2p1/comp/pmml.h 1998-07-16 13:51:49.000000000 +0900 +++ pmml-0.2p1/comp/pmml.h 2013-06-22 06:23:42.000000000 +0900 @@ -20,6 +20,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <stdlib.h> +#include <string.h> +#include <errno.h> + /******************************************************************** * Constants ********************************************************************/ @@ -936,20 +940,6 @@ extern int err_maxelms, err_maxtklen, err_maxargs; /* for err msg. */ /******************************************************************** - * System Library Functions - ********************************************************************/ - -char *malloc(); -char *calloc(); -char *realloc(); -char *strdup(); -char *strchr(); -char *getenv(); - -extern char *sys_errlist[]; -extern int errno; - -/******************************************************************** * User Function Prototypes and Macros ********************************************************************/ /* input.c */ diff -ur pmml-0.2p1/m2p/m2p.c pmml-0.2p1/m2p/m2p.c --- pmml-0.2p1/m2p/m2p.c 1998-07-16 13:51:51.000000000 +0900 +++ pmml-0.2p1/m2p/m2p.c 2013-06-22 06:24:02.000000000 +0900 @@ -24,6 +24,8 @@ #include <stdio.h> #include <ctype.h> +#include <stdlib.h> +#include <string.h> #include "m2p.h" char release[] = "0.2"; diff -ur pmml-0.2p1/m2p/m2p.h pmml-0.2p1/m2p/m2p.h --- pmml-0.2p1/m2p/m2p.h 1998-07-16 13:51:51.000000000 +0900 +++ pmml-0.2p1/m2p/m2p.h 2013-06-22 06:21:02.000000000 +0900 @@ -286,13 +286,6 @@ # endif #endif -char *malloc(); -char *calloc(); -char *realloc(); -char *strdup(); -char *strchr(); -char *getenv(); - /******************************************************************** * User Function Prototypes and Macros ********************************************************************/ diff -ur pmml-0.2p1/m2p/mplout.c pmml-0.2p1/m2p/mplout.c --- pmml-0.2p1/m2p/mplout.c 1998-07-16 13:51:51.000000000 +0900 +++ pmml-0.2p1/m2p/mplout.c 2013-06-22 06:25:04.000000000 +0900 @@ -28,6 +28,8 @@ */ #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "m2p.h" /* current state of PMML registers */ diff -ur pmml-0.2p1/m2p/oututil.c pmml-0.2p1/m2p/oututil.c --- pmml-0.2p1/m2p/oututil.c 1998-07-16 13:51:52.000000000 +0900 +++ pmml-0.2p1/m2p/oututil.c 2013-06-22 06:24:37.000000000 +0900 @@ -29,6 +29,8 @@ #include <stdio.h> #include <math.h> +#include <stdlib.h> +#include <string.h> #include "m2p.h" /* structure for time-signature information */ diff -ur pmml-0.2p1/m2p/readsmf.c pmml-0.2p1/m2p/readsmf.c --- pmml-0.2p1/m2p/readsmf.c 1998-07-16 13:51:52.000000000 +0900 +++ pmml-0.2p1/m2p/readsmf.c 2013-06-22 06:21:41.000000000 +0900 @@ -29,6 +29,8 @@ #include <stdio.h> #include <math.h> +#include <stdlib.h> +#include <string.h> #include "m2p.h" #include "../common/smf.h"
patch < hoge.diff.txtとかやって、makeするとこけた。
ubuntu 32bitでは動いたらしい。
しかし、私のPCはMBP 2011、そして64bitである。
for i in c_lib common comp m2p lib; do \ (echo $i; cd $i; make 'LIBDIR=~/local/yry2/lib/pmml' 'BINDIR=~/local/yry2/bin' 'CC=gcc' 'CCOPTS=-O' 'PMMLPATH=.;~/local/yry2/lib/pmml'); \ done c_lib make[1]: Nothing to be done for `all'. common make[1]: Nothing to be done for `all'. comp gcc -O -DPMML_PATH='".;~/local/yry2/lib/pmml"' -c -o pmml.o pmml.c In file included from pmml.c:26: pmml.h:89: error: expected identifier or ‘(’ before ‘...’ token In file included from pmml.c:26: pmml.h:353: error: expected specifier-qualifier-list before ‘uchar’ pmml.h:636: error: expected specifier-qualifier-list before ‘uchar’ pmml.h:1016: error: expected declaration specifiers or ‘...’ before ‘uchar’ make[1]: *** [pmml.o] Error 1 m2p make[1]: `m2p' is up to date. lib make[1]: Nothing to be done for `all'.
まずここでコケる。comp/pmml.h
/******************************************************************** * Definition of byte order ********************************************************************/ #ifndef PMML_BIG_ENDIAN # ifdef PMML_LITTLE_ENDIAN # define PMML_BIG_ENDIAN 0 # else # if defined(mc68000) || defined(sparc) || defined(MIPSEB) # define PMML_BIG_ENDIAN 1 # else # if defined(i386) || defined(MIPSEL) || defined(alpha) # define PMML_BIG_ENDIAN 0 # else ... Either PMML_BIG_ENDIAN or PMML_LITTLE_ENDIAN must be defined. # endif # endif # endif #endif
そもそも64ビットで動かすことを想定していなかったらしく、
..Either PMML_BIG_ENDIANうんたんのくだりでコケたので、
elseの部分をまるまる削除した。
ここをごまかして、make installして、
pmml manuet1.pmlを実行すると、
[1] 39859 segmentation fault pmml -I ~/local/yry2/lib/pmml examples/menuet1.pml
え?
「放せよ、人殺しドモン!」
「カミーユ…」
「母さんが死んだよ…」
え?
みたいな感じである。
そのままカミーユがひろやー氏の新町を熱唱しかねない勢いだったが、
とりあえずmake testしてみると、
../pmml -I../../lib test1 make[2]: *** [test1] Segmentation fault: 11 make[1]: *** [test] Error 2 make: *** [test] Error 2
make testの段階でコケている。
ちなみに64ビットのUNIXでも同様のエラーを吐かれてめっ☆ってされたので、
これはもう64bitの問題らしかった。
かれこれ3時間くらいごにょごにょしたけど、どうにもならなかった。
ちなみに、TiMidity自体は動く。
どうにもならなかった。
俺ガイルを1話で切ったバチが当たったのか。
MML導入失敗である。
どうでもいいけど、カミーユよりガトーのほうが女の名前っぽい。