def test_3(self): midis = { 'flat': [Midi(value, accidental=Accidental('flat', force_show=True)) for value in range(60, 72)], 'sharp': [Midi(value, accidental=Accidental('sharp', force_show=True)) for value in range(60, 72)] } sf = SimpleFormat(midis=midis['flat'] + midis['sharp']) for chord in sf.chords: chord.add_harmonic(5) self.score.set_time_signatures(times={1: [12, 4]}) sf.to_stream_voice().add_to_score(self.score) xml_path = path + '_test_3.xml' self.score.write(xml_path)
def test_5(self): midi = Midi(58, accidental=Accidental(mode='sharp')) expected = '''<pitch> <step>A</step> <alter>1</alter> <octave>3</octave> </pitch> ''' self.assertEqual(expected, midi.get_pitch_rest().to_string())
def test_4(self): midi = Midi(59, accidental=Accidental(mode='enharmonic_2')) expected = '''<pitch> <step>A</step> <alter>2</alter> <octave>3</octave> </pitch> ''' self.assertEqual(expected, midi.get_pitch_rest().to_string())
def test_chord_midi(self): chord = TreeChord(Midi(63, accidental = Accidental(mode='sharp')), quarter_duration=2) tree_note = chord.notes[0] tree_note.update_duration(divisions=1) result = '''<note> <pitch> <step>D</step> <alter>1</alter> <octave>4</octave> </pitch> <duration>2</duration> </note> ''' self.assertEqual(tree_note.to_string(), result)
def test_12(self): midi = Midi(60.5, accidental=Accidental(mode='flat')) expected = 'Db-4' self.assertEqual(expected, midi.__name__)
def test_11(self): midi = Midi(60.5, accidental=Accidental(mode='sharp')) expected = 'C+4' self.assertEqual(expected, midi.__name__)