Difference between revisions of "Component: MIDI (Comms: System)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix Ltd.
 
| Matrix Ltd.
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 2.0 (Release)
+
| 2.0
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Comms: System
 
| Comms: System
 
|}
 
|}
  
  
 
+
==MIDI component==
==[[File:Component Icon a9b43242_9ccc_4f1c_b2d1_acdfbe420fc1.png|Image]] MIDI component==
 
 
Low level routines for controlling or interacting with a standard MIDI interface.
 
Low level routines for controlling or interacting with a standard MIDI interface.
  
==Examples==
+
==Component Source Code==
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.
 
{{Fcfile|Midi.fcfx|MIDI Test File}}
 
[[File:MidiDemoRun.jpg]]
 
  
 +
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_MIDI.fcfx FC_Comp_Source_MIDI.fcfx]
  
The MIDI component during simulation has functionality to allow it to work with MIDI synthesizers installed on your PC.  
+
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_MIDI.fcfx FC_Comp_Source_MIDI.fcfx]
  
To select your software or hardware synthesizer select from the property selector.
+
==Detailed description==
  
[[File:MidiSim.jpg]]
 
  
  
If you don't have a MIDI interface installed then [http://www.nerds.de/en/ipmidi.html 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.
 
  
[[File: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.
 
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>SendMIDI</tt></u></span>===
 
Sends a MIDI packet consisting of up to three bytes of information,
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Status''
 
::MIDI Status Byte - Used for commands such as NoteOn, NoteOff etc.
 
  
:[[Variable Types|BYTE]] ''Data1''
 
::MIDI Data Byte - Used as a parameter specific to the specified command
 
  
:[[Variable Types|BYTE]] ''Data2''
 
::MIDI Data Byte - Used as a parameter specific to the specified command
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>SendPitchChange</tt></u></span>===
 
Sends out a pitch change command on the specified channel.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Channel''
 
::Channel to send the pitch change to
 
  
:[[Variable Types|UINT]] ''Pitch_Change''
+
''No detailed description exists yet for this component''
::New pitch value to use, Default 0x2000
 
  
 +
==Examples==
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>SendNoteOff</tt></u></span>===
 
Sends a note off command using the channel, note and velocity specified.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Channel''
 
  
:[[Variable Types|BYTE]] ''Note''
 
  
:[[Variable Types|BYTE]] ''Velocity''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>SendControl</tt></u></span>===
 
Sends a control command using the channel, controller and value specified.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Channel''
 
  
:[[Variable Types|BYTE]] ''Controller''
 
  
:[[Variable Types|BYTE]] ''Value''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>SendNoteOn</tt></u></span>===
 
Sends a note on command using the channel, note and velocity specified.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Channel''
+
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.
 +
{{Fcfile|Midi.fcfx|MIDI Test File}}
 +
[[File:MidiDemoRun.jpg]]
  
:[[Variable Types|BYTE]] ''Note''
 
  
:[[Variable Types|BYTE]] ''Velocity''
+
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.
  
'''Return value'''
+
[[File:MidiSim.jpg]]
  
:''This call does not return a value''
 
  
 +
If you don't have a MIDI interface installed then [http://www.nerds.de/en/ipmidi.html IP MIDI] seems to be a good option that works well.
  
===<span style="font-weight: normal;"><u><tt>ReceiveMIDI</tt></u></span>===
+
Once installed the MIDI output should play through your computer speakers.
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.
 
  
'''Parameters'''
+
The console window can be used to view the MIDI data as it is sent out and received.
  
:[[Variable Types|BYTE]] ''Timeout''
+
[[File:MIDI1.jpg]]
  
  
'''Return value'''
+
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.
  
:[[Variable Types|BYTE]]
 
  
  
===<span style="font-weight: normal;"><u><tt>SendPolyPressure</tt></u></span>===
 
Sends a note press with an associated polyphonic pressure value.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Channel''
 
  
:[[Variable Types|BYTE]] ''Note''
 
  
:[[Variable Types|BYTE]] ''Pressure''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
 +
==Macro reference==
  
===<span style="font-weight: normal;"><u><tt>ReadData</tt></u></span>===
+
===Initialise===
''<span style="color:red;">No additional information</span>''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Initialises the MIDI component and sets up the UART.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
 +
===ReadData===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadData'''
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Idx
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Idx''
+
===ReceiveMIDI===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveMIDI'''
 +
|-
 +
| colspan="2" | 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. &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Timeout
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
===SendChannelPressure===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendChannelPressure'''
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Pressure
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]]
 
  
 +
===SendControl===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendControl'''
 +
|-
 +
| colspan="2" | Sends a control command using the channel, controller and value specified.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Controller
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Value
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>SendPatch</tt></u></span>===
 
''<span style="color:red;">No additional information</span>''
 
  
 +
===SendMIDI===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendMIDI'''
 +
|-
 +
| colspan="2" | Sends a MIDI packet consisting of up to three bytes of information,&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Status
 +
|-
 +
| colspan="2" | MIDI Status Byte - Used for commands such as NoteOn, NoteOff etc.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Data1
 +
|-
 +
| colspan="2" | MIDI Data Byte - Used as a parameter specific to the specified command&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Data2
 +
|-
 +
| colspan="2" | MIDI Data Byte - Used as a parameter specific to the specified command&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Parameters'''
+
===SendNoteOff===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendNoteOff'''
 +
|-
 +
| colspan="2" | Sends a note off command using the channel, note and velocity specified.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Note
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Velocity
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]] ''Channel''
 
  
:[[Variable Types|BYTE]] ''Instrument''
+
===SendNoteOn===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendNoteOn'''
 +
|-
 +
| colspan="2" | Sends a note on command using the channel, note and velocity specified.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Note
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Velocity
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
===SendPatch===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendPatch'''
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Instrument
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This call does not return a value''
 
  
 +
===SendPitchChange===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendPitchChange'''
 +
|-
 +
| colspan="2" | Sends out a pitch change command on the specified channel.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Channel to send the pitch change to&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Pitch_Change
 +
|-
 +
| colspan="2" | New pitch value to use, Default 0x2000&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>SendChannelPressure</tt></u></span>===
 
''<span style="color:red;">No additional information</span>''
 
  
 
+
===SendPolyPressure===
 
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
'''Parameters'''
+
|-
 
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
:[[Variable Types|BYTE]] ''Channel''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendPolyPressure'''
 
+
|-
:[[Variable Types|BYTE]] ''Pressure''
+
| colspan="2" | Sends a note press with an associated polyphonic pressure value.&nbsp;
 
+
|-
 
+
|-
'''Return value'''
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
+
| width="90%" | Channel
:''This call does not return a value''
+
|-
 
+
| colspan="2" | &nbsp;
 
+
|-
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
Initialises the MIDI component and sets up the UART.
+
| width="90%" | Note
 
+
|-
'''Parameters'''
+
| colspan="2" | &nbsp;
 
+
|-
:''This macro has no parameters''
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
+
| width="90%" | Pressure
 
+
|-
'''Return value'''
+
| colspan="2" | &nbsp;
 
+
|-
:''This call does not return a value''
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
+
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
+
|}
 
 
==Simulation macro reference==
 
 
 
''This component does not contain any simulation macros''
 
  
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Channel</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::CHANNEL''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
UART Channel selector
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
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.
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
<span style="font-weight: normal;"><u>Baud Options</u></span>
+
|-
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::BAUD_LIST''.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Channel
Baud rate option selector
+
|-
 
+
| colspan="2" | 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.&nbsp;
<span style="font-weight: normal;"><u>Baud Rate</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''Signed integer'' and can be referenced with the variable name ''cal_uart::BAUD''.
+
| width="90%" | Baud Options
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| colspan="2" | Baud rate option selector&nbsp;
 
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
+
| width="90%" | Baud Rate
<span style="font-weight: normal;"><u>Use TX</u></span>
+
|-
 
+
| colspan="2" | &nbsp;
This property is of type ''True or false'' and can be referenced with the variable name ''cal_uart::UseTX''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
Selects if the Transmit pin is used by the component.  
+
| width="90%" | Use TX
 
+
|-
Yes: The TX pin is active and used to transmit data for the UART.
+
| colspan="2" | 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.&nbsp;
 
+
|-
No: The TX pin is disabled and free to be used as general I/O.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | TX
<span style="font-weight: normal;"><u>TX</u></span>
+
|-
 
+
| colspan="2" | Pin to be used for Transmit data&nbsp;
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_uart::TX''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
Pin to be used for Transmit data
+
| width="90%" | Use RX
 
+
|-
<span style="font-weight: normal;"><u>Use RX</u></span>
+
| colspan="2" | 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.&nbsp;
 
+
|-
This property is of type ''True or false'' and can be referenced with the variable name ''cal_uart::UseRX''.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | RX
Selects if the Receive pin is used by the component.  
+
|-
 
+
| colspan="2" | Pin to be used for Receive data&nbsp;
Yes: The RX pin is active and used to receive data for the UART.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
No: The RX pin is disabled and free to be used as general I/O.
+
| width="90%" | Use Flow Control
 
+
|-
<span style="font-weight: normal;"><u>RX</u></span>
+
| colspan="2" | 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.&nbsp;
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_uart::RX''.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | RTS
Pin to be used for Receive data
+
|-
 
+
| colspan="2" | 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&nbsp;
<span style="font-weight: normal;"><u>Use Flow Control</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::FLOWEN''.
+
| width="90%" | CTS
 
+
|-
Flow Control (Handshake) enable or disable.
+
| colspan="2" | 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&nbsp;
 
+
|-
     On: Two I/O pins are used to control the flow of data in and out of the device.
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
     Off: Flow control is disabled.
+
|-
 
+
|-
<span style="font-weight: normal;"><u>RTS</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
+
| width="90%" | Label
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_uart::RTS''.
+
|-
 
+
| colspan="2" | &nbsp;
Pin to be used for Request To Send handshake function
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
Output from target micro to inform remote device we are ready to receive data.
+
| width="90%" | MIDI Output
 
+
|-
Low = Ready to receive data
+
| colspan="2" | 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.&nbsp;
 
+
|-
High = Not ready to receive data
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | MIDI Port
<span style="font-weight: normal;"><u>CTS</u></span>
+
|-
 
+
| colspan="2" | &nbsp;
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_uart::CTS''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
Pin to be used for Clear To Send handshake function.
+
| width="90%" | Scope Traces
 
+
|-
Input to target micro to inform when the remote device is ready to transmit data.
+
| colspan="2" | 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.&nbsp;
 
+
|-
Low = Ready to transmit data
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Console Data
High = Not ready to transmit data
+
|-
 
+
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
<span style="font-weight: normal;"><u>Label</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
+
| width="90%" | Console Columns
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| colspan="2" | Number of characters that can be displayed on a single line of the console.&nbsp;
 
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Data Source
<span style="font-weight: normal;"><u>MIDI Output</u></span>
+
|-
 
+
| colspan="2" | 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.&nbsp;
This property is of type ''True or false'' and can be referenced with the variable name ''MIDIOutput''.
+
|}
 
 
Decides if we are using special MIDI output or standard Serial/Injector Output.
 
 
 
Yes: We send the simulation data via a MIDI interface.
 
 
 
No: We send the simulation data via the standard COM/Injector interface.
 
 
 
<span style="font-weight: normal;"><u>Scope Traces</u></span>
 
 
 
This property is of type ''True or false'' and can be referenced with the variable name ''cal_uart::ScopeTraces''.
 
 
 
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.
 
 
 
<span style="font-weight: normal;"><u>Console Data</u></span>
 
 
 
This property is of type ''True or false'' and can be referenced with the variable name ''cal_uart::ConsoleData''.
 
 
 
Selects if the console data is automatically generated or not
 
 
 
<span style="font-weight: normal;"><u>Console Columns</u></span>
 
 
 
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''cal_uart::ConsoleColumns''.
 
 
 
Number of characters that can be displayed on a single line of the console.
 
 
 
<span style="font-weight: normal;"><u>Data Source</u></span>
 
 
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::DataSource''.
 
 
 
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.
 

Latest revision as of 13:11, 7 February 2023

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.