本文整理汇总了Python中solfege.mpd.track.Track.str_repr方法的典型用法代码示例。如果您正苦于以下问题:Python Track.str_repr方法的具体用法?Python Track.str_repr怎么用?Python Track.str_repr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solfege.mpd.track.Track
的用法示例。
在下文中一共展示了Track.str_repr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_melodic_interval_2_tracks
# 需要导入模块: from solfege.mpd.track import Track [as 别名]
# 或者: from solfege.mpd.track.Track import str_repr [as 别名]
def test_melodic_interval_2_tracks(self):
"""
In this test, only MIDI channel 0 will be allocated, even though
two different patches and volumes are used. This because the tones
from the two tracks does not sound at the same time.
"""
t1 = Track()
t1.set_patch(1)
t1.set_volume(101)
t1.note(4, 64)
t2 = Track()
t2.set_patch(2)
t2.set_volume(102)
t2.notelen_time(4)
t2.note(4, 66)
self.assertEquals(t1.str_repr(), "p1 v101 n64 d1/4 o64")
self.assertEquals(t2.str_repr(), "p2 v102 d1/4 n66 d1/4 o66")
m = MidiEventStream(t1, t2)
self.assertEquals(m.str_repr(1),
"p0:1 v0:101 n0:64 d1/4 o64 p0:2 v0:102 n0:66 d1/4 o66")
示例2: test_add
# 需要导入模块: from solfege.mpd.track import Track [as 别名]
# 或者: from solfege.mpd.track.Track import str_repr [as 别名]
def test_add(self):
t1 = Track()
t1.note(8, 92, 121)
self.assertEqual("n92 d1/8 o92", t1.str_repr())
t2 = Track()
t2.note(2, 90, 120)
self.assertEqual("n90 d1/2 o90", t2.str_repr())
self.assertEqual("n92 d1/8 o92", t1.str_repr())
self.assertEqual("n90 d1/2 o90", t2.str_repr())
m1 = MidiEventStream(t1)
m2 = MidiEventStream(t2)
t3 = t1 + t2
self.assertEqual("n92 d1/8 o92 n90 d1/2 o90", t3.str_repr())
m3 = MidiEventStream(t3)
self.assertEqual("n92 d1/8 o92", t1.str_repr())
self.assertEqual("n90 d1/2 o90", t2.str_repr())
# FIXME volume bug?
self.assertEqual("p0:0 v0:100 n0:92 d1/8 o92", m1.str_repr(1))
self.assertEqual("p0:0 v0:100 n0:90 d1/2 o90", m2.str_repr(1))
self.assertEqual("p0:0 v0:100 n0:92 d1/8 o92 n0:90 d1/2 o90", m3.str_repr(1))