pygame.midi.Output 
 Output is used to send midi to an output device Output(device_id) -> None Output(device_id, latency=0) -> None Output(device_id, buffer_size=256) -> None Output(device_id, latency, buffer_size) -> None  The buffer_size specifies the number of output events to be buffered waiting for output. In some cases (see below) PortMidi does not buffer output at all and merely passes data to a lower-level API, in which case buffersize is ignored. latency is the delay in milliseconds applied to timestamps to determine when the output should actually occur. If latency is <<0, 0 is assumed. If latency is zero, timestamps are ignored and all output is delivered immediately. If latency is greater than zero, output is delayed until the message timestamp plus the latency. In some cases, PortMidi can obtain better timing than your application by passing timestamps along to the device driver or hardware. Latency may also help you to synchronize midi data to audio data by matching midi latency to the audio buffer latency.  Note Time is measured relative to the time source indicated by time_proc. Timestamps are absolute, not relative delays or offsets.    abort() 
 terminates outgoing messages immediately abort() -> None  The caller should immediately close the output port; this call may result in transmission of a partial midi message. There is no abort for Midi input because the user can simply ignore messages in the buffer and close an input device at any time. 
   close() 
 closes a midi stream, flushing any pending buffers. close() -> None  PortMidi attempts to close open streams when the application exits.  Note This is particularly difficult under Windows.  
   note_off() 
 turns a midi note off (note must be on) note_off(note, velocity=None, channel=0) -> None  Turn a note off in the output stream. The note must already be on for this to work correctly. 
   note_on() 
 turns a midi note on (note must be off) note_on(note, velocity=None, channel=0) -> None  Turn a note on in the output stream. The note must already be off for this to work correctly. 
   set_instrument() 
 select an instrument, with a value between 0 and 127 set_instrument(instrument_id, channel=0) -> None  Select an instrument. 
   pitch_bend() 
 modify the pitch of a channel. set_instrument(value=0, channel=0) -> None  Adjust the pitch of a channel. The value is a signed integer from -8192 to +8191. For example, 0 means "no change", +4096 is typically a semitone higher, and -8192 is 1 whole tone lower (though the musical range corresponding to the pitch bend range can also be changed in some synthesizers). If no value is given, the pitch bend is returned to "no change".  New in pygame 1.9.4.  
   write() 
 writes a list of midi data to the Output write(data) -> None  Writes series of MIDI information in the form of a list.     
Parameters:

data (list) -- data to write, the expected format is [[[status, data1=0, data2=0, ...], timestamp], ...] with the data# fields being optional  
Raises:

IndexError -- if more than 1024 elements in the data list    Example: # Program change at time 20000 and 500ms later send note 65 with
# velocity 100.
write([[[0xc0, 0, 0], 20000], [[0x90, 60, 100], 20500]])  Note  Timestamps will be ignored if latency = 0 To get a note to play immediately, send MIDI info with timestamp read from function Time Optional data fields: write([[[0xc0, 0, 0], 20000]]) is equivalent to write([[[0xc0], 20000]])
   
   write_short() 
 writes up to 3 bytes of midi data to the Output write_short(status) -> None write_short(status, data1=0, data2=0) -> None  Output MIDI information of 3 bytes or less. The data fields are optional and assumed to be 0 if omitted. Examples of status byte values: 0xc0  # program change
0x90  # note on
# etc. Example: # note 65 on with velocity 100
write_short(0x90, 65, 100) 
   write_sys_ex() 
 writes a timestamped system-exclusive midi message. write_sys_ex(when, msg) -> None  Writes a timestamped system-exclusive midi message.     
Parameters:

 
msg (list[int] or str) -- midi message 
when -- timestamp in milliseconds      Example: midi_output.write_sys_ex(0, '\xF0\x7D\x10\x11\x12\x13\xF7')

# is equivalent to

midi_output.write_sys_ex(pygame.midi.time(),
                         [0xF0, 0x7D, 0x10, 0x11, 0x12, 0x13, 0xF7])