Page History: MIDI Input Element
Compare Page Revisions
Page Revision: 2012/10/07 22:58
|
MIDI Input
|
Info |
Category: |
Behavior Control |
|
AddIn: |
Base Elements |
Creator: |
OkazoLab Team |
|
Scope: |
Parent Event |
Owns Snippets: |
Trigger |
|
Usage: |
Snippets |
The element is capable of reading the input of various
MIDI devices connected to a PC. MIDI is a commonly-accepted protocol for communication with digital musical instruments, like a MIDI piano keyboard. The MIDI Input element can record a instrumental music played in real-time as a sequence of
notes.
Description
On onset of the parent event the MIDI input element starts to read a real-time input of the selected MIDI Device and record all received notes. The recorded information for each note includes the MIDI channel number, note name, playback start time, duration, octave number, note's sound frequency and button press velocity (or volume). The element can also detect presses of the control buttons, e.g. program change. The recorded notes and events can be easily accessed in
snippets and logged.
The element is designed for experiments, where participant's input is produced by playing a music on MIDI compatible instruments.
Snapshots
Traditional note signs and corresponding element's names and sound frequencies |
Practical Use
Technique 1: Logging all MIDI input over a period of time
- Add new MIDI input element into the event where you plan to record a melody played by a participant
- Select the input MIDI device via MIDI Device property. The device has to be connected to PC and turn on
- Chose whether you want to record all low-level MIDI events or just MIDI notes
- Set a proxy variable on the MIDI Notes property. After the parent event is completed, the proxy variable will returns all played notes as an array of clMIDINote structs
- Read the MIDI notes array and record it into Report or into a custom file.
- The MIDI notes property is automatically reset on the next onset on the parent event
Technique 2: Detecting the first played note or pressed piano button
- Step 1
- Step 2
// Check the trial outcome. Result and RT just other user variables
// insert code snippet here..
Element actions aligned with different epochs of the parent event
The elements cleans the MIDINotes and MIDIEvents arrays on each onset of the parent event
Epoche | Actions |
---|
Initialized |
Rendered |
Activating |
Activated |
Running |
Deactivated |
Deinitialized |
Notes
Insert Notes here..
Properties
Generic Properties
Name | Description | Attributes | Value Type | Proxy Reflex |
---|
Settings |
MIDI Device | Defines a MIDI device that sends an input to this element. | | System.Enum |
Buffer Size | Defines the size of the circular internal buffer that holds an MIDI input (notes and events) at runtime. When all MIDI input has to be recorded the value should be greater than the expected overall length of input in notes or events. | | System.Int32 |
Buffer Size | Defines the size of the circular internal buffer that holds an MIDI input (notes and events) at runtime. When all MIDI input has to be recorded the value should be greater than the expected overall length of input in notes or events. | | System.Int32 |
Triggering Mode | Defines whether the element is triggered by every new low-level MIDI event or only by a new note | | System.Enum |
Test MIDI input | Brings a dialog window that monitors the input of the selected MIDI device for testing purpose | | System.Int32 |
Runtime Input |
MIDI Notes | Returns a runtime array of all MIDI notes received since the onset of the parent event. The last array element corresponds to the newest note. The current length of the array can be obtained by the .Length field. The array resets on each onset of the parent event | FORMATTER ERROR (Snippet Not Found) | clMIDINote[] |
Last Note | Returns the newest note received from the MIDI device. | FORMATTER ERROR (Snippet Not Found) | clMIDINote |
MIDI Events | Returns a runtime array of all low-level MIDI events received since the onset of the parent event. The last array element corresponds to the newest event. The current length of the array can be obtained by the .Length field. The array resets on each onset of the parent event | FORMATTER ERROR (Snippet Not Found) | clMIDIEvent[] |
Last Event | Returns the newest event received from the MIDI device. | FORMATTER ERROR (Snippet Not Found) | clMIDIEvent[ |
Runtime Status |
Triggering Time | Indicates the latest event time when the element was triggered (in ms elapsed since activation of the parent event) | FORMATTER ERROR (Snippet Not Found) | clTime |
Is Triggered | Indicates that the element has been triggered at least once since the onset of the parent event | FORMATTER ERROR (Snippet Not Found) | System.Boolean |
+=== Properties inherited from clElement ===
Inherited properties of clElement
Name | Description | Constraints | Value Type | Upon Change |
---|
Control |
Is Enabled | If set to false the element is completely omitted when the experiment is run. | | Boolean |
|
Title | Title of the element. | | String |
|