def test_2(self): midis = [ D(4), D(4), D(4), D(4), C(4), C(4), C(4), B(3), C(4), C(4), C(4), F(4), E(4), D(4), F(4), F(4), F(4), E(4), D(4), E(4), F(4) ] durations = [ 2, 3, 1, 2, 3, 1, 4, 2, 4, 2, 2, 3, 1, 2, 2, 2, 2, 3, 1, 1, 4 ] durations = [d / 2 for d in durations] sf = SimpleFormat(midis=midis, quarter_durations=durations) v = sf.to_stream_voice(1) v.add_to_score(self.score) result_path = path + '_test_2' self.score.write(path=result_path)
def test_6(self): xml_path = path + '_test_6.xml' self.sf.to_stream_voice().add_to_score(self.score) self.sf.mirror(pivot=E(5)) self.sf.to_stream_voice().add_to_score(self.score, staff_number=2) self.score.write(xml_path) self.assertCompareFiles(xml_path)
def __init__(self, key=E(1, 'b'), a4=430, *args, **kwargs): super().__init__(name='Horn in E♭\n430', abbreviation='hrn.', key=key, a4=a4, *args, **kwargs) self.transposition = 9
class Cymbal(TreeInstrument): midis = {1: E(4), 2: G(4), 3: B(4), 4: D(5), 5: F(5)} def __init__(self, number=1, *args, **kwargs): super().__init__(name='cymbal-' + str(number), abbreviation='cym-' + str(number), number=number, *args, **kwargs) self.midi = self.midis[self.number] self.midi.notehead = 'x'
def __init__(self, number=None, *args, **kwargs): super().__init__(name='Violin', abbreviation='vln.', number=number, *args, **kwargs) self.strings = { 4: String(4, G(3)), 3: String(3, D(4)), 2: String(2, A(4)), 1: String(1, E(5)) } self.standard_clefs = TREBLE_CLEF
return self.sign == other.sign and self.line == other.line and self.octave_change == other.octave_change else: return False def __ne__(self, other): return not self.__eq__(other) def __deepcopy__(self, memodict={}): copy = self.__class__(sign=self.sign, line=self.line, octave_change=self.octave_change, optimal_range=self.optimal_range) copy.number = self.number return copy SUPER_HIGH_TREBLE_CLEF = TreeClef(sign='G', line=2, octave_change=2, optimal_range=[C(7), None]) HIGH_TREBLE_CLEF = TreeClef(sign='G', line=2, octave_change=1, optimal_range=[C(6), None]) TREBLE_CLEF = TreeClef(sign='G', line=2, optimal_range=[G(3), E(6)]) LOW_TREBLE_CLEF = TreeClef(sign='G', line=2, octave_change=-1, optimal_range=[G(2), E(5)]) BASS_CLEF = TreeClef(sign='F', line=4, optimal_range=[B(1), G(4)]) LOW_BASS_CLEF = TreeClef(sign='F', line=4, octave_change=-1, optimal_range=[None, B(1)]) SUPER_LOW_BASS_CLEF = TreeClef(sign='F', line=4, octave_change=-2, optimal_range=[None, G(1)]) ALTO_CLEF = TreeClef(sign='C', line=3, optimal_range=[A(2), F(5)]) TENOR_CLEF = TreeClef(sign='C', line=4, optimal_range=[F(2), D(5)]) PERCUSSION_CLEF = TreeClef('percussion') ALL_CLEFS = [SUPER_HIGH_TREBLE_CLEF, HIGH_TREBLE_CLEF, TREBLE_CLEF, LOW_TREBLE_CLEF, BASS_CLEF, LOW_BASS_CLEF, SUPER_LOW_BASS_CLEF, ALTO_CLEF, TENOR_CLEF]
def test_3(self): midi = E(6) # print(midi.value) midi.transpose(3)