当前位置: 首页>>代码示例>>Python>>正文


Python track.Track类代码示例

本文整理汇总了Python中solfege.mpd.track.Track的典型用法代码示例。如果您正苦于以下问题:Python Track类的具体用法?Python Track怎么用?Python Track使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Track类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_set_bpm

 def test_set_bpm(self):
     t = Track()
     t.set_bpm(120)
     t.note(4, 50)
     self.assertEqual(
         MidiEventStream(t).str_repr(1),
         "t120/4 p0:0 v0:100 n0:50 d1/4 o50")
开发者ID:tcamundsen,项目名称:solfege,代码行数:7,代码来源:test_track.py

示例2: test_bug1

 def test_bug1(self):
     """
     For each moment in time, all note-off events have to be
     done before the note-on events. This to avoid problems
     with the same note being played two times after each other
     in different tracks.
     """
     t1 = Track()
     t1.set_patch(3)
     t1.note(4, 93, 127)
     t1.note(4, 95, 127)
     t2 = Track()
     t2.set_patch(4)
     t2.note(4, 95, 127)
     t2.note(4, 97, 127)
     self.assertEquals(list(MidiEventStream(t1, t2)),
        [('program-change', 0, 3),
         ('volume', 0, 100),
         ('note-on', 0, 93, 127),
         ('program-change', 1, 4),
         ('volume', 1, 100),
         ('note-on', 1, 95, 127),
         ('notelen-time', Rat(1, 4)),
         ('note-off', 0, 93, 127),
         ('note-off', 1, 95, 127),
         ('note-on', 0, 95, 127),
         ('note-on', 1, 97, 127),
         ('notelen-time', Rat(1, 4)),
         ('note-off', 0, 95, 127),
         ('note-off', 1, 97, 127)])
     self.assertEquals(MidiEventStream(t1, t2).str_repr(details=1),
         "p0:3 v0:100 n0:93 p1:4 v1:100 n1:95 d1/4 o93 o95 n0:95 n1:97 d1/4 o95 o97")
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:32,代码来源:test_track.py

示例3: test_export_track

 def test_export_track(self):
     t = Track()
     t.start_note(50, 120)
     m = MidiExporter()
     m.start_export(os.path.join(outdir, "a.mid"))
     m.play_track(t)
     m.end_export()
     os.remove(os.path.join(outdir, "a.mid"))
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:8,代码来源:test_exporter.py

示例4: test_simple1

 def test_simple1(self):
     t = Track()
     t.note(4, 90, 127)
     self.assertEquals(list(MidiEventStream(t)),
       [('program-change', 0, 0),
        ('volume', 0, 100),
        ('note-on', 0, 90, 127),
        ('notelen-time', Rat(1, 4)),
        ('note-off', 0, 90, 127)])
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:9,代码来源:test_track.py

示例5: test_set_patch

 def test_set_patch(self):
     """
     If multiple set_patch is done, the last will be used.
     """
     t = Track()
     t.set_patch(2)
     t.set_patch(3)
     t.note(4, 55)
     self.assertEquals(MidiEventStream(t).str_repr(),
             "p0:3 v0:100 n55 d1/4 o55")
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:10,代码来源:test_track.py

示例6: test_set_bpm2

 def test_set_bpm2(self):
     """
     Two set_bpm in a row should only generate MIDI events for the
     last one.
     """
     t = Track()
     t.set_bpm(120)
     t.set_bpm(121)
     t.note(4, 50)
     self.assertEquals(MidiEventStream(t).str_repr(1),
         "t121/4 p0:0 v0:100 n0:50 d1/4 o50")
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:11,代码来源:test_track.py

示例7: test_set_bpm3

 def test_set_bpm3(self):
     """
     When two tracks set a different tempo, the tempo from the
     last track is used. There is not issues two MIDI events.
     """
     t1 = Track()
     t1.set_bpm(120)
     t1.note(4, 50)
     t2 = Track()
     t2.set_bpm(121)
     t2.note(4, 55)
     self.assertEquals(MidiEventStream(t1, t2).str_repr(1),
         "t121/4 p0:0 v0:100 n0:50 n0:55 d1/4 o50 o55")
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:13,代码来源:test_track.py

示例8: test_set_patch2

 def test_set_patch2(self):
     """
     Assert that there is not sendt a new volume event when we change patch.
     """
     t = Track()
     t.set_patch(2)
     t.note(4, 55)
     t.set_patch(3)
     t.note(4, 57)
     self.assertEquals(MidiEventStream(t).str_repr(),
             "p0:2 v0:100 n55 d1/4 o55 p0:3 n57 d1/4 o57")
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:11,代码来源:test_track.py

示例9: test_set_volume

 def test_set_volume(self):
     """
     Assert that there is not sendt a new pacth event when we change volume
     """
     t = Track()
     t.set_volume(98)
     t.note(4, 55)
     t.set_volume(99)
     t.note(4, 57)
     self.assertEquals(MidiEventStream(t).str_repr(),
             "p0:0 v0:98 n55 d1/4 o55 v0:99 n57 d1/4 o57")
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:11,代码来源:test_track.py

示例10: test_x2

 def test_x2(self):
     t1 = Track()
     t1.note(4, 62)
     t1.note(4, 60)
     t1.note(2, 62)
     t2 = Track()
     t2.note(1, 60)
     m = MidiEventStream(t1, t2)
     self.assertEqual("p0:0 p1:0 v0:100 n0:62 n0:60 d1/4 o62 v1:100 n1:60 d1/4 o60 n0:62 d1/2 o62 o60", m.str_repr(1))
开发者ID:tcamundsen,项目名称:solfege,代码行数:9,代码来源:test_track.py

示例11: test_midi_overlap

 def test_midi_overlap(self):
     t1 = Track()
     t1.note(8, 92, 121)
     t1.note(8, 90, 122)
     t1.note(8, 92, 123)
     t1.note(8, 94, 124)
     t2 = Track()
     t2.note(2, 90, 120)
     m = MidiEventStream(t1, t2)
     self.assertEqual("p0:0 p1:0 v0:100 n0:92 n0:90 d1/8 o92 v1:100 n1:90 d1/8 o90 n0:92 d1/8 o92 n0:94 d1/8 o94 o90", m.str_repr(1))
开发者ID:tcamundsen,项目名称:solfege,代码行数:10,代码来源:test_track.py

示例12: test_x3

 def test_x3(self):
     t1 = Track()
     t1.note(4, 62)
     t1.note(4, 60)
     t1.note(2, 62)
     t2 = Track()
     t2.note(1, 60)
     m = MidiEventStream(t1, t2)
     m.num_MIDI_channels = 1
     # We don't handle running out of MIDI channels yet
     self.assertRaises(Exception, m.str_repr, 1)
开发者ID:tcamundsen,项目名称:solfege,代码行数:11,代码来源:test_track.py

示例13: test_1voice_setpatch

 def test_1voice_setpatch(self):
     t = Track()
     t.note(4, 90, 127)
     t.set_patch(3)
     t.note(4, 91, 127)
     self.assertEquals(list(MidiEventStream(t)),
       [('program-change', 0, 0),
        ('volume', 0, 100),
        ('note-on', 0, 90, 127),
        ('notelen-time', Rat(1, 4)),
        ('note-off', 0, 90, 127),
        ('program-change', 0, 3),
        ('note-on', 0, 91, 127),
        ('notelen-time', Rat(1, 4)),
        ('note-off', 0, 91, 127),
        ])
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:16,代码来源:test_track.py

示例14: test_str_repr

 def test_str_repr(self):
     t1 = Track()
     t1.set_volume(88)
     t1.set_patch(3)
     t1.note(4, 93, 127)
     t2 = Track()
     t2.set_patch(4)
     t2.note(4, 94, 127)
     t3 = Track()
     t3.set_patch(5)
     t3.note(4, 95, 127)
     self.assertEquals(list(MidiEventStream(t1, t2, t3)),
        [
         ('program-change', 0, 3),
         ('volume', 0, 88),
         ('note-on', 0, 93, 127),
         ('program-change', 1, 4),
         ('volume', 1, 100),
         ('note-on', 1, 94, 127),
         ('program-change', 2, 5),
         ('volume', 2, 100),
         ('note-on', 2, 95, 127),
         ('notelen-time', Rat(1, 4)),
         ('note-off', 0, 93, 127),
         ('note-off', 1, 94, 127),
         ('note-off', 2, 95, 127)])
     self.assertEquals(MidiEventStream(t1, t2, t3).str_repr(details=1),
         "p0:3 v0:88 n0:93 p1:4 v1:100 n1:94 p2:5 v2:100 n2:95 d1/4 o93 o94 o95")
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:28,代码来源:test_track.py

示例15: test_track1

 def test_track1(self):
     t = Track()
     t.prepend_patch(33)
     t.note(4, 60, 120)
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:4,代码来源:test_track.py


注:本文中的solfege.mpd.track.Track类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。