2007-04-29 06:47:40 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
# create tex files of the mma midi constants
|
|
|
|
|
|
|
|
import sys, os, commands
|
|
|
|
|
|
|
|
sys.path.insert(0, "/usr/local/share/mma/MMA/")
|
|
|
|
from miditables import *
|
2009-05-17 22:34:44 +00:00
|
|
|
from chordtable import chordlist
|
2007-04-29 06:47:40 +00:00
|
|
|
|
|
|
|
err, version = commands.getstatusoutput( "mma -v")
|
|
|
|
if err:
|
|
|
|
print "Can't get MMA version ... strange error!"
|
|
|
|
sys.ex
|
|
|
|
|
|
|
|
def dodrums(order):
|
|
|
|
""" Print LaTex table of drum names. """
|
|
|
|
|
|
|
|
notenames = ['E\\flat', 'E', 'F', 'G\\flat', 'G', 'A\\flat',
|
|
|
|
'A', 'B\\flat', 'B', 'C', 'D\\flat', 'D'] * 5
|
|
|
|
|
|
|
|
|
2009-05-17 22:34:44 +00:00
|
|
|
if order == "m":
|
|
|
|
for a in sorted(drumNames.keys()):
|
|
|
|
n = drumNames[a].replace('&', '\&')
|
|
|
|
outfile.write("\\insline{%s} {%s$^{%s}$}\n" % (a, n,notenames[a-27]))
|
2007-04-29 06:47:40 +00:00
|
|
|
|
|
|
|
else:
|
2009-05-17 22:34:44 +00:00
|
|
|
for a in sorted(drumInx.keys()):
|
|
|
|
v=drumInx[a]
|
|
|
|
n=drumNames[v].replace('&', '\&')
|
|
|
|
outfile.write( "\\insline{%s} {%s$^{%s}$}\n" % (n, v, notenames[v-27]))
|
|
|
|
|
2007-04-29 06:47:40 +00:00
|
|
|
|
|
|
|
def docrtls(order):
|
|
|
|
""" Print LaTex table of MIDI controller names. """
|
2009-05-17 22:34:44 +00:00
|
|
|
|
|
|
|
if order == "m":
|
|
|
|
for a in sorted(ctrlNames.keys()):
|
|
|
|
n = ctrlNames[a].replace('&', '\&')
|
|
|
|
outfile.write("\\insline{%s} {%s}\n" % (a, n))
|
2007-04-29 06:47:40 +00:00
|
|
|
|
|
|
|
else:
|
2009-05-17 22:34:44 +00:00
|
|
|
for a in sorted(ctrlInx.keys()):
|
|
|
|
v=ctrlInx[a]
|
|
|
|
n=ctrlNames[v].replace('&', '\&')
|
|
|
|
outfile.write( "\\insline{%s} {%s}\n" % (n, v))
|
|
|
|
|
2007-04-29 06:47:40 +00:00
|
|
|
|
|
|
|
def doinsts(order):
|
|
|
|
""" Print LaTex table of instrument names. """
|
|
|
|
|
2009-05-17 22:34:44 +00:00
|
|
|
if order == "m":
|
|
|
|
for a in sorted(voiceNames.keys()):
|
|
|
|
n = voiceNames[a].replace('&', '\&')
|
|
|
|
outfile.write("\\insline{%s} {%s}\n" % (a, n))
|
2007-04-29 06:47:40 +00:00
|
|
|
|
|
|
|
else:
|
2009-05-17 22:34:44 +00:00
|
|
|
for a in sorted(voiceInx.keys()):
|
|
|
|
v=voiceInx[a]
|
|
|
|
n=voiceNames[v].replace('&', '\&')
|
|
|
|
outfile.write( "\\insline{%s} {%s}\n" % (n, v))
|
2007-04-29 06:47:40 +00:00
|
|
|
|
|
|
|
def dochords():
|
|
|
|
""" Print out a list of chord names and docs in LaTex. """
|
|
|
|
|
2009-05-17 22:34:44 +00:00
|
|
|
for n in sorted(chordlist.keys()):
|
2007-04-29 06:47:40 +00:00
|
|
|
nm=n.replace("#", '$\\sharp$')
|
|
|
|
nm=nm.replace('b', '$\\flat$')
|
2009-05-17 22:34:44 +00:00
|
|
|
outfile.write( "\\insline{%s}{%s}\n" % (nm, chordlist[n][2]) )
|
2007-04-29 06:47:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
for a,f,o in (
|
|
|
|
('m', docrtls, 'ctrlmidi.AUTO'),
|
|
|
|
('a', docrtls, 'ctrlalpha.AUTO'),
|
|
|
|
('m', dodrums, 'drumsmidi.AUTO'),
|
|
|
|
('a', dodrums, 'drumsalpha.AUTO'),
|
|
|
|
('m', doinsts, 'instmidi.AUTO'),
|
|
|
|
('a', doinsts, 'instalpha.AUTO') ):
|
|
|
|
outfile = file(o, 'w')
|
|
|
|
f(a)
|
|
|
|
outfile.close()
|
|
|
|
|
|
|
|
outfile = file("chordnames.AUTO", 'w')
|
|
|
|
dochords()
|
|
|
|
outfile.close()
|
|
|
|
|