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

From Flowcode Help
Jump to navigationJump to search
 
(18 intermediate revisions by 2 users 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
| 1.3 (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''
+
''No detailed description exists yet for this component''
::Channel to send the pitch change to
 
  
:[[Variable Types|UINT]] ''Pitch_Change''
+
==Examples==
::New pitch value to use, Default 0x2000
 
  
  
'''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'''
+
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]] ''Channel''
 
  
:[[Variable Types|BYTE]] ''Note''
+
The MIDI component during simulation has functionality to allow it to work with MIDI synthesizers installed on your PC.
  
:[[Variable Types|BYTE]] ''Velocity''
+
To select your software or hardware synthesizer select from the property selector.
  
 +
[[File:MidiSim.jpg]]
  
'''Return value'''
 
  
:''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.
  
 +
Once installed the MIDI output should play through your computer speakers.
  
===<span style="font-weight: normal;"><u><tt>ReceiveMIDI</tt></u></span>===
 
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.
+
The console window can be used to view the MIDI data as it is sent out and received.
  
'''Parameters'''
+
[[File:MIDI1.jpg]]
  
:[[Variable Types|BYTE]] ''Timeout''
 
  
 +
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.
  
'''Return value'''
 
  
:[[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==
  
 +
===Initialise===
 +
{| 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''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>ReadData</tt></u></span>===
 
''<span style="color:red;">No additional information</span>''
 
  
 +
===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'''
+
===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''
 +
|}
  
:[[Variable Types|BYTE]] ''Idx''
 
  
 +
===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''
 +
|}
  
'''Return value'''
 
  
:[[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>===
+
===SendMIDI===
''<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;" | '''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''
 +
|}
  
  
 +
===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''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Channel''
+
===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''
 +
|}
  
:[[Variable Types|BYTE]] ''Instrument''
 
  
 +
===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''
 +
|}
  
'''Return value'''
 
  
:''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>===
+
===SendPolyPressure===
''<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;" | '''SendPolyPressure'''
'''Parameters'''
+
|-
 
+
| colspan="2" | Sends a note press with an associated polyphonic pressure value.&nbsp;
:[[Variable Types|BYTE]] ''Channel''
+
|-
 
+
|-
:[[Variable Types|BYTE]] ''Pressure''
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
+
| width="90%" | Channel
 
+
|-
'''Return value'''
+
| colspan="2" | &nbsp;
 
+
|-
:''This call does not return a value''
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
+
| width="90%" | Note
 
+
|-
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
+
| colspan="2" | &nbsp;
Initialises the MIDI component and sets up the UART.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
'''Parameters'''
+
| width="90%" | Pressure
 
+
|-
:''This macro has no parameters''
+
| colspan="2" | &nbsp;
 
+
|-
 
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
'''Return value'''
+
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
+
|}
:''This call does not return a value''
 
 
 
 
 
 
 
==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 ''CHANNEL''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
 
+
|-
 
+
|-
<span style="font-weight: normal;"><u>TX</u></span>
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
This property is of type ''Single digital pin'' and can be referenced with the variable name ''TX''.
+
|-
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Channel
 
+
|-
 
+
| 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>RX</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''Single digital pin'' and can be referenced with the variable name ''RX''.
+
| 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>Label</u></span>
+
|-
 
+
| colspan="2" | &nbsp;
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
''<span style="color:red;">No additional information</span>''
+
| width="90%" | Use TX
 
+
|-
 
+
| 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;
 
+
|-
<span style="font-weight: normal;"><u>Data Source</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | TX
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''DataSource''.
+
|-
 
+
| colspan="2" | Pin to be used for Transmit data&nbsp;
Simulation data source used to allow the component to connect to specific MIDI hardware or the the data injector components.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
<span style="font-weight: normal;"><u>Injector</u></span>
+
| width="90%" | Use RX
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Injector''.
+
| 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;
 
+
|-
Lists all the current injector components available on the user's panel
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 +
| width="90%" | RX
 +
|-
 +
| colspan="2" | Pin to be used for Receive data&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 +
| width="90%" | Use Flow Control
 +
|-
 +
| 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;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 +
| width="90%" | RTS
 +
|-
 +
| 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;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 +
| width="90%" | CTS
 +
|-
 +
| 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;
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 +
| width="90%" | Label
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | MIDI Output
 +
|-
 +
| 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;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 +
| width="90%" | MIDI Port
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Scope Traces
 +
|-
 +
| 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;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Console Data
 +
|-
 +
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Console Columns
 +
|-
 +
| 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
 +
|-
 +
| 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;
 +
|}

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.