Пример #1
0
 def testNineEight(self):
     count = MeasureCount.makeSimpleCount(self.eighths, 4)
     count.addBeats(Beat.Beat(self.eighths, 1), 1)
     self.assertEqual(count.timeSig(), (9, 8))
     count = MeasureCount.makeSimpleCount(self.sixteenths, 4)
     count.addBeats(Beat.Beat(self.sixteenths, 2), 1)
     self.assertEqual(count.timeSig(), (9, 8))
Пример #2
0
 def testFiveFour(self):
     count = MeasureCount.makeSimpleCount(self.eighths, 5)
     self.assertEqual(count.timeSig(), (5, 4))
     count = MeasureCount.makeSimpleCount(self.triplets, 5)
     self.assertEqual(count.timeSig(), (5, 4))
     count = MeasureCount.makeSimpleCount(self.sixteenths, 5)
     self.assertEqual(count.timeSig(), (5, 4))
Пример #3
0
 def testSevenFour(self):
     count = MeasureCount.makeSimpleCount(self.eighths, 7)
     self.assertEqual(count.timeSig(), (7, 4))
     count = MeasureCount.makeSimpleCount(self.triplets, 7)
     self.assertEqual(count.timeSig(), (7, 4))
     count = MeasureCount.makeSimpleCount(self.sixteenths, 7)
     self.assertEqual(count.timeSig(), (7, 4))
Пример #4
0
 def testSimpleDefaultWrite(self):
     myCounter = Counter.Counter("e+a")
     count = MeasureCount.makeSimpleCount(myCounter, 4)
     handle = StringIO()
     indenter = fileUtils.Indenter(handle)
     dbfsv1.DefaultMeasureCountStructureV1().write(count, indenter)
     output = handle.getvalue().splitlines()
     self.assertEqual(output,
                      ["START_DEFAULT_MEASURE_COUNT",
                       "  BEAT_START",
                       "    NUM_TICKS 4",
                       "    COUNT |^e+a|",
                       "  BEAT_END",
                       "  BEAT_START",
                       "    NUM_TICKS 4",
                       "    COUNT |^e+a|",
                       "  BEAT_END",
                       "  BEAT_START",
                       "    NUM_TICKS 4",
                       "    COUNT |^e+a|",
                       "  BEAT_END",
                       "  BEAT_START",
                       "    NUM_TICKS 4",
                       "    COUNT |^e+a|",
                       "  BEAT_END",
                       "END_DEFAULT_MEASURE_COUNT"])
Пример #5
0
 def testMultiMeasures(self):
     score = Score()
     settings = ASCIISettings()
     settings.omitEmpty = False
     score.drumKit = DrumKit.DrumKit()
     score.drumKit.addDrum(Drum.Drum("HiHat", "Hh", "x"))
     score.drumKit.addDrum(Drum.Drum("Crash", "Cr", "x"))
     counter = MeasureCount.counterMaker(4, 16)
     score.insertMeasureByIndex(16, counter = counter)
     score.insertMeasureByIndex(16, counter = counter)
     score.insertMeasureByIndex(16, counter = counter)
     score.addNote(NotePosition(0, 0, 0, 0), "x")
     score.addNote(NotePosition(0, 1, 0, 0), "y")
     score.addNote(NotePosition(0, 2, 0, 0), "z")
     output = self.getOutput(score, settings)
     self.assertEqual(output,
                      ['Tabbed with DrumBurp, a drum tab editor from www.whatang.org',
                       '',
                       'Title     : ',
                       'Artist    : ',
                       'BPM       : 120',
                       'Tabbed by : ',
                       'Date      : ' + self.exportDate,
                       '',
                       'Cr - Crash',
                       'Hh - HiHat',
                       '',
                       'Cr|----------------|----------------|----------------|',
                       'Hh|x---------------|y---------------|z---------------|',
                       '   1e+a2e+a3e+a4e+a 1e+a2e+a3e+a4e+a 1e+a2e+a3e+a4e+a ',
                       '',
                       'Tabbed with DrumBurp, a drum tab editor from www.whatang.org'])
Пример #6
0
 def testSimpleWrite(self):
     myCounter = Counter.Counter("e+a")
     count = MeasureCount.makeSimpleCount(myCounter, 4)
     handle = StringIO()
     indenter = fileUtils.Indenter(handle)
     dbfsv0.MeasureCountStructureV0().write(count, indenter)
     output = handle.getvalue().splitlines()
     self.assertEqual(output,
                      ["COUNT_INFO_START",
                       "  REPEAT_BEATS 4",
                       "  BEAT_START",
                       "    COUNT |^e+a|",
                       "  BEAT_END",
                       "COUNT_INFO_END"])
Пример #7
0
 def getSmallestSimpleCount(self):
     if not self.counter.isSimpleCount():
         return None
     numBeats = self.counter.numBeats()
     maxLen = len(self)
     newCount = None
     for unused_, count in Counter.DEFAULT_REGISTRY:
         if len(count) * numBeats >= maxLen:
             continue
         mcount = MeasureCount.makeSimpleCount(count, numBeats)
         newMeasure = self.copyMeasure()
         newMeasure.setBeatCount(mcount)
         if self.numNotes() == newMeasure.numNotes():
             newCount = mcount
     return newCount
Пример #8
0
 def testSeventeenSixteen(self):
     count = MeasureCount.makeSimpleCount(self.sixteenths, 4)
     count.addBeats(Beat.Beat(self.sixteenths, 1), 1)
     self.assertEqual(count.timeSig(), (17, 16))
Пример #9
0
 def testMake(self):
     count = MeasureCount.counterMaker(4, 16)
     self.assert_(isinstance(count, MeasureCount.MeasureCount))
     self.assert_(count.isSimpleCount())
     self.assertEqual(len(count), 16)
Пример #10
0
 def _makeOldMeasure(self, lineData):
     self.counter = MeasureCount.counterMaker(int(lineData),
                                              len(self))