expyriment.io.extras.MidiIn¶
-
class
expyriment.io.extras.
MidiIn
(device, buffer_size=None)[source]¶ 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.
Methods
-
__init__
(device, buffer_size=None)[source]¶ 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.
-
id
¶ Getter for id.
-
logging
¶ Getter for logging.
-
read
(num_events=1)[source]¶ 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)[source]¶ 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
Returns: evt : int
found event
rt : int
reaction time in ms
See also
design.experiment.register_wait_callback_function
-