spiffyscore

Check-in [2906c127b7]
Login
Overview
Comment:Fixed note duration calculation- whole is now 4, quarter is 1
Timelines: family | ancestors | descendants | both | feature/abc
Files: files | file ages | folders
SHA1: 2906c127b758b49e290c63b7278be40ac8274ff4
User & Date: brian on 2011-09-22 17:49:07
Other Links: branch diff | manifest | tags
Context
2011-09-22
17:58
Fixed tempo for realz this time check-in: 4b32d1483b user: brian tags: feature/abc
17:49
Fixed note duration calculation- whole is now 4, quarter is 1 check-in: 2906c127b7 user: brian tags: feature/abc
17:46
Added back in section ordering support check-in: 6dd4fffb1d user: brian tags: feature/abc
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Modified parse.py from [55456fde56] to [d321d5c2e1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python

import tree

from ply import lex, yacc
class Note():
    def __init__(self, value, duration=1 octave=8):
        self.value = value
        self.duration = duration
        self.octave = octave
        self.accidental = None
    def __repr__(self):
        return "Note %s %s %s" % (self.value, self.duration, self.octave)

class Chord():
    def __init__(self, value, duration=1, chord_type="major", octave=5):
        self.value = value
        self.duration = duration
        self.chord_type = chord_type
        self.octave = octave
    def __repr__(self):
        return "Chord %s %s %s" % (self.value, self.duration, self.chord_type, self.octave)







|








|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python

import tree

from ply import lex, yacc
class Note():
    def __init__(self, value, duration=.25, octave=8):
        self.value = value
        self.duration = duration
        self.octave = octave
        self.accidental = None
    def __repr__(self):
        return "Note %s %s %s" % (self.value, self.duration, self.octave)

class Chord():
    def __init__(self, value, duration=.25, chord_type="major", octave=5):
        self.value = value
        self.duration = duration
        self.chord_type = chord_type
        self.octave = octave
    def __repr__(self):
        return "Chord %s %s %s" % (self.value, self.duration, self.chord_type, self.octave)

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
        new_note.duration = p[2]
        p[0] = new_note

    def p_chord_length(p):
        ''' chord : chord NOTE_LENGTH
        '''
        new_note = p[1]
        new_note.duration = p[2]
        p[0] = new_note


    def p_chord(p):
        '''chord : QUOTE pitch QUOTE
                | QUOTE pitch CHORD_TYPE QUOTE
        '''







|







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
        new_note.duration = p[2]
        p[0] = new_note

    def p_chord_length(p):
        ''' chord : chord NOTE_LENGTH
        '''
        new_note = p[1]
        new_note.duration = 4*p[2]
        p[0] = new_note


    def p_chord(p):
        '''chord : QUOTE pitch QUOTE
                | QUOTE pitch CHORD_TYPE QUOTE
        '''
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162

    def p_rest(p):
        ''' rest : REST
                | REST NOTE_LENGTH
        '''
        p[0] = Rest()
        if len(p) > 2:
            p[0].duration = p[2]

    def p_node(p):
        '''node : NODE
        '''
        p[0] = tree.Tree(p[1].strip("(").strip(")"))









|







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162

    def p_rest(p):
        ''' rest : REST
                | REST NOTE_LENGTH
        '''
        p[0] = Rest()
        if len(p) > 2:
            p[0].duration = 4*p[2]

    def p_node(p):
        '''node : NODE
        '''
        p[0] = tree.Tree(p[1].strip("(").strip(")"))


Modified test.sco from [00c6c84bf8] to [0d4c902ccc].

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
























f1 0 512 10 1
f2 0 8192 10 .24 .64 .88 .76 .06 .5 .34 .08
f3 0 1025 10 1
t 0 60
    
i2 0.000000 0.250000 7000 8.00 2






i2 0.250000 0.500000 7000 8.07 2
i2 0.750000 0.500000 7000 8.07 2
i2 1.250000 0.500000 7000 8.07 2
i2 1.750000 0.250000 7000 8.00 2
i2 2.000000 0.250000 7000 7.11 2
i2 2.250000 0.250000 7000 9.05 2
i2 2.500000 0.250000 7000 8.00 2
i2 2.750000 0.250000 7000 8.05 2
i2 3.000000 0.250000 7000 8.00 2
i2 3.250000 0.250000 7000 8.11 2
i2 3.500000 0.250000 7000 8.04 2
i2 3.750000 0.250000 7000 8.09 2
i2 4.000000 0.250000 7000 8.02 2
i2 4.250000 0.250000 7000 8.07 2



i2 4.500000 0.250000 7000 8.05 2
i2 4.750000 0.250000 7000 8.05 2
i2 5.000000 2.000000 7000 8.11 2

i2 7.000000 0.250000 7000 8.00 2
i2 7.250000 0.250000 7000 8.00 2
i2 7.500000 0.250000 7000 8.00 2
i2 7.750000 0.250000 7000 8.00 2

i2 8.000000 0.500000 7000 8.05 2
i2 8.500000 0.500000 7000 8.05 2
i2 9.000000 0.250000 7000 8.00 2
i2 9.250000 0.250000 7000 8.00 2
i2 9.500000 0.250000 7000 8.00 2
i2 9.750000 0.250000 7000 8.00 2
i2 10.000000 0.500000 7000 8.05 2
i2 10.500000 0.500000 7000 8.05 2
i2 11.000000 0.500000 7000 8.05 2

i2 7.000000 0.250000 7000 8.02 2
i2 7.250000 0.250000 7000 8.02 2

i2 7.500000 0.500000 7000 8.07 2
i2 8.000000 0.500000 7000 8.09 2

i2 8.500000 0.250000 7000 8.02 2
i2 8.750000 3.000000 7000 8.02 2





























|
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
|
|
|
>
|
|
|
|
>
|
|
<
|
|
|
|
|
|
>
|
|
>
|
|
>

|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
f1 0 512 10 1
f2 0 8192 10 .24 .64 .88 .76 .06 .5 .34 .08
f3 0 1025 10 1
t 0 60
    
i2 0.000000 0.250000 7000 8.04 2
i2 0.250000 0.250000 7000 8.09 2
i2 0.500000 0.250000 7000 8.02 2
i2 0.750000 0.250000 7000 8.07 2
i2 1.000000 0.250000 7000 8.05 2
i2 1.250000 0.250000 7000 8.05 2
i2 1.500000 0.250000 7000 8.00 2
i2 1.750000 0.500000 7000 8.07 2
i2 2.250000 0.500000 7000 8.07 2
i2 2.750000 0.500000 7000 8.07 2
i2 3.250000 0.250000 7000 8.00 2
i2 3.500000 0.250000 7000 7.11 2
i2 3.750000 0.250000 7000 9.05 2
i2 4.000000 0.250000 7000 8.00 2
i2 4.250000 0.250000 7000 8.05 2
i2 4.500000 0.250000 7000 8.00 2
i2 4.750000 0.250000 7000 8.11 2
i2 5.000000 0.250000 7000 8.04 2
i2 5.250000 0.250000 7000 8.09 2
i2 5.500000 0.250000 7000 8.02 2
i2 5.750000 0.250000 7000 8.07 2
i2 6.000000 0.250000 7000 8.05 2
i2 6.250000 0.250000 7000 8.05 2
i2 6.500000 2.000000 7000 8.11 2
i2 8.500000 0.250000 7000 8.02 2
i2 8.750000 0.250000 7000 8.02 2
i2 9.000000 0.500000 7000 8.07 2
i2 9.500000 0.500000 7000 8.09 2
i2 10.000000 0.250000 7000 8.02 2
i2 10.250000 0.250000 7000 8.00 2
i2 10.500000 0.250000 7000 8.00 2
i2 10.750000 0.250000 7000 8.00 2
i2 11.000000 0.250000 7000 8.00 2
i2 11.250000 0.500000 7000 8.05 2
i2 11.750000 0.500000 7000 8.05 2

i2 12.250000 0.250000 7000 8.00 2
i2 12.500000 0.250000 7000 8.00 2
i2 12.750000 0.250000 7000 8.00 2
i2 13.000000 0.250000 7000 8.00 2
i2 13.250000 0.500000 7000 8.05 2
i2 13.750000 0.500000 7000 8.05 2
i2 14.250000 0.250000 7000 8.00 2
i2 14.500000 0.250000 7000 8.00 2
i2 14.750000 0.250000 7000 8.00 2
i2 15.000000 0.250000 7000 8.00 2
i2 15.250000 0.500000 7000 8.05 2
i2 15.750000 0.500000 7000 8.05 2
i2 16.250000 0.500000 7000 8.05 2
i2 8.500000 0.250000 7000 8.02 2
i2 8.750000 0.250000 7000 8.02 2
i2 9.000000 0.500000 7000 8.07 2
i2 9.500000 0.500000 7000 8.09 2
i2 10.000000 0.250000 7000 8.02 2
i2 10.250000 0.250000 7000 8.02 2
i2 10.500000 0.250000 7000 8.02 2
i2 10.750000 0.500000 7000 8.07 2
i2 11.250000 0.500000 7000 8.09 2
i2 11.750000 0.250000 7000 8.02 2
i2 12.000000 0.250000 7000 8.02 2
i2 12.250000 0.250000 7000 8.02 2
i2 12.500000 0.500000 7000 8.07 2
i2 13.000000 0.500000 7000 8.09 2
i2 13.500000 0.250000 7000 8.02 2
i2 13.750000 0.250000 7000 8.02 2
i2 14.000000 0.250000 7000 8.02 2
i2 14.250000 0.500000 7000 8.07 2
i2 14.750000 0.500000 7000 8.09 2
i2 15.250000 0.250000 7000 8.02 2
i2 15.500000 0.250000 7000 8.02 2
i2 15.750000 0.250000 7000 8.02 2
i2 16.000000 0.500000 7000 8.07 2
i2 16.500000 0.500000 7000 8.09 2
i2 17.000000 0.250000 7000 8.02 2
i2 17.250000 0.250000 7000 8.02 2