def testFromSoundingPitch(self): ''' A score with mixed sounding and written parts. ''' m = stream.Measure([instrument.Clarinet(), note.Note('C')]) p1 = stream.Part(m) p1.atSoundingPitch = True p2 = stream.Part(stream.Measure([instrument.Bassoon(), note.Note()])) s = stream.Score([p1, p2]) self.assertEqual(s.atSoundingPitch, 'unknown') gex = GeneralObjectExporter(s) root = et_fromstring(gex.parse().decode('utf-8')) self.assertEqual(len(root.findall('.//transpose')), 1) self.assertEqual(root.find('.//step').text, 'D') s.atSoundingPitch = True gex = GeneralObjectExporter(s) root = et_fromstring(gex.parse().decode('utf-8')) self.assertEqual(len(root.findall('.//transpose')), 1) self.assertEqual(root.find('.//step').text, 'D')
def ch1_writing_I_B_3(show=True, *arguments, **keywords): ''' p. 7. Transcribe Purcell, "Music for a While" for bassoon in tenor clef >>> a = True ''' # Purcell, "Music for a While" humdata = ''' **kern *clefF4 8C 8D 8E 8EE 8AA 8E 8F 8AA 8BB 8F# 8G 8BB 8C 8G# 8A 8C# *- ''' ex = converter.parseData(humdata) clefOld = ex.flat.getElementsByClass(clef.Clef)[0] # replace the old clef ex.flat.replace(clefOld, clef.TenorClef()) ex.insert(0, instrument.Bassoon()) if show: ex.show()