Overview
Comment: | Fixed tempo for realz this time |
---|---|
Timelines: | family | ancestors | descendants | both | feature/abc |
Files: | files | file ages | folders |
SHA1: |
4b32d1483bb91ebbcdf5d75fbfa11045 |
User & Date: | brian on 2011-09-22 17:58:22 |
Other Links: | branch diff | manifest | tags |
Context
2011-09-22
| ||
18:04 | Fixed bug that prevented more than two sections from working properly check-in: b2ce9522e9 user: brian tags: feature/abc | |
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 | |
Changes
Modified parse.py from [d321d5c2e1] to [8a5aef4235].
1 1 #!/usr/bin/env python 2 2 3 3 import tree 4 4 5 5 from ply import lex, yacc 6 6 class Note(): 7 - def __init__(self, value, duration=.25, octave=8): 7 + def __init__(self, value, duration=1, octave=8): 8 8 self.value = value 9 9 self.duration = duration 10 10 self.octave = octave 11 11 self.accidental = None 12 12 def __repr__(self): 13 13 return "Note %s %s %s" % (self.value, self.duration, self.octave) 14 14 15 15 class Chord(): 16 - def __init__(self, value, duration=.25, chord_type="major", octave=5): 16 + def __init__(self, value, duration=1, chord_type="major", octave=5): 17 17 self.value = value 18 18 self.duration = duration 19 19 self.chord_type = chord_type 20 20 self.octave = octave 21 21 def __repr__(self): 22 22 return "Chord %s %s %s" % (self.value, self.duration, self.chord_type, self.octave) 23 23 24 24 25 25 class Rest(): 26 - def __init__(self, duration=.25): 26 + def __init__(self, duration=1): 27 27 self.duration = duration 28 28 def __repr__(self): 29 29 return "Rest node %s" % self.duration 30 30 31 31 32 32 def parse(score, default_octave=8): 33 33 # Tokenize (lex) ................................................................................ 108 108 new_note.duration = p[2] 109 109 p[0] = new_note 110 110 111 111 def p_chord_length(p): 112 112 ''' chord : chord NOTE_LENGTH 113 113 ''' 114 114 new_note = p[1] 115 - new_note.duration = 4*p[2] 115 + new_note.duration = p[2] 116 116 p[0] = new_note 117 117 118 118 119 119 def p_chord(p): 120 120 '''chord : QUOTE pitch QUOTE 121 121 | QUOTE pitch CHORD_TYPE QUOTE 122 122 ''' ................................................................................ 148 148 149 149 def p_rest(p): 150 150 ''' rest : REST 151 151 | REST NOTE_LENGTH 152 152 ''' 153 153 p[0] = Rest() 154 154 if len(p) > 2: 155 - p[0].duration = 4*p[2] 155 + p[0].duration = p[2] 156 156 157 157 def p_node(p): 158 158 '''node : NODE 159 159 ''' 160 160 p[0] = tree.Tree(p[1].strip("(").strip(")")) 161 161 162 162
Modified test.sco from [0d4c902ccc] to [ec3cdf0cc7].
5 5 6 6 i2 0.000000 0.250000 7000 8.04 2 7 7 i2 0.250000 0.250000 7000 8.09 2 8 8 i2 0.500000 0.250000 7000 8.02 2 9 9 i2 0.750000 0.250000 7000 8.07 2 10 10 i2 1.000000 0.250000 7000 8.05 2 11 11 i2 1.250000 0.250000 7000 8.05 2 12 -i2 1.500000 0.250000 7000 8.00 2 13 -i2 1.750000 0.500000 7000 8.07 2 14 -i2 2.250000 0.500000 7000 8.07 2 15 -i2 2.750000 0.500000 7000 8.07 2 16 -i2 3.250000 0.250000 7000 8.00 2 17 -i2 3.500000 0.250000 7000 7.11 2 18 -i2 3.750000 0.250000 7000 9.05 2 19 -i2 4.000000 0.250000 7000 8.00 2 20 -i2 4.250000 0.250000 7000 8.05 2 21 -i2 4.500000 0.250000 7000 8.00 2 22 -i2 4.750000 0.250000 7000 8.11 2 23 -i2 5.000000 0.250000 7000 8.04 2 24 -i2 5.250000 0.250000 7000 8.09 2 25 -i2 5.500000 0.250000 7000 8.02 2 26 -i2 5.750000 0.250000 7000 8.07 2 27 -i2 6.000000 0.250000 7000 8.05 2 28 -i2 6.250000 0.250000 7000 8.05 2 29 -i2 6.500000 2.000000 7000 8.11 2 30 -i2 8.500000 0.250000 7000 8.02 2 31 -i2 8.750000 0.250000 7000 8.02 2 32 -i2 9.000000 0.500000 7000 8.07 2 33 -i2 9.500000 0.500000 7000 8.09 2 34 -i2 10.000000 0.250000 7000 8.02 2 35 -i2 10.250000 0.250000 7000 8.00 2 36 -i2 10.500000 0.250000 7000 8.00 2 37 -i2 10.750000 0.250000 7000 8.00 2 38 -i2 11.000000 0.250000 7000 8.00 2 39 -i2 11.250000 0.500000 7000 8.05 2 40 -i2 11.750000 0.500000 7000 8.05 2 41 -i2 12.250000 0.250000 7000 8.00 2 42 -i2 12.500000 0.250000 7000 8.00 2 43 -i2 12.750000 0.250000 7000 8.00 2 44 -i2 13.000000 0.250000 7000 8.00 2 45 -i2 13.250000 0.500000 7000 8.05 2 46 -i2 13.750000 0.500000 7000 8.05 2 47 -i2 14.250000 0.250000 7000 8.00 2 48 -i2 14.500000 0.250000 7000 8.00 2 49 -i2 14.750000 0.250000 7000 8.00 2 50 -i2 15.000000 0.250000 7000 8.00 2 51 -i2 15.250000 0.500000 7000 8.05 2 52 -i2 15.750000 0.500000 7000 8.05 2 53 -i2 16.250000 0.500000 7000 8.05 2 54 -i2 8.500000 0.250000 7000 8.02 2 55 -i2 8.750000 0.250000 7000 8.02 2 56 -i2 9.000000 0.500000 7000 8.07 2 57 -i2 9.500000 0.500000 7000 8.09 2 58 -i2 10.000000 0.250000 7000 8.02 2 59 -i2 10.250000 0.250000 7000 8.02 2 60 -i2 10.500000 0.250000 7000 8.02 2 61 -i2 10.750000 0.500000 7000 8.07 2 62 -i2 11.250000 0.500000 7000 8.09 2 63 -i2 11.750000 0.250000 7000 8.02 2 64 -i2 12.000000 0.250000 7000 8.02 2 65 -i2 12.250000 0.250000 7000 8.02 2 66 -i2 12.500000 0.500000 7000 8.07 2 67 -i2 13.000000 0.500000 7000 8.09 2 68 -i2 13.500000 0.250000 7000 8.02 2 69 -i2 13.750000 0.250000 7000 8.02 2 70 -i2 14.000000 0.250000 7000 8.02 2 71 -i2 14.250000 0.500000 7000 8.07 2 72 -i2 14.750000 0.500000 7000 8.09 2 73 -i2 15.250000 0.250000 7000 8.02 2 74 -i2 15.500000 0.250000 7000 8.02 2 75 -i2 15.750000 0.250000 7000 8.02 2 76 -i2 16.000000 0.500000 7000 8.07 2 77 -i2 16.500000 0.500000 7000 8.09 2 78 -i2 17.000000 0.250000 7000 8.02 2 79 -i2 17.250000 0.250000 7000 8.02 2 12 +i2 1.500000 2.000000 7000 8.11 2 13 +i2 3.500000 1.000000 7000 8.02 2 14 +i2 4.500000 1.000000 7000 8.02 2 15 +i2 5.500000 0.500000 7000 8.07 2 16 +i2 6.000000 0.500000 7000 8.09 2 17 +i2 6.500000 1.000000 7000 8.02 2 18 +i2 7.500000 1.000000 7000 8.02 2 19 +i2 8.500000 1.000000 7000 8.02 2 20 +i2 9.500000 0.500000 7000 8.07 2 21 +i2 10.000000 0.500000 7000 8.09 2 22 +i2 10.500000 1.000000 7000 8.02 2 23 +i2 11.500000 1.000000 7000 8.02 2 24 +i2 3.500000 1.000000 7000 8.02 2 25 +i2 4.500000 1.000000 7000 8.02 2 26 +i2 5.500000 0.500000 7000 8.07 2 27 +i2 6.000000 0.500000 7000 8.09 2 28 +i2 6.500000 1.000000 7000 8.02 2 29 +i2 7.500000 1.000000 7000 8.02 2 30 +i2 8.500000 1.000000 7000 8.02 2 31 +i2 9.500000 0.500000 7000 8.07 2 32 +i2 10.000000 0.500000 7000 8.09 2 33 +i2 10.500000 1.000000 7000 8.02 2 34 +i2 11.500000 1.000000 7000 8.02 2