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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
import common.Config as Config
from Generation.GenerationConstants import GenerationConstants
def gen():
punch_list = [[], ]
low_list = [[], ]
mid_list = [[], ]
high_list = [[], ]
f = open('/home/olpc/tamtam/Generation/drumTablesList', 'w')
g = open('/home/olpc/tamtam/Generation/drumStraightTables', 'w')
# gen punch list
beatsList = [[], ]
for beatsPerPage in [1,2,3,4,5,6,7,8,9,10,11,12]:
accents = []
for j in GenerationConstants.PUNCH_ACCENTS[beatsPerPage]:
accents.append(j * Config.TICKS_PER_BEAT)
beatsList.append(accents)
beats = []
downBeats = []
for beat in range( beatsPerPage ):
beats.append( beat * Config.TICKS_PER_BEAT )
for i in range( len( beats ) ):
downBeats.append( ( beats[ GenerationConstants.PUNCH_ACCENTS[ beatsPerPage ][ i ] ], int( pow( float( len( beats ) - i) / len( beats ), 1.5 ) * 100.) ) )
punch_list.append(downBeats)
string = ' DRUM_PUNCH_PROB = ' + str(punch_list) + '\n'
f.write(string)
string = ' DRUM_PUNCH_ACCENT = ' + str(beatsList) + '\n'
g.write(string)
# gen low list
beatsList = [[], ]
for beatsPerPage in [1,2,3,4,5,6,7,8,9,10,11,12]:
accents = []
for j in GenerationConstants.LOW_ACCENTS[beatsPerPage]:
accents.append(j * Config.TICKS_PER_BEAT)
beatsList.append(accents)
beats = []
downBeats = []
for beat in range( beatsPerPage ):
beats.append( beat * Config.TICKS_PER_BEAT )
for i in range( len( beats ) ):
downBeats.append( ( beats[ GenerationConstants.LOW_ACCENTS[ beatsPerPage ][ i ] ], int( pow( float( len( beats ) - i) / len( beats ), 1.5 ) * 100.) ) )
low_list.append(downBeats)
string = ' DRUM_LOW_PROB = ' + str(low_list) + '\n'
f.write(string)
string = ' DRUM_LOW_ACCENT = ' + str(beatsList) + '\n'
g.write(string)
# gen mid list
beatsList = [[], ]
for beatsPerPage in [1,2,3,4,5,6,7,8,9,10,11,12]:
accents = []
for j in GenerationConstants.MID_ACCENTS[beatsPerPage]:
accents.append(j * Config.TICKS_PER_BEAT / 2)
beatsList.append(accents)
beats = []
downBeats = []
for beat in range( beatsPerPage ):
beats.append( beat * Config.TICKS_PER_BEAT )
beats.append( beat * Config.TICKS_PER_BEAT + ( Config.TICKS_PER_BEAT / 2 ) )
for i in range( len( beats ) ):
downBeats.append( ( beats[ GenerationConstants.MID_ACCENTS[ beatsPerPage ][ i ] ], int( pow( float( len( beats ) - i) / len( beats ), 1.5 ) * 100.) ) )
mid_list.append(downBeats)
string = ' DRUM_MID_PROB = ' + str(mid_list) + '\n'
f.write(string)
string = ' DRUM_MID_ACCENT = ' + str(beatsList) + '\n'
g.write(string)
# gen high list
beatsList = [[], ]
for beatsPerPage in [1,2,3,4,5,6,7,8,9,10,11,12]:
accents = []
for j in GenerationConstants.HIGH_ACCENTS[beatsPerPage]:
accents.append(j * Config.TICKS_PER_BEAT / 2)
beatsList.append(accents)
beats = []
downBeats = []
for beat in range( beatsPerPage ):
beats.append( beat * Config.TICKS_PER_BEAT )
beats.append( beat * Config.TICKS_PER_BEAT + ( Config.TICKS_PER_BEAT / 2 ) )
for i in range( len( beats ) ):
downBeats.append( ( beats[ GenerationConstants.HIGH_ACCENTS[ beatsPerPage ][ i ] ], int( pow( float( len( beats ) - i) / len( beats ), 1.5 ) * 100.) ) )
high_list.append(downBeats)
string = ' DRUM_HIGH_PROB = ' + str(high_list) + '\n'
f.write(string)
string = ' DRUM_HIGH_ACCENT = ' + str(beatsList) + '\n'
g.write(string)
f.close()
g.close()
|