Esempio n. 1
0
    def test_point_tuple_arbitrary_data(self):
        """
        Ensure points can handle arbitrary data
        """
        from sebastian.core import Point
        p1 = Point(a=1, b="foo")

        self.assertEqual(p1.tuple("b", "a"), ("foo", 1))
Esempio n. 2
0
#!/usr/bin/env python

from sebastian.core import Point, OSequence, HSeq
from sebastian.core import OFFSET_64, MIDI_PITCH, DURATION_64
from sebastian.core.notes import Key, major_scale


## points

p1 = Point({
    OFFSET_64: 16,
    MIDI_PITCH: 50,
    DURATION_64: 16,
})

assert p1.tuple(OFFSET_64, DURATION_64) == (16, 16)


## sequences

p2 = Point({
    OFFSET_64: 32,
    MIDI_PITCH: 52,
    DURATION_64: 16,
})

s1 = OSequence([p1, p2])

assert s1._elements == [
    {DURATION_64: 16, OFFSET_64: 16, MIDI_PITCH: 50},
    {DURATION_64: 16, OFFSET_64: 32, MIDI_PITCH: 52}