-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_empty.py
More file actions
33 lines (26 loc) · 883 Bytes
/
create_empty.py
File metadata and controls
33 lines (26 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# create empty drum map starting with a non-empty one
import xml.etree.ElementTree as et, sys
def main(fileName):
tree = et.parse(fileName)
root = tree.getroot()
root[0].set('value', 'Empty') # drum map name
note = 0
for elmt in root[2]: # Map
noteStr = str(note)
elmt[0].set('value', noteStr) # INote
elmt[1].set('value', noteStr) # ONote
elmt[2].set('value', '-1') # Channel == Any
elmt[3].set('value', str(200)) # Length, as seen in GM.drm
elmt[4].set('value', '0') # Mute off
elmt[5].set('value', noteStr) # DisplayNote
elmt[9].set('value', '---') # Name
elmt[10].set('value', '0') # QuantizeIndex
note += 1
order = 0
for elmt in root[3]: # Order
elmt.set('value', str(order))
order += 1
tree.write('empty.drm')
# when invoked from the command line
if __name__ == '__main__':
main(sys.argv[1])