Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Experiment with Midi Keyboard

I'm looking after a software for doing experiments in music cognition. For my current experiment, I need a solution for gathering input by using a midi keyboard. Is it possible for "expyriment" to record musicians' performance behavior on a midi keyboard? If so, how? I would appreciate any bits of advice! Thanks in advance!


  • Hi Friedrich,

    there is no particular code for recording musical performances, but there is MIDI input and output available as a plugin (see I am not sure what the latencies will be like, though.


  • Hi Florian!

    Thanks for the quick replay. I'm new to Python as well as too expyriment. How can I access/install those plugins you mentioned? Could you give some hints about the code to use for getting midi information of my keyboard?


  • As my question has been closed in the OpenSesame forum (which was my mistake, excuse me), is there a way to implement a Midi-Input in Sesame? And how would this routine looks like?

  • Here is a description of the plugin system in Expyriment:

    You can use the MIDI input like this:

    midi_in =, buffer_size=1024)

    To get a list of MIDI devices on your system, do:

    To see what you can do with the midi_in object, do:


    There are basically two things to look at, read and wait, which do exactly what they sound like. One is reading (polling) from the buffer, returning [status, data1, data2, data3, timestamp], while the other one is waiting (blocking) until a midi command is received and then returns [status, data1, data2, data3].

    I hope this helps.

  • Thank you very much. Is it possible to integrate this approach in opensesame? Or is it only possible to implement this Routine in expyriement? If it is possible to include this, how would this be done in opensesame?


  • Don't know. Best to ask in the OpenSesame forum. Or maybe @sebastiaan can chime in?

  • Hi guys,

    Yes, if you use the xpyriment backend in OpenSesame, then you can use all the expyriment routines in an inline_script item.


  • Hi!
    I have tried several times to code such an item, with no luck. Hopefully, you can integrate such device-interfaces in a future version – or easier-to-read examples.

Sign In or Register to comment.