Contents . 2. Midithing Objects |
Previous 2.2. Port |
Next 2.4. Part |
returns a new Song. The filename is optional; if you specify it, Song() tries to read that file.
The song object is a sequence of parts. To add parts to it, use its add() method; remove them with del song[n].
Only the first part of a Song is searched for time and tempo information. For best performance, this first part should not be used to keep any other kind of Event, eg notes, controller changes etc.
See also IO.Sync
adds a Part to the Song. An error is raised if part is not a Part object.
clear()remoces all parts from a Song. No error is raised the song is already empty.
index (part)returns the index of a Part in the Song.
play()starts playing or continues after stopping.
NB for this to work, the Song has to be added to an IO.Sync object. Otherwise it will never be asked to send its Events.
read (['foo.mid'])reads a standard midi file. The filename is optional and if you do not specify it, the last used is tried.
remove (part)removes a Part to the Song. An error is raised if the Part is not in the Song.
seek (tick or time)winds the 'MIDI tape' to this tick if you pass in an int, or to this time if you pass a float value. You can seek while playing.
stop()stops playing.
write (['copy-of-foo.mid'])writes a standard midi file. The filename is optional and if you do not specify it, the last used is tried.
Type: tuple
Default: (0, 0, 0)
This reflects the current 'playhead' position, in bar, beat, tick notation. It may be worth noting that the count starts at (0, 0, 0).
click
Type: Event
Default: Note ('C#3' or 37, velocity=80, channel=9, tick=0, length=48, velocity_off=80, port=0)
Type: int
Default: 4
The denominator of the current time signature of the Song, eg 4 in 3/4 time.
division
Type: int
Default: 192
This is the number of midi ticks per quarter note, and determines the resolution in time and how ticks are mapped onto a beat. Modifying this does not modify the Parts the Song holds.
loop
Type: tuple
Default: (0, 0)
This is the loop start and end points, in that order, in MIDI ticks. This property is read/write.
name
Type: string
Default: ''
The name of the file used for the last read() or write() operation.
numerator
Type: int
Default: 4
The numerator of the current time signature of the Song, eg 3 in 3/4 time.
playing
Type: int
Default: 0
reflects whether the Song is currently playing.
tick
Type: int
Default: 0
the current MIDI tick the Song's 'playhead' is at.
ticks_per_beat
Type: int
Default: 192
this attribute can change if the Song's time/tempo Part holds time signature Events.
time
Type: float
Default: 0.0
the current time in seconds the Song's 'playhead' is at.
midithing 0.3.22 documentation | © Tim Goetze | Nov. 06 2001 |