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 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 __init__(self, number=None, *args, **kwargs): super().__init__(name='Cello', abbreviation='vc.', number=number, *args, **kwargs) self.strings = { 4: String(4, C(2)), 3: String(3, G(2)), 2: String(2, D(3)), 1: String(1, A(3)) } self.standard_clefs = BASS_CLEF
def __init__(self, number=None, *args, **kwargs): super().__init__(name='Viola', abbreviation='vla.', number=number, *args, **kwargs) self.strings = { 4: String(4, C(3)), 3: String(3, G(3)), 2: String(2, D(4)), 1: String(1, A(4)) } self.standard_clefs = ALTO_CLEF
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
def __init__(self, number=None, *args, **kwargs): super().__init__(name='Viola d\'amore\n430', abbreviation='vla.', number=number, *args, **kwargs) # skordatura self.strings = { 1: String(1, B(4)), 2: String(2, B(4)), 3: String(3, F(4, '#')), 4: String(4, C(4)), 5: String(5, G(3)), 6: String(6, D(3)), 7: String(7, A(2)) }
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]