qmk_firmware/assets/features_midi.md.u3tHPteB.js

16 lines
28 KiB
JavaScript
Raw Normal View History

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js";
const __pageData = JSON.parse('{"title":"MIDI","description":"","frontmatter":{},"headers":[],"relativePath":"features/midi.md","filePath":"features/midi.md"}');
const _sfc_main = { name: "features/midi.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="midi" tabindex="-1">MIDI <a class="header-anchor" href="#midi" aria-label="Permalink to &quot;MIDI&quot;"></a></h1><h2 id="usage" tabindex="-1">Usage <a class="header-anchor" href="#usage" aria-label="Permalink to &quot;Usage&quot;"></a></h2><p>First, enable MIDI by adding the following to your <code>rules.mk</code>:</p><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">MIDI_ENABLE = yes</span></span></code></pre></div><p>There are two MIDI systems in QMK: basic and advanced. With basic MIDI you will only be able to send Note On and Note Off messages using the note keycodes, meaning that keycodes like <code>MI_OCTU</code> and <code>MI_OCTD</code> will not work. Advanced MIDI allows you to do things like octave shifts, channel changes, velocity changes, modulation, and more.</p><h3 id="caveats" tabindex="-1">Caveats <a class="header-anchor" href="#caveats" aria-label="Permalink to &quot;Caveats&quot;"></a></h3><p>MIDI requires 2 USB endpoints and as such may not work on some hardware such as V-USB controllers.</p><h3 id="basic-midi" tabindex="-1">Basic MIDI <a class="header-anchor" href="#basic-midi" aria-label="Permalink to &quot;Basic MIDI&quot;"></a></h3><p>To enable basic MIDI, add the following to your <code>config.h</code>:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> MIDI_BASIC</span></span></code></pre></div><h3 id="advanced-midi" tabindex="-1">Advanced MIDI <a class="header-anchor" href="#advanced-midi" aria-label="Permalink to &quot;Advanced MIDI&quot;"></a></h3><p>To enable advanced MIDI, add the following to your <code>config.h</code>:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> MIDI_ADVANCED</span></span></code></pre></div><h4 id="sending-control-change-cc-messages" tabindex="-1">Sending Control Change (CC) Messages <a class="header-anchor" href="#sending-control-change-cc-messages" aria-label="Permalink to &quot;Sending Control Change (CC) Messages&quot;"></a></h4><p>If you&#39;re aiming to emulate the features of something like a Launchpad or other MIDI controller you&#39;ll need to access the internal MIDI device directly.</p><p>Because there are so many possible CC messages, not all of them are implemented as keycodes. Additionally, you might need to provide more than just two values that you would get from a keycode (pressed and released) - for example, the analog values from a fader or a potentiometer. So, you will need to implement <a href="./../feature_macros">custom keycodes</a> if you want to use them in your keymap directly using <code>process_record_user()</code>.</p><p>For reference of all the possible control code numbers see <a href="#midi-specification">MIDI Specification</a></p><h4 id="example-code-for-using-generic-on-off-switches-as-per-midi-specification" tabindex="-1">Example code for using Generic On Off Switches as per MIDI Specification. <a class="header-anchor" href="#example-code-for-using-generic-on-off-switches-as-per-midi-specification" aria-label="Permalink to &quot;Example code for using Generic On Off Switches as per MIDI Specification.&quot;"></a></h4><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes
const _hoisted_31 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_31);
}
const midi = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
midi as default
};