The <midi> element ======================== MIDI mappings can be added to your instrument by adding a `` element right below your top-level `` element. ## The <cc> element Within the `` element, you can have any number of `` elements. These allow you to map changes in incoming continuous controller messages to specific parameters of your instrument. To use this functionality, you'll want to add a separate `` element for each CC number you would like to respond to. The `` element has a single required attribute `number=""` which specifies the number (from 0 to 127) of the continuous controller you would like to listen on. Beneath the `` element, you can have any number of bindings. ```xml ``` ## The <note> element Within the `` element, you can have any number of `` elements. These allow you to map specific notes to specific parameters of your instrument. To use this functionality, you'll want to add a separate `` element for each MIDI note or range of notes you would like to respond to. Here are the attributes of the `` element: - **note** (required): This attribute specifies the MIDI note number (from 0 to 127) you would like to listen on. You can also specify ranges of notes by using a dash. For example `note="24-35"` would be used to specify bindings for the range of notes 24 thorugh 35. - **eventType** (optional): This attribute specifies the type of event to listen for. The default is `note_on`, but you can also specify `note_off` or `any`. The default is `any` if this attribute is not specified. - **enabled** (optional): A true/false value that specifies whether this note listener is turned on. - **swallowNotes** (optional): The bindings that live below this note listener are called before any notes are played. By default, swallowNotes is false, which means that the keypress will then be received by the sampler. If `swallowNotes` is true, the sampler will not receive the note. This is useful if you wish to prevent certain keys from triggers notes. It is possible to enable and disable a note listener by targeting the `enabled` attribute. Beneath the `` element, you can have any number of bindings. Here is an example of how keyswitches might be set up: ```xml ``` In the above keyswitch example, MIDI note 11 turns on group 0 and turns off group 1, whereas MIDI note 12 does the opposite. Note the use of the `fixed_value` translation type. ## The <velocity> element Within the `` element, you can also have a `` element. This element allows you to control an instrument in response to MIDI velocity messages. This is useful for creating dynamic responses based on how hard a note is played. Example usage: ```xml ``` In this example, the `` element contains a single `` that modifies the `FX_FILTER_FREQUENCY` parameter of the first effect (effectIndex: 0) in the first group (groupIndex: 0) based on the velocity of incoming MIDI notes. The `modAmount` attribute specifies how much the velocity will affect the parameter. ### Bindings within the `` section The bindings that the ``, ``, and `` element listens on are the same as those used by the UI controls. See [Appendix B](#appendix-b-the-binding-element) for a complete description of these. If you have a UI control mapped to the same internal parameter as a MIDI mapping, you'll want to have your MIDI mapping control the UI control instead of the parameter directly. The benefit of doing this is that, as the MIDI CC input is received, the UI control will be updated as well as the desired internal parameter. The way to accomplish this is to make use of the `labeled_knob` or `control` binding types (`control` was introduced in version 1.1.7) as follows: ```xml ``` You'll notice that the `control` type has a `level` value of `ui` and a `parameter` value of `VALUE`. Another thing to notice is the `position=""` parameter. This contains the 0-based index of the control to be modified. **NOTE: The indexes of the parameter list includes all UI controls, including `