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.

Methods

__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.

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]

wait(events, duration=None)

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 timein ms

Previous topic

expyriment.io.extras.CedrusResponseDevice

Next topic

expyriment.io.extras.MidiOut

This Page