Package midi :: Module slice :: Class EventStreamSlice
[hide private]
[frames] | no frames]

Class EventStreamSlice

source code

object --+
         |
        EventStreamSlice

Represents a portion of a midi stream (an EventStream).

The slice is not actually performed (events cut out of the stream) until needed, e.g. when creating a new event stream from the slice.

When the slice is performed, events are copied from the original stream into a whole new stream. The original stream is left intact and the events of the new stream are new events.

Instance Methods [hide private]
 
__init__(self, stream, start, end=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
to_event_stream(self, repeat_playing=True, cancel_playing=False, all_off=False)
Performs the actual slice operation, producing a new event stream for just the portion of the midi stream covered by the slice.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, stream, start, end=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • stream (EventStream) - the midi stream to take a slice of
  • start (int) - the start time in midi ticks
  • end (int or None) - the end time in midi ticks, or None to go to the end
Overrides: object.__init__

to_event_stream(self, repeat_playing=True, cancel_playing=False, all_off=False)

source code 

Performs the actual slice operation, producing a new event stream for just the portion of the midi stream covered by the slice.

Parameters:
  • repeat_playing (bool) - if True all notes currently being played at the start point will be replayed at the beginning of the result. Default: True
  • cancel_playing (bool) - if True, all notes being played at the end point will be cancelled (by an appropriate note-off) and the end of the result. Default: False
  • all_off (bool) - if True, adds an All Notes Off event to the end of the stream.