Component: MIDI (Comms: System)

From Flowcode Help
Jump to navigationJump to search
Author Matrix Ltd.
Version 2.0
Category Comms: System


MIDI component

Low level routines for controlling or interacting with a standard MIDI interface.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_MIDI.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_MIDI.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Basic example to play a series of notes getting higher in pitch and then going down in pitch. This repeats in a loop and each time the loop repeats the instrument is changed. The current note and instrument are displayed on the LCD. FC6 Icon.png MIDI Test File MidiDemoRun.jpg


The MIDI component during simulation has functionality to allow it to work with MIDI synthesizers installed on your PC.

To select your software or hardware synthesizer select from the property selector.

MidiSim.jpg


If you don't have a MIDI interface installed then IP MIDI seems to be a good option that works well.

Once installed the MIDI output should play through your computer speakers.


The console window can be used to view the MIDI data as it is sent out and received.

MIDI1.jpg


The MIDI component during embedded operation will communicate using a UART serial channel. An EB021 MIDI E-block is available to allow standard MIDI cables to be connected up to a system.






Macro reference

Initialise

Fc9-comp-macro.png Initialise
Initialises the MIDI component and sets up the UART. 
Fc9-void-icon.png - VOID Return


ReadData

Fc9-comp-macro.png ReadData
 
Fc9-u8-icon.png - BYTE Idx
 
Fc9-u8-icon.png - BYTE Return


ReceiveMIDI

Fc9-comp-macro.png ReceiveMIDI
Waits for the time specified in the timeout parameter for an incoming MIDI message. Returns 0 to indicate a timeout, otherwise returns the first value from the MIDI message.  
Fc9-u8-icon.png - BYTE Timeout
 
Fc9-u8-icon.png - BYTE Return


SendChannelPressure

Fc9-comp-macro.png SendChannelPressure
 
Fc9-u8-icon.png - BYTE Channel
 
Fc9-u8-icon.png - BYTE Pressure
 
Fc9-void-icon.png - VOID Return


SendControl

Fc9-comp-macro.png SendControl
Sends a control command using the channel, controller and value specified. 
Fc9-u8-icon.png - BYTE Channel
 
Fc9-u8-icon.png - BYTE Controller
 
Fc9-u8-icon.png - BYTE Value
 
Fc9-void-icon.png - VOID Return


SendMIDI

Fc9-comp-macro.png SendMIDI
Sends a MIDI packet consisting of up to three bytes of information, 
Fc9-u8-icon.png - BYTE Status
MIDI Status Byte - Used for commands such as NoteOn, NoteOff etc. 
Fc9-u8-icon.png - BYTE Data1
MIDI Data Byte - Used as a parameter specific to the specified command 
Fc9-u8-icon.png - BYTE Data2
MIDI Data Byte - Used as a parameter specific to the specified command 
Fc9-void-icon.png - VOID Return


SendNoteOff

Fc9-comp-macro.png SendNoteOff
Sends a note off command using the channel, note and velocity specified. 
Fc9-u8-icon.png - BYTE Channel
 
Fc9-u8-icon.png - BYTE Note
 
Fc9-u8-icon.png - BYTE Velocity
 
Fc9-void-icon.png - VOID Return


SendNoteOn

Fc9-comp-macro.png SendNoteOn
Sends a note on command using the channel, note and velocity specified. 
Fc9-u8-icon.png - BYTE Channel
 
Fc9-u8-icon.png - BYTE Note
 
Fc9-u8-icon.png - BYTE Velocity
 
Fc9-void-icon.png - VOID Return


SendPatch

Fc9-comp-macro.png SendPatch
 
Fc9-u8-icon.png - BYTE Channel
 
Fc9-u8-icon.png - BYTE Instrument
 
Fc9-void-icon.png - VOID Return


SendPitchChange

Fc9-comp-macro.png SendPitchChange
Sends out a pitch change command on the specified channel. 
Fc9-u8-icon.png - BYTE Channel
Channel to send the pitch change to 
Fc9-u16-icon.png - UINT Pitch_Change
New pitch value to use, Default 0x2000 
Fc9-void-icon.png - VOID Return


SendPolyPressure

Fc9-comp-macro.png SendPolyPressure
Sends a note press with an associated polyphonic pressure value. 
Fc9-u8-icon.png - BYTE Channel
 
Fc9-u8-icon.png - BYTE Note
 
Fc9-u8-icon.png - BYTE Pressure
 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png Channel
UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller. 
Fc9-type-16-icon.png Baud Options
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
 
Fc9-type-7-icon.png Use TX
Selects if the Transmit pin is used by the component. Yes: The TX pin is active and used to transmit data for the UART. No: The TX pin is disabled and free to be used as general I/O. 
Fc9-type-5-icon.png TX
Pin to be used for Transmit data 
Fc9-type-7-icon.png Use RX
Selects if the Receive pin is used by the component. Yes: The RX pin is active and used to receive data for the UART. No: The RX pin is disabled and free to be used as general I/O. 
Fc9-type-5-icon.png RX
Pin to be used for Receive data 
Fc9-type-16-icon.png Use Flow Control
Flow Control (Handshake) enable or disable. On: Two I/O pins are used to control the flow of data in and out of the device. Off: Flow control is disabled. 
Fc9-type-5-icon.png RTS
Pin to be used for Request To Send handshake function Output from target micro to inform remote device we are ready to receive data. Low = Ready to receive data High = Not ready to receive data 
Fc9-type-5-icon.png CTS
Pin to be used for Clear To Send handshake function. Input to target micro to inform when the remote device is ready to transmit data. Low = Ready to transmit data High = Not ready to transmit data 
Fc9-conn-icon.png Simulation
Fc9-type-10-icon.png Label
 
Fc9-type-7-icon.png MIDI Output
Decides if we are using special MIDI output or standard Serial/API Output. Yes: We send the simulation data via a MIDI interface. No: We send the simulation data via the standard COM/API interface. 
Fc9-type-16-icon.png MIDI Port
 
Fc9-type-7-icon.png Scope Traces
Selects if the scope traces are automatically added to the data recorder window or not. Simulation - draws an approximation of the UART data onto the scope trace. ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD. 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-21-icon.png Console Columns
Number of characters that can be displayed on a single line of the console. 
Fc9-type-16-icon.png Data Source
Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port Injector - Routes the communication data via a data injector component on the Panel.