sequences¶
Classes
Sequence of sound-points. |
-
class
pang.sequences.
Sequence
(sound_points_generator=None, nservers=1, sequence_duration=0)¶ Sequence of sound-points.
Attributes Summary
Gets interpreter representation.
Returns the duration of each note in millesecond (before queue simulation).
Extends a sequence with another.
Inserts a sequence into another.
Returns the number of servers.
Returns the sequence duration in seconds.
Returns the servers that are attached to this sequence.
Simulate the queue based on the queue type.
Special methods
-
__getitem__
(index)¶
-
__len__
()¶
-
overridden
__repr__
()¶ Gets interpreter representation.
Methods
-
extend
(sequence, time_gap=0)¶ Extends a sequence with another.
>>> instances = [0, 1, 2, 3] >>> durations = [0.5, 0.5, 0.5, 0.5] >>> sound_points_generator = pang.ManualSoundPointsGenerator( ... instances=instances, ... durations=durations, ... ) >>> sequence_0 = pang.Sequence( ... sound_points_generator=sound_points_generator, ... sequence_duration=4, ... ) >>> sequence_1 = pang.Sequence( ... sound_points_generator=sound_points_generator, ... ) >>> sequence_0.extend(sequence_1) >>> print(sequence_0.instances) [0, 1, 2, 3, 4, 5, 6, 7]
>>> print(sequence_0.durations) [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
-
insert
(offset, sequence)¶ Inserts a sequence into another.
offset
should be specified in seconds.>>> instances = [0, 1, 2, 3] >>> durations = [0.5, 0.5, 0.5, 0.5] >>> pitches = [0, 0, 0, 0] >>> sound_points_generator = pang.ManualSoundPointsGenerator( ... instances=instances, ... durations=durations, ... pitches=pitches, ... ) >>> sequence_0 = pang.Sequence( ... sound_points_generator=sound_points_generator, ... sequence_duration=4, ... ) >>> pitches = [1, 1, 1, 1] >>> sound_points_generator = pang.ManualSoundPointsGenerator( ... instances=instances, ... durations=durations, ... pitches=pitches, ... ) >>> sequence_1 = pang.Sequence( ... sound_points_generator=sound_points_generator, ... sequence_duration=4, ... ) >>> sequence_0.insert(2, sequence_1) >>> print(sequence_0.instances) [0, 1, 2, 3, 4, 5, 6, 7]
>>> print(sequence_0.pitches) [0, 0, 1, 1, 1, 1, 0, 0]
>>> print(sequence_0.durations) [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
-
simulate_queue
()¶ Simulate the queue based on the queue type.
-
superpose
(sequence)¶
Read-only properties
-
durations
¶
-
durations_in_millesecond
¶ Returns the duration of each note in millesecond (before queue simulation).
-
instances
¶
-
nservers
¶ Returns the number of servers.
-
pitches
¶
-
sequence_duration
¶ Returns the sequence duration in seconds.
-
servers
¶ Returns the servers that are attached to this sequence.
-