expyriment.io.extras.MidiIn¶
-
class
expyriment.io.extras.
MidiIn
(device, buffer_size=None)¶ A class implementing a MIDI input.
EXPERIMENTAL!
Due to a bug in Pygame’s midi module, closing a MidiIn (or the programme) will cause an error message. Until this is fixed in Pygame, MidiIn will stay in extras.
-
__init__
(device, buffer_size=None)¶ Create a MIDI input.
Parameters: device : int or str
id or name of the MIDI device
buffer_size : int, optional
number of events to be buffered
-
buffer_size
¶ Getter for buffer_size.
-
clear
()¶ Clear the input buffer.
This can take more than 1 ms!
-
static
get_devices
()¶ Get a list of all MIDI input devices connected to the system.
-
id
¶ Getter for id.
-
logging
¶ Getter for logging.
-
read
(num_events=1)¶ Read MIDI events from device.
Parameters: num_events : int, optional
number of events to read (default=1)
Returns: out : timestpamed
A timestpamed midi event will look like this: [status, data1, data2, data3], timestamp]
-
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.
-
wait
(events, duration=None, callback_function=None, process_control_events=True)¶ Wait for (a) certain event(s).
Events to wait for are in the form of a list with 4 elements and do not include a timestamp: [status, data1, data2, data3]
Parameters: events : int or list
event(s) to wait for
duration : int, optional
maximal time to wait in ms
callback_function : function, optional
function to repeatedly execute during waiting loop
process_control_events : bool, optional
process
io.Keyboard.process_control_keys()
andio.Mouse.process_quit_event()
(default = True)Returns: evt : int
found event
rt : int
reaction time in ms
See also
design.experiment.register_wait_callback_function
Notes
This will also by default process control events (quit and pause). Thus, keyboard events will be cleared from the cue and cannot be received by a Keyboard().check() anymore!
-