sequences

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph cluster_builtins { graph [label=builtins]; node [color=1]; "builtins.object" [URL="https://docs.python.org/3.9/library/functions.html#object", label=object, target=_top]; } subgraph "cluster_pang.sequences" { graph [label="pang.sequences"]; node [color=2]; "pang.sequences.Sequence" [URL="../api/pang/sequences.html#pang.sequences.Sequence", color=black, fontcolor=white, label=Sequence, target=_top]; } "builtins.object" -> "pang.sequences.Sequence"; }


Classes

Sequence

Sequence of sound-points.

class pang.sequences.Sequence(sound_points_generator=None, nservers=1, sequence_duration=0)

Sequence of sound-points.


Attributes Summary

__getitem__

__len__

__repr__

Gets interpreter representation.

durations

durations_in_millesecond

Returns the duration of each note in millesecond (before queue simulation).

extend

Extends a sequence with another.

insert

Inserts a sequence into another.

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.

simulate_queue

Simulate the queue based on the queue type.

superpose


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.