MidiOutstream is Basically an eventhandler. It is the most central
class in the Midi library. You use it both for writing events to an
output stream, and as an event handler for an input stream.
This makes it extremely easy to take input from one stream and send it
to another. Ie. if you want to read a Midi file, do some processing, and
send it to a midiport.
All time values are in absolute values from the opening of a stream.
To calculate time values, please use the MidiTime and MidiDeltaTime
classes.
Method Summary |
|
__init__(self)
|
|
abs_time (self)
Returns the absolute time |
|
active_sensing (self)
No values passed |
|
aftertouch (self,
channel,
note,
velocity)
channel: 0-15 note, velocity: 0-127 |
|
channel_message (self,
message_type,
channel,
data)
The default event handler for channel messages |
|
channel_pressure (self,
channel,
pressure)
channel: 0-15 pressure: 0-127 |
|
continuous_controller (self,
channel,
controller,
value)
channel: 0-15 controller, value: 0-127 |
|
copyright (self,
text)
Copyright notice text: string |
|
cuepoint (self,
text)
text: string |
|
end_of_track (self)
n_track: number of track |
|
eof (self)
End of file. |
|
get_current_track (self)
Returns the current track number |
|
get_run_stat (self)
Set the new running status |
|
header (self,
format,
nTracks,
division)
format: type of midi file in [1,2] nTracks: number of tracks division:
timing division |
|
instrument_name (self,
text)
text: string |
|
key_signature (self,
sf,
mi)
sf: is a byte specifying the number of flats (-ve) or sharps
(+ve) that identifies the key signature (-7 = 7 flats, -1
= 1 flat, 0 = key of C, 1 = 1 sharp, etc). |
|
lyric (self,
text)
text: string |
|
marker (self,
text)
text: string |
|
meta_event (self,
meta_type,
data)
Handles any undefined meta events |
|
midi_ch_prefix (self,
channel)
channel: midi channel for subsequent data (deprecated in the spec) |
|
midi_port (self,
value)
value: Midi port (deprecated in the spec) |
|
midi_time_code (self,
msg_type,
values)
msg_type: 0-7 values: 0-15 |
|
note_off (self,
channel,
note,
velocity)
channel: 0-15 note, velocity: 0-127 |
|
note_on (self,
channel,
note,
velocity)
channel: 0-15 note, velocity: 0-127 |
|
patch_change (self,
channel,
patch)
channel: 0-15 patch: 0-127 |
|
pitch_bend (self,
channel,
value)
channel: 0-15 value: 0-16383 |
|
rel_time (self)
Returns the relative time |
|
reset_run_stat (self)
Invalidates the running status |
|
reset_time (self)
reset time to 0 |
|
sequence_name (self,
text)
Sequence/track name text: string |
|
sequence_number (self,
value)
value: 0-16383 |
|
sequencer_specific (self,
data)
data: The data as byte values |
|
set_current_track (self,
new_track)
Sets the current track number |
|
set_run_stat (self,
new_status)
Set the new running status |
|
smtp_offset (self,
hour,
minute,
second,
frame,
framePart)
hour,
minute,
second: 3 bytes specifying the hour (0-23), minutes (0-59) and
seconds (0-59), respectively. |
|
song_continue (self)
No values passed |
|
song_position_pointer (self,
value)
value: 0-16383 |
|
song_select (self,
songNumber)
songNumber: 0-127 |
|
song_start (self)
No values passed |
|
song_stop (self)
No values passed |
|
start_of_track (self,
n_track)
n_track: number of track |
|
system_exclusive (self,
data)
data: list of values in range(128) |
|
system_reset (self)
No values passed |
|
tempo (self,
value)
value: 0-2097151 tempo in us/quarternote (to calculate value from bpm:
int(60,000,000.00 / BPM)) |
|
text (self,
text)
Text event text: string |
|
time_signature (self,
nn,
dd,
cc,
bb)
nn: Numerator of the signature as notated on sheet music
dd: Denominator of the signature as notated on sheet music
The denominator is a negative power of 2: 2 = quarter
note, 3 = eighth, etc. |
|
timing_clock (self)
No values passed |
|
tuning_request (self)
No values passed |
|
update_time (self,
new_time,
relative)
Updates the time, if relative is true, new_time is relative, else it's
absolute. |