Contents . 2. Midithing Objects |
Previous 2.3. Song |
Next 2.5. Event |
return a new Part. Up to 254 Parts or Events can be given; they will be copied into the new Part that is returned.
The Part object is a sliceable sequence of Event objects. To add events, use add (event); remove events with remove (event) or del part[index].
The event sequence is kept sorted by MIDI tick. This object corresponds to a track, or sequence, in a standard MIDI file.
When you create a slice of a Part object, the events in the slice are still the same as in the original part, and the slice is a Part object itself.
adds an Event to the Part. The tick argument may be omitted in which case the Events tick will be used. The Part will insert a copy of the Event and return a reference to the new Event.
clear()removes all Events from a Part.
index (event)returns the index at which an Event resides in a Part. An error is raised if the Event is not in the Part.
iterate (func[, ...])calls 'func' with every Event in the Part. Any values passed in after 'func' are in turn passed to 'func' by the iterator after the Event, which is always the first argument to 'func'.
You can use this to do something basically like part.iterate (lambda e: part.remove (e)); ie you can remove events in the iterator without skipping some of them as it would with for e in part: part.remove (e).
remove (event)removes an Event from the Part. An error is raised if the Event is not in the Part.
sort()sorts the Part. Use this if you modified Event ticks.
Type: int
Default: -1
The channel that all Events in the Part should have instead of their own. A negative value means do not use. This value is actually stored in a ChannelPrefix meta event inside the Part.
division
Type: int
Default: 192
This is the number of midi ticks per quarter note, and by that is used to map ticks onto a beat. Modifying this attribute does not modify the tick stamps of events inside the part.
first_non_meta
Type: int
Default: 0
Type: string
Default: None
This is the name of the part; it corresponds to a SequenceName meta event.
port
Type: int
Default: -1
The port that all events in the Part should use. A negative value means do not impose anything. This value is actually stored in a PortPrefix meta event inside the Part.
midithing 0.3.22 documentation | © Tim Goetze | Nov. 06 2001 |