expyriment.io.extras.MidiOut¶
-
class
expyriment.io.extras.
MidiOut
(device, latency=None, buffer_size=None)¶ A class implementing a MIDI output.
EXPERIMENTAL!
Due to a bug in Pygame’s midi module, closing a MidiOut (or the programme) will cause an error message. Until this is fixed in Pygame, MidiOut will stay in extras.
-
__init__
(device, latency=None, buffer_size=None)¶ Create a MIDI output.
Parameters: device : int or str
id or name of the MIDI device
latency : int, optional
delay in ms applied to timestamp
buffer_size : int, optional
number of events to be buffered
-
abort
()¶ Terminates outgoing messages immediately.
-
buffer_size
¶ Getter for buffer_size.
-
close
(abort=False)¶ Close the MIDI interface.
Parameters: abort : bool, optional
abort messages in the buffer (default=True)
-
static
get_devices
()¶ Get a list of all MIDI output devices connected to the system.
-
id
¶ Getter for id.
-
latency
¶ Getter for latency.
-
logging
¶ Getter for logging.
-
select_instrument
(instrument_id, channel=0)¶ Select an instrument.
Parameters: instrument_id : int
id (0-127) of the instrument
channel : int, optional
MIDI channel for the instrument (default=0)
-
send
(event_list)¶ Send a list of MIDI events.
- Each event should have the following format:
- [status, data1, data2, data3], timestamp]
Parameters: event_list : list
list of events to send
Notes
The data fields are optional.
-
send_note_off
(note, velocity=None, channel=0)¶ Send a note-off event.
Parameters: note : int
note value
velocity : int, optional
velocity of the note
channel : int, optional
MIDI channel of the note (default=0)
-
send_note_on
(note, velocity=None, channel=0)¶ Send a note-on event.
Parameters: note : int
note value
velocity : int, optional
velocity of the note
channel : int, optional
MIDI channel of the note (default=0)
-
send_short
(status, data1=0, data2=0)¶ Send MIDI events of 3 bytes or less.
Parameters: status : int
status of the event to send
data1 : int, optional
data1 of the event to send
data2 : int, optional
data2 of the event to send
-
send_sysex
(timestamp, message)¶ Send a System Exlusive message.
Parameters: timestamp : int
when (in ms) to send the message
message : sit or list
message to send
-
set_logging
(onoff)¶ Set logging of this object on or off
Parameters: onoff : bool
set logging on (True) or off (False)
Notes
See also design.experiment.set_log_level fur further information about event logging.
-