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

Hello!
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!
Friedrich

Comments

  • Hi Friedrich,

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

    Best,
    Florian

  • 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?

    Best,
    Friedrich

  • 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?
    Best,
    Friedrich

  • Here is a description of the plugin system in Expyriment: http://docs.expyriment.org/Plugins.html.

    You can use the MIDI input like this:

    import expyriment.io.extras
    
    midi_in = expyriment.io.extras.MidiIn(device, buffer_size=1024)
    

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

    expyriment.io.extras.MidiIn.get_devices()
    

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

    help(midi_in)
    

    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?

    Best,
    Friedrich

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

    Cheers!
    Sebastiaan

  • 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.
    Cheers!
    Friedrich

Sign In or Register to comment.