From d8f20ff9d4ebc6c3f7e277d174b27dd0caa085db Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 00:59:04 -0400 Subject: [PATCH 01/14] added basic midi documention of common features --- docs/feature_midi.md | 301 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 301 insertions(+) create mode 100644 docs/feature_midi.md diff --git a/docs/feature_midi.md b/docs/feature_midi.md new file mode 100644 index 000000000000..1c4d45b4a30d --- /dev/null +++ b/docs/feature_midi.md @@ -0,0 +1,301 @@ + +# MIDI + +## Enabling MIDI + +Add the following to the keyboard's rules.mk + +```c +MIDI_ENABLE = yes +``` + +## Using Basic MIDI + +Enabling Basic MIDI only + +Add the following to your keyboard's config.h + +```c +#define MIDI_BASIC +``` + +With basic MIDI you will only be able to send `NOTE_ON` and `NOTE_OFF` Commands to the internal MIDI device, meaning that keycodes like `MI_OCTU` and `MI_OCTD` won't work. + +## Advanced MIDI + +Enabling Advanced MIDI + +Add the following to your keyboard's config.h + +```c +#define MIDI_ADVANCED +``` + +With advanced MIDI you can do things like octave shifts, channel changes, velocity changes, and modulation. + +### Sending MIDI Control Codes (MIDI CC) + +If you're aiming to emulate the features of something like a Launchpad or other MIDI controller you'll need to access the internal MIDI device directly. + +It's best to follow a refernce because when sending MIDI CC you don't get the advantages of a keycode and you will need to impliment a `process_record_user` and the custom keycodes for that. It's the same process as implmenting custom key behavior or macros. + +For an overview of that process look at: [Macros](feature_macros.md) + +1. First enable MIDI_ADVANCED +2. use an `extern MidiDevice midi_device;` statement to bring the MIDI device into scope. +3. Send a control code with the `midi_send_cc(*midi_device, channel, number, value)` + +For reference of all the possible control code numbers see [MIDI Specification](#midi-specification) + +#### Example code for using Generic On Off Switches as per MIDI Specification. +```c +#include QMK_KEYBOARD_H + +extern MidiDevice midi_device; + +/* +MIDI CC codes for generic ON/OFF swiches +80,81,82,83 +values off = 0-63 +*/ + +#define OFF 0 + +/*values on = 64-127*/ + +#define ON 127 + +/*implementation inspo taken from here: https://github.com/luantty2/pheromone_keyboard/blob/master/keyboards/pheromone/keymaps/default/keymap.c */ + +enum custom_keycodes { MIDI_CC80 = SAFE_RANGE, MIDI_CC81, MIDI_CC82, MIDI_CC83 }; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case MIDI_CC80: + if (record->event.pressed) { + midi_send_cc(&midi_device, midi_config.channel, 80, ON); + } else { + midi_send_cc(&midi_device, midi_config.channel, 80, OFF); + } + return true; + } + return true; +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = { + {MIDI_CC80, MIDI_CC81, MIDI_CC82, MIDI_CC83}, + // ... + }, +}; + +``` + +### Avaiable MIDI Keycodes + +| Keycode | MIDI Code | Description | +|----------------------------|-----------|---------------------------------------------------------| +| MI_ON | 5C2C | Turn MIDI on | +| MI_OFF | 5C2D | Turn MIDI off | +| MI_TOG | 5C2E | Toggle MIDI Enabled | +| MI_C | 5C2F | C | +| MI_Cs | 5C30 | C ♯ | +| MI_Db | MI_Cs | D ♭ == C♯ | +| MI_D | 5C31 | D | +| MI_Ds | 5C32 | D ♯ | +| MI_Eb | MI_Ds | E♭ == D ♯ | +| MI_E | 5C33 | E | +| MI_F | 5C34 | F | +| MI_Fs | 5C35 | F ♯ | +| MI_Gb | MI_Fs | G ♭ | +| MI_G | 5C36 | G | +| MI_Gs | 5C37 | G ♯ | +| MI_Ab | MI_Gs | A ♭ | +| MI_A | 5C38 | A | +| MI_As | 5C39 | A ♯ | +| MI_Bb | MI_As | B ♭ | +| MI_B | 5C3A | B | +| MI_C_1 | 5C3B | C octave 1 | +| MI_Cs_1 | 5C3C | C ♯ octave 1 | +| MI_Db_1 | MI_Cs_1 | D ♭ octave 1 | +| MI_D_1 | 5C3D | D octave 1 | +| MI_Ds_1 | 5C3E | D ♯ octave 1 | +| MI_Eb_1 | MI_Ds_1 | E ♭ octave 1 | +| MI_E_1 | 5C3F | E octave 1 | +| MI_F_1 | 5C40 | F octave 1 | +| MI_Fs_1 | 5C41 | F ♯ octave 1 | +| MI_Gb_1 | MI_Fs_1 | G ♭ octave 1 | +| MI_G_1 | 5C42 | G octave 1 | +| MI_Gs_1 | 5C43 | G ♯ octave 1 | +| MI_Ab_1 | MI_Gs_1 | A ♭ octave 1 | +| MI_A_1 | 5C44 | A octave 1 | +| MI_As_1 | 5C45 | A ♯ octave 1 | +| MI_Bb_1 | MI_As_1 | B ♭ octave 1 | +| MI_B_1 | 5C46 | B octave 1 | +| MI_C_2 | 5C47 | C octave 2 | +| MI_Cs_2 | 5C48 | C ♯ octave 2 | +| MI_Db_2 | MI_Cs_2 | D ♭ octave 2 | +| MI_D_2 | 5C49 | D octave 2 | +| MI_Ds_2 | 5C4A | D ♯ octave 2 | +| MI_Eb_2 | MI_Ds_2 | E ♭ octave 2 | +| MI_E_2 | 5C4B | E octave 2 | +| MI_F_2 | 5C4C | F octave 2 | +| MI_Fs_2 | 5C4D | F ♯ octave 2 | +| MI_Gb_2 | MI_Fs_2 | G ♭ octave 2 | +| MI_G_2 | 5C4E | G octave 2 | +| MI_Gs_2 | 5C4F | G ♯ octave 2 | +| MI_Ab_2 | MI_Gs_2 | A ♭ octave 2 | +| MI_A_2 | 5C50 | A octave 2 | +| MI_As_2 | 5C51 | A ♯ octave 2 | +| MI_Bb_2 | MI_As_2 | B ♭ octave 2 | +| MI_B_2 | 5C52 | B octave 2 | +| MI_C_3 | 5C53 | C octave 3 | +| MI_Cs_3 | 5C54 | C ♯ octave 3 | +| MI_Db_3 | MI_Cs_3 | D ♭ octave 3 | +| MI_D_3 | 5C55 | D octave 3 | +| MI_Ds_3 | 5C56 | D ♯ octave 3 | +| MI_Eb_3 | MI_Ds_3 | E ♭ octave 3 | +| MI_E_3 | 5C57 | E octave 3 | +| MI_F_3 | 5C58 | F octave 3 | +| MI_Fs_3 | 5C59 | F ♯ octave 3 | +| MI_Gb_3 | MI_Fs_3 | G ♭ octave 3 | +| MI_G_3 | 5C5A | G octave 3 | +| MI_Gs_3 | 5C5B | G ♯ octave 3 | +| MI_Ab_3 | MI_Gs_3 | A ♭ octave 3 | +| MI_A_3 | 5C5C | A octave 3 | +| MI_As_3 | 5C5D | A ♯ octave 3 | +| MI_Bb_3 | MI_As_3 | B ♭ octave 3 | +| MI_B_3 | 5C5E | B octave 3 | +| MI_C_4 | 5C5F | C octave 4 | +| MI_Cs_4 | 5C60 | C ♯ octave 4 | +| MI_Db_4 | MI_Cs_4 | D ♭ octave 4 | +| MI_D_4 | 5C61 | D octave 4 | +| MI_Ds_4 | 5C62 | D ♯ octave 4 | +| MI_Eb_4 | MI_Ds_4 | E ♭ octave 4 | +| MI_E_4 | 5C63 | E octave 4 | +| MI_F_4 | 5C64 | F octave 4 | +| MI_Fs_4 | 5C65 | F ♯ octave 4 | +| MI_Gb_4 | MI_Fs_4 | G ♭ octave 4 | +| MI_G_4 | 5C66 | G octave 4 | +| MI_Gs_4 | 5C67 | G ♯ octave 4 | +| MI_Ab_4 | MI_Gs_4 | A ♭ octave 4 | +| MI_A_4 | 5C68 | A octave 4 | +| MI_As_4 | 5C69 | A ♯ octave 4 | +| MI_Bb_4 | MI_As_4 | B ♭ octave 4 | +| MI_B_4 | 5C6A | B octave 4 | +| MI_C_5 | 5C6B | C octave 5 | +| MI_Cs_5 | 5C6C | C ♯ octave 5 | +| MI_Db_5 | MI_Cs_5, | D ♭ octave 5 | +| MI_D_5 | 5C6D | D octave 5 | +| MI_Ds_5 | 5C6E | D ♯ octave 5 | +| MI_Eb_5 | MI_Ds_5, | E ♭ octave 5 | +| MI_E_5 | 5C6F | E octave 5 | +| MI_F_5 | 5C70 | F octave 5 | +| MI_Fs_5 | 5C71 | F ♯ octave 5 | +| MI_Gb_5 | MI_Fs_5, | G ♭ octave 5 | +| MI_G_5 | 5C72 | G octave 5 | +| MI_Gs_5 | 5C73 | G ♯ octave 5 | +| MI_Ab_5 | MI_Gs_5, | A ♭ octave 5 | +| MI_A_5 | 5C74 | A octave 5 | +| MI_As_5 | 5C75 | A ♯ octave 5 | +| MI_Bb_5 | MI_As_5, | B ♭ octave 5 | +| MI_B_5 | 5C76 | B octave 5 | +| MI_OCT_N2 | 5C77 | Go to octave -2 | +| MI_OCT_N1 | 5C78 | Go to octave -1 | +| MI_OCT_0 | 5C79 | Go to octave 0 | +| MI_OCT_1 | 5C7A | Go to octave 1 | +| MI_OCT_2 | 5C7B | Go to octave 2 | +| MI_OCT_3 | 5C7C | Go to octave 3 | +| MI_OCT_4 | 5C7D | Go to octave 4 | +| MI_OCT_5 | 5C7E | Go to octave 5 | +| MI_OCT_6 | 5C7F | Go to octave 6 | +| MI_OCT_7 | 5C80 | Go to octave 7 | +| MI_OCTD | 5C81 | Go down an octave | +| MI_OCTU | 5C82 | Go up an octave | +| MI_TRNS_N6 | 5C83 | Transpose notes down 6 posisions | +| MI_TRNS_N5 | 5C84 | Transpose notes down 5 posisions | +| MI_TRNS_N4 | 5C85 | Transpose notes down 4 posisions | +| MI_TRNS_N3 | 5C86 | Transpose notes down 3 posisions | +| MI_TRNS_N2 | 5C87 | Transpose notes down 2 posisions | +| MI_TRNS_N1 | 5C88 | Transpose notes down 1 posision | +| MI_TRNS_0 | 5C89 | No transposision | +| MI_TRNS_1 | 5C8A | Transpose notes up 1 posision | +| MI_TRNS_2 | 5C8B | Transpose notes up 2 posisions | +| MI_TRNS_3 | 5C8C | Transpose notes up 3 posisions | +| MI_TRNS_4 | 5C8D | Transpose notes up 4 posisions | +| MI_TRNS_5 | 5C8E | Transpose notes up 5 posisions | +| MI_TRNS_6 | 5C8F | Transpose notes up 6 posisions | +| MI_TRNSD | 5C90 | Transpose notes down a posision | +| MI_TRNSU | 5C91 | Transpose notes up a posision | +| MI_VEL_0 | 5C92 | Set Velocity to 0 | +| if VIA_ENABLE: MI_VEL_1 | MI_VEL_0 | If via is enabled, Velocity 1 is the same as Velocity 0 | +| if no VIA_ENABLE: MI_VEL_1 | 5C93 | Set Velocity to 1 | +| MI_VEL_2 | 5C94 | Set Velocity to 2 | +| MI_VEL_3 | 5C95 | Set Velocity to 3 | +| MI_VEL_4 | 5C96 | Set Velocity to 4 | +| MI_VEL_5 | 5C97 | Set Velocity to 5 | +| MI_VEL_6 | 5C98 | Set Velocity to 6 | +| MI_VEL_7 | 5C99 | Set Velocity to 7 | +| MI_VEL_8 | 5C9A | Set Velocity to 8 | +| MI_VEL_9 | 5C9B | Set Velocity to 9 | +| MI_VEL_10 | 5C9C | Set Velocity to 10 | +| MI_VELD | 5C9D | Go down one tick of velocity | +| MI_VELU | 5C9E | Go up one tick of velocity | +| MI_CH1 | 5C9F | Go to channel 1 | +| MI_CH2 | 5CA0 | Go to channel 2 | +| MI_CH3 | 5CA1 | Go to channel 3 | +| MI_CH4 | 5CA2 | Go to channel 4 | +| MI_CH5 | 5CA3 | Go to channel 5 | +| MI_CH6 | 5CA4 | Go to channel 6 | +| MI_CH7 | 5CA5 | Go to channel 7 | +| MI_CH8 | 5CA6 | Go to channel 8 | +| MI_CH9 | 5CA7 | Go to channel 9 | +| MI_CH10 | 5CA8 | Go to channel 10 | +| MI_CH11 | 5CA9 | Go to channel 11 | +| MI_CH12 | 5CAA | Go to channel 12 | +| MI_CH13 | 5CAB | Go to channel 13 | +| MI_CH14 | 5CAC | Go to channel 14 | +| MI_CH15 | 5CAD | Go to channel 15 | +| MI_CH16 | 5CAE | Go to channel 16 | +| MI_CHD | 5CAF | Go to channel 17 | +| MI_CHU | 5CB0 | Go to channel 18 | +| MI_ALLOFF | 5CB1 | Turn off all notes | +| MI_SUS | 5CB2 | Sustain | +| MI_PORT | 5CB3 | Portmento | +| MI_SOST | 5CB4 | Sostenuto | +| MI_SOFT | 5CB5 | Soft Pedal | +| MI_LEG | 5CB6 | LEGATO | +| MI_MOD | 5CB7 | Modulation | +| MI_MODSD | 5CB8 | Decrease Modulation Speed | +| MI_MODSU | 5CB9 | Increase Modulation Speed | +| MI_BENDD | 5CBA | Bend pitch down | +| MI_BENDU | 5CBB | Bend pitch up | + +### Background + +QMK MIDI is based on TMK MIDI which in turn is based on `avr-midi` + +QMK MIDI is a subset implentation of the MIDI 1.0 specification. + +### References + +#### QMK Internals + + * [Internals/MIDI Device Setup Process](internals_midi_device_setup_process.md) + * [Internals/MIDI Device](internals_midi_device.md) + * [Internals/MIDI Util](internals_midi_util.md) + + +#### QMK C Files + + * `quantum/process_keycode/process_midi.c` + * `quantum/quantum_keycodes.h` + * `tmk_core/protocol/midi.h` + * `tmk_core/protocol/midi.c` + * `tmk_core/protocol/qmk_midi.c` + * `tmk_core/protocol/midi_device.h` + +#### MIDI Specification + + * [MIDI.org](https://www.midi.org/specifications-old/item/table-1-summary-of-midi-message) + * [CMU MIDI Programmer's Reference](https://www.cs.cmu.edu/~music/cmsip/readings/MIDI%20tutorial%20for%20programmers.html) From fc9c0cdda7fc660ab39b71f6cdfb3f86bc1e632b Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 01:05:02 -0400 Subject: [PATCH 02/14] removed extra comment that confused example code --- docs/feature_midi.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index 1c4d45b4a30d..e896452864ad 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -65,8 +65,6 @@ values off = 0-63 #define ON 127 -/*implementation inspo taken from here: https://github.com/luantty2/pheromone_keyboard/blob/master/keyboards/pheromone/keymaps/default/keymap.c */ - enum custom_keycodes { MIDI_CC80 = SAFE_RANGE, MIDI_CC81, MIDI_CC82, MIDI_CC83 }; bool process_record_user(uint16_t keycode, keyrecord_t *record) { From e53568023a6352d52dff393cca7b895dfec11510 Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 14:18:29 -0400 Subject: [PATCH 03/14] Fixup spelling issues Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> --- docs/feature_midi.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index e896452864ad..d796a1c78e23 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -37,7 +37,7 @@ With advanced MIDI you can do things like octave shifts, channel changes, veloci If you're aiming to emulate the features of something like a Launchpad or other MIDI controller you'll need to access the internal MIDI device directly. -It's best to follow a refernce because when sending MIDI CC you don't get the advantages of a keycode and you will need to impliment a `process_record_user` and the custom keycodes for that. It's the same process as implmenting custom key behavior or macros. +It's best to follow a reference because when sending MIDI CC you don't get the advantages of a keycode and you will need to implement a `process_record_user` and the custom keycodes for that. It's the same process as implementing custom key behavior or macros. For an overview of that process look at: [Macros](feature_macros.md) @@ -89,7 +89,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ``` -### Avaiable MIDI Keycodes +### Available MIDI Keycodes | Keycode | MIDI Code | Description | |----------------------------|-----------|---------------------------------------------------------| @@ -210,21 +210,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | MI_OCT_7 | 5C80 | Go to octave 7 | | MI_OCTD | 5C81 | Go down an octave | | MI_OCTU | 5C82 | Go up an octave | -| MI_TRNS_N6 | 5C83 | Transpose notes down 6 posisions | -| MI_TRNS_N5 | 5C84 | Transpose notes down 5 posisions | -| MI_TRNS_N4 | 5C85 | Transpose notes down 4 posisions | -| MI_TRNS_N3 | 5C86 | Transpose notes down 3 posisions | -| MI_TRNS_N2 | 5C87 | Transpose notes down 2 posisions | -| MI_TRNS_N1 | 5C88 | Transpose notes down 1 posision | -| MI_TRNS_0 | 5C89 | No transposision | -| MI_TRNS_1 | 5C8A | Transpose notes up 1 posision | -| MI_TRNS_2 | 5C8B | Transpose notes up 2 posisions | -| MI_TRNS_3 | 5C8C | Transpose notes up 3 posisions | -| MI_TRNS_4 | 5C8D | Transpose notes up 4 posisions | -| MI_TRNS_5 | 5C8E | Transpose notes up 5 posisions | -| MI_TRNS_6 | 5C8F | Transpose notes up 6 posisions | -| MI_TRNSD | 5C90 | Transpose notes down a posision | -| MI_TRNSU | 5C91 | Transpose notes up a posision | +| MI_TRNS_N6 | 5C83 | Transpose notes down 6 positions | +| MI_TRNS_N5 | 5C84 | Transpose notes down 5 positions | +| MI_TRNS_N4 | 5C85 | Transpose notes down 4 positions | +| MI_TRNS_N3 | 5C86 | Transpose notes down 3 positions | +| MI_TRNS_N2 | 5C87 | Transpose notes down 2 positions | +| MI_TRNS_N1 | 5C88 | Transpose notes down 1 positions | +| MI_TRNS_0 | 5C89 | No transpositions | +| MI_TRNS_1 | 5C8A | Transpose notes up 1 positions | +| MI_TRNS_2 | 5C8B | Transpose notes up 2 positions | +| MI_TRNS_3 | 5C8C | Transpose notes up 3 positions | +| MI_TRNS_4 | 5C8D | Transpose notes up 4 positions | +| MI_TRNS_5 | 5C8E | Transpose notes up 5 positions | +| MI_TRNS_6 | 5C8F | Transpose notes up 6 positions | +| MI_TRNSD | 5C90 | Transpose notes down a positions | +| MI_TRNSU | 5C91 | Transpose notes up a positions | | MI_VEL_0 | 5C92 | Set Velocity to 0 | | if VIA_ENABLE: MI_VEL_1 | MI_VEL_0 | If via is enabled, Velocity 1 is the same as Velocity 0 | | if no VIA_ENABLE: MI_VEL_1 | 5C93 | Set Velocity to 1 | @@ -262,7 +262,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | MI_PORT | 5CB3 | Portmento | | MI_SOST | 5CB4 | Sostenuto | | MI_SOFT | 5CB5 | Soft Pedal | -| MI_LEG | 5CB6 | LEGATO | +| MI_LEG | 5CB6 | Legato | | MI_MOD | 5CB7 | Modulation | | MI_MODSD | 5CB8 | Decrease Modulation Speed | | MI_MODSU | 5CB9 | Increase Modulation Speed | @@ -273,7 +273,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { QMK MIDI is based on TMK MIDI which in turn is based on `avr-midi` -QMK MIDI is a subset implentation of the MIDI 1.0 specification. +QMK MIDI is a subset implementation of the MIDI 1.0 specification. ### References From 8cd5da5b0245429477572db8c16eb74bb689b19d Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 14:31:08 -0400 Subject: [PATCH 04/14] spelling changes, etc --- docs/feature_midi.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index d796a1c78e23..5876eba1ac17 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -11,7 +11,7 @@ MIDI_ENABLE = yes ## Using Basic MIDI -Enabling Basic MIDI only +Enabling Basic MIDI Add the following to your keyboard's config.h @@ -19,7 +19,7 @@ Add the following to your keyboard's config.h #define MIDI_BASIC ``` -With basic MIDI you will only be able to send `NOTE_ON` and `NOTE_OFF` Commands to the internal MIDI device, meaning that keycodes like `MI_OCTU` and `MI_OCTD` won't work. +With basic MIDI you will only be able to send `NOTE_ON` and `NOTE_OFF` Commands to the internal MIDI device, meaning that keycodes like `MI_OCTU` and `MI_OCTD` will not work. ## Advanced MIDI @@ -37,7 +37,7 @@ With advanced MIDI you can do things like octave shifts, channel changes, veloci If you're aiming to emulate the features of something like a Launchpad or other MIDI controller you'll need to access the internal MIDI device directly. -It's best to follow a reference because when sending MIDI CC you don't get the advantages of a keycode and you will need to implement a `process_record_user` and the custom keycodes for that. It's the same process as implementing custom key behavior or macros. +When sending MIDI CC you don't get the advantages of a preimplemented keycode and you will need to implement custom keycodes if you want to use them in your keymap directly using the function `process_record_user`. It is the same process as implementing custom keycodes for macros. For an overview of that process look at: [Macros](feature_macros.md) From fff0a721138c61ca4b7e7dd424328b87454759ec Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 14:37:32 -0400 Subject: [PATCH 05/14] added appropriate links --- docs/_summary.md | 1 + docs/feature_audio.md | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_summary.md b/docs/_summary.md index 38937771f64e..90588a01da8d 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -100,6 +100,7 @@ * [RGB Lighting](feature_rgblight.md) * [RGB Matrix](feature_rgb_matrix.md) * [Audio](feature_audio.md) + * [MIDI](feature_midi.md) * [Bluetooth](feature_bluetooth.md) * [Bootmagic](feature_bootmagic.md) * [Custom Matrix](custom_matrix.md) diff --git a/docs/feature_audio.md b/docs/feature_audio.md index 2c440c951dc1..0f66b384f358 100644 --- a/docs/feature_audio.md +++ b/docs/feature_audio.md @@ -301,8 +301,7 @@ You can configure the default, min and max frequencies, the stepping and built i ## MIDI Functionality -This is still a WIP, but check out `quantum/process_keycode/process_midi.c` to see what's happening. Enable from the Makefile. - +See [MIDI](feature_midi.md) ## Audio Keycodes From 314212afae615304bde6d290686fd48020c8ae12 Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 16:36:41 -0400 Subject: [PATCH 06/14] Made changes as per @fauxpark's review Changes made: - Alphabetized _summary.md - Removed comment from feature_audio.md - Removed extra line from begining of feature_midi.md - Removed keycode value col from feature_midi.md Changes not made and reasoning: - Kept link to feature_midi.md in feature_audio.md - Audio and MIDI are linked in the build feature and in functionality thus it is appropriate for audio to have a link to MIDI - Kept refernce and background section - Need references and background for more advanced MIDI feature - EG. List and function of various CC codes - EG. Various still not documented MIDI features such as bi-directional communication - Helpful for people starting to work on the MIDI feature --- docs/_summary.md | 2 +- docs/feature_audio.md | 111 ------------- docs/feature_midi.md | 355 +++++++++++++++++++++--------------------- 3 files changed, 178 insertions(+), 290 deletions(-) diff --git a/docs/_summary.md b/docs/_summary.md index 90588a01da8d..9798ef5127d0 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -100,7 +100,6 @@ * [RGB Lighting](feature_rgblight.md) * [RGB Matrix](feature_rgb_matrix.md) * [Audio](feature_audio.md) - * [MIDI](feature_midi.md) * [Bluetooth](feature_bluetooth.md) * [Bootmagic](feature_bootmagic.md) * [Custom Matrix](custom_matrix.md) @@ -109,6 +108,7 @@ * [Haptic Feedback](feature_haptic_feedback.md) * [Joystick](feature_joystick.md) * [LED Indicators](feature_led_indicators.md) + * [MIDI](feature_midi.md) * [Proton C Conversion](proton_c_conversion.md) * [PS/2 Mouse](feature_ps2_mouse.md) * [Split Keyboard](feature_split_keyboard.md) diff --git a/docs/feature_audio.md b/docs/feature_audio.md index 0f66b384f358..b7b572974fdc 100644 --- a/docs/feature_audio.md +++ b/docs/feature_audio.md @@ -318,114 +318,3 @@ See [MIDI](feature_midi.md) |`MU_OFF` | |Turns off Music Mode | |`MU_TOG` | |Toggles Music Mode | |`MU_MOD` | |Cycles through the music modes | - - diff --git a/docs/feature_midi.md b/docs/feature_midi.md index 5876eba1ac17..4d2f039261de 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -1,4 +1,3 @@ - # MIDI ## Enabling MIDI @@ -91,183 +90,183 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ### Available MIDI Keycodes -| Keycode | MIDI Code | Description | -|----------------------------|-----------|---------------------------------------------------------| -| MI_ON | 5C2C | Turn MIDI on | -| MI_OFF | 5C2D | Turn MIDI off | -| MI_TOG | 5C2E | Toggle MIDI Enabled | -| MI_C | 5C2F | C | -| MI_Cs | 5C30 | C ♯ | -| MI_Db | MI_Cs | D ♭ == C♯ | -| MI_D | 5C31 | D | -| MI_Ds | 5C32 | D ♯ | -| MI_Eb | MI_Ds | E♭ == D ♯ | -| MI_E | 5C33 | E | -| MI_F | 5C34 | F | -| MI_Fs | 5C35 | F ♯ | -| MI_Gb | MI_Fs | G ♭ | -| MI_G | 5C36 | G | -| MI_Gs | 5C37 | G ♯ | -| MI_Ab | MI_Gs | A ♭ | -| MI_A | 5C38 | A | -| MI_As | 5C39 | A ♯ | -| MI_Bb | MI_As | B ♭ | -| MI_B | 5C3A | B | -| MI_C_1 | 5C3B | C octave 1 | -| MI_Cs_1 | 5C3C | C ♯ octave 1 | -| MI_Db_1 | MI_Cs_1 | D ♭ octave 1 | -| MI_D_1 | 5C3D | D octave 1 | -| MI_Ds_1 | 5C3E | D ♯ octave 1 | -| MI_Eb_1 | MI_Ds_1 | E ♭ octave 1 | -| MI_E_1 | 5C3F | E octave 1 | -| MI_F_1 | 5C40 | F octave 1 | -| MI_Fs_1 | 5C41 | F ♯ octave 1 | -| MI_Gb_1 | MI_Fs_1 | G ♭ octave 1 | -| MI_G_1 | 5C42 | G octave 1 | -| MI_Gs_1 | 5C43 | G ♯ octave 1 | -| MI_Ab_1 | MI_Gs_1 | A ♭ octave 1 | -| MI_A_1 | 5C44 | A octave 1 | -| MI_As_1 | 5C45 | A ♯ octave 1 | -| MI_Bb_1 | MI_As_1 | B ♭ octave 1 | -| MI_B_1 | 5C46 | B octave 1 | -| MI_C_2 | 5C47 | C octave 2 | -| MI_Cs_2 | 5C48 | C ♯ octave 2 | -| MI_Db_2 | MI_Cs_2 | D ♭ octave 2 | -| MI_D_2 | 5C49 | D octave 2 | -| MI_Ds_2 | 5C4A | D ♯ octave 2 | -| MI_Eb_2 | MI_Ds_2 | E ♭ octave 2 | -| MI_E_2 | 5C4B | E octave 2 | -| MI_F_2 | 5C4C | F octave 2 | -| MI_Fs_2 | 5C4D | F ♯ octave 2 | -| MI_Gb_2 | MI_Fs_2 | G ♭ octave 2 | -| MI_G_2 | 5C4E | G octave 2 | -| MI_Gs_2 | 5C4F | G ♯ octave 2 | -| MI_Ab_2 | MI_Gs_2 | A ♭ octave 2 | -| MI_A_2 | 5C50 | A octave 2 | -| MI_As_2 | 5C51 | A ♯ octave 2 | -| MI_Bb_2 | MI_As_2 | B ♭ octave 2 | -| MI_B_2 | 5C52 | B octave 2 | -| MI_C_3 | 5C53 | C octave 3 | -| MI_Cs_3 | 5C54 | C ♯ octave 3 | -| MI_Db_3 | MI_Cs_3 | D ♭ octave 3 | -| MI_D_3 | 5C55 | D octave 3 | -| MI_Ds_3 | 5C56 | D ♯ octave 3 | -| MI_Eb_3 | MI_Ds_3 | E ♭ octave 3 | -| MI_E_3 | 5C57 | E octave 3 | -| MI_F_3 | 5C58 | F octave 3 | -| MI_Fs_3 | 5C59 | F ♯ octave 3 | -| MI_Gb_3 | MI_Fs_3 | G ♭ octave 3 | -| MI_G_3 | 5C5A | G octave 3 | -| MI_Gs_3 | 5C5B | G ♯ octave 3 | -| MI_Ab_3 | MI_Gs_3 | A ♭ octave 3 | -| MI_A_3 | 5C5C | A octave 3 | -| MI_As_3 | 5C5D | A ♯ octave 3 | -| MI_Bb_3 | MI_As_3 | B ♭ octave 3 | -| MI_B_3 | 5C5E | B octave 3 | -| MI_C_4 | 5C5F | C octave 4 | -| MI_Cs_4 | 5C60 | C ♯ octave 4 | -| MI_Db_4 | MI_Cs_4 | D ♭ octave 4 | -| MI_D_4 | 5C61 | D octave 4 | -| MI_Ds_4 | 5C62 | D ♯ octave 4 | -| MI_Eb_4 | MI_Ds_4 | E ♭ octave 4 | -| MI_E_4 | 5C63 | E octave 4 | -| MI_F_4 | 5C64 | F octave 4 | -| MI_Fs_4 | 5C65 | F ♯ octave 4 | -| MI_Gb_4 | MI_Fs_4 | G ♭ octave 4 | -| MI_G_4 | 5C66 | G octave 4 | -| MI_Gs_4 | 5C67 | G ♯ octave 4 | -| MI_Ab_4 | MI_Gs_4 | A ♭ octave 4 | -| MI_A_4 | 5C68 | A octave 4 | -| MI_As_4 | 5C69 | A ♯ octave 4 | -| MI_Bb_4 | MI_As_4 | B ♭ octave 4 | -| MI_B_4 | 5C6A | B octave 4 | -| MI_C_5 | 5C6B | C octave 5 | -| MI_Cs_5 | 5C6C | C ♯ octave 5 | -| MI_Db_5 | MI_Cs_5, | D ♭ octave 5 | -| MI_D_5 | 5C6D | D octave 5 | -| MI_Ds_5 | 5C6E | D ♯ octave 5 | -| MI_Eb_5 | MI_Ds_5, | E ♭ octave 5 | -| MI_E_5 | 5C6F | E octave 5 | -| MI_F_5 | 5C70 | F octave 5 | -| MI_Fs_5 | 5C71 | F ♯ octave 5 | -| MI_Gb_5 | MI_Fs_5, | G ♭ octave 5 | -| MI_G_5 | 5C72 | G octave 5 | -| MI_Gs_5 | 5C73 | G ♯ octave 5 | -| MI_Ab_5 | MI_Gs_5, | A ♭ octave 5 | -| MI_A_5 | 5C74 | A octave 5 | -| MI_As_5 | 5C75 | A ♯ octave 5 | -| MI_Bb_5 | MI_As_5, | B ♭ octave 5 | -| MI_B_5 | 5C76 | B octave 5 | -| MI_OCT_N2 | 5C77 | Go to octave -2 | -| MI_OCT_N1 | 5C78 | Go to octave -1 | -| MI_OCT_0 | 5C79 | Go to octave 0 | -| MI_OCT_1 | 5C7A | Go to octave 1 | -| MI_OCT_2 | 5C7B | Go to octave 2 | -| MI_OCT_3 | 5C7C | Go to octave 3 | -| MI_OCT_4 | 5C7D | Go to octave 4 | -| MI_OCT_5 | 5C7E | Go to octave 5 | -| MI_OCT_6 | 5C7F | Go to octave 6 | -| MI_OCT_7 | 5C80 | Go to octave 7 | -| MI_OCTD | 5C81 | Go down an octave | -| MI_OCTU | 5C82 | Go up an octave | -| MI_TRNS_N6 | 5C83 | Transpose notes down 6 positions | -| MI_TRNS_N5 | 5C84 | Transpose notes down 5 positions | -| MI_TRNS_N4 | 5C85 | Transpose notes down 4 positions | -| MI_TRNS_N3 | 5C86 | Transpose notes down 3 positions | -| MI_TRNS_N2 | 5C87 | Transpose notes down 2 positions | -| MI_TRNS_N1 | 5C88 | Transpose notes down 1 positions | -| MI_TRNS_0 | 5C89 | No transpositions | -| MI_TRNS_1 | 5C8A | Transpose notes up 1 positions | -| MI_TRNS_2 | 5C8B | Transpose notes up 2 positions | -| MI_TRNS_3 | 5C8C | Transpose notes up 3 positions | -| MI_TRNS_4 | 5C8D | Transpose notes up 4 positions | -| MI_TRNS_5 | 5C8E | Transpose notes up 5 positions | -| MI_TRNS_6 | 5C8F | Transpose notes up 6 positions | -| MI_TRNSD | 5C90 | Transpose notes down a positions | -| MI_TRNSU | 5C91 | Transpose notes up a positions | -| MI_VEL_0 | 5C92 | Set Velocity to 0 | -| if VIA_ENABLE: MI_VEL_1 | MI_VEL_0 | If via is enabled, Velocity 1 is the same as Velocity 0 | -| if no VIA_ENABLE: MI_VEL_1 | 5C93 | Set Velocity to 1 | -| MI_VEL_2 | 5C94 | Set Velocity to 2 | -| MI_VEL_3 | 5C95 | Set Velocity to 3 | -| MI_VEL_4 | 5C96 | Set Velocity to 4 | -| MI_VEL_5 | 5C97 | Set Velocity to 5 | -| MI_VEL_6 | 5C98 | Set Velocity to 6 | -| MI_VEL_7 | 5C99 | Set Velocity to 7 | -| MI_VEL_8 | 5C9A | Set Velocity to 8 | -| MI_VEL_9 | 5C9B | Set Velocity to 9 | -| MI_VEL_10 | 5C9C | Set Velocity to 10 | -| MI_VELD | 5C9D | Go down one tick of velocity | -| MI_VELU | 5C9E | Go up one tick of velocity | -| MI_CH1 | 5C9F | Go to channel 1 | -| MI_CH2 | 5CA0 | Go to channel 2 | -| MI_CH3 | 5CA1 | Go to channel 3 | -| MI_CH4 | 5CA2 | Go to channel 4 | -| MI_CH5 | 5CA3 | Go to channel 5 | -| MI_CH6 | 5CA4 | Go to channel 6 | -| MI_CH7 | 5CA5 | Go to channel 7 | -| MI_CH8 | 5CA6 | Go to channel 8 | -| MI_CH9 | 5CA7 | Go to channel 9 | -| MI_CH10 | 5CA8 | Go to channel 10 | -| MI_CH11 | 5CA9 | Go to channel 11 | -| MI_CH12 | 5CAA | Go to channel 12 | -| MI_CH13 | 5CAB | Go to channel 13 | -| MI_CH14 | 5CAC | Go to channel 14 | -| MI_CH15 | 5CAD | Go to channel 15 | -| MI_CH16 | 5CAE | Go to channel 16 | -| MI_CHD | 5CAF | Go to channel 17 | -| MI_CHU | 5CB0 | Go to channel 18 | -| MI_ALLOFF | 5CB1 | Turn off all notes | -| MI_SUS | 5CB2 | Sustain | -| MI_PORT | 5CB3 | Portmento | -| MI_SOST | 5CB4 | Sostenuto | -| MI_SOFT | 5CB5 | Soft Pedal | -| MI_LEG | 5CB6 | Legato | -| MI_MOD | 5CB7 | Modulation | -| MI_MODSD | 5CB8 | Decrease Modulation Speed | -| MI_MODSU | 5CB9 | Increase Modulation Speed | -| MI_BENDD | 5CBA | Bend pitch down | -| MI_BENDU | 5CBB | Bend pitch up | +| Keycode | Description | +|----------------------------|---------------------------------------------------------| +| MI_ON | Turn MIDI on | +| MI_OFF | Turn MIDI off | +| MI_TOG | Toggle MIDI Enabled | +| MI_C | C | +| MI_Cs | C ♯ | +| MI_Db | D ♭ == C♯ | +| MI_D | D | +| MI_Ds | D ♯ | +| MI_Eb | E♭ == D ♯ | +| MI_E | E | +| MI_F | F | +| MI_Fs | F ♯ | +| MI_Gb | G ♭ | +| MI_G | G | +| MI_Gs | G ♯ | +| MI_Ab | A ♭ | +| MI_A | A | +| MI_As | A ♯ | +| MI_Bb | B ♭ | +| MI_B | B | +| MI_C_1 | C octave 1 | +| MI_Cs_1 | C ♯ octave 1 | +| MI_Db_1 | D ♭ octave 1 | +| MI_D_1 | D octave 1 | +| MI_Ds_1 | D ♯ octave 1 | +| MI_Eb_1 | E ♭ octave 1 | +| MI_E_1 | E octave 1 | +| MI_F_1 | F octave 1 | +| MI_Fs_1 | F ♯ octave 1 | +| MI_Gb_1 | G ♭ octave 1 | +| MI_G_1 | G octave 1 | +| MI_Gs_1 | G ♯ octave 1 | +| MI_Ab_1 | A ♭ octave 1 | +| MI_A_1 | A octave 1 | +| MI_As_1 | A ♯ octave 1 | +| MI_Bb_1 | B ♭ octave 1 | +| MI_B_1 | B octave 1 | +| MI_C_2 | C octave 2 | +| MI_Cs_2 | C ♯ octave 2 | +| MI_Db_2 | D ♭ octave 2 | +| MI_D_2 | D octave 2 | +| MI_Ds_2 | D ♯ octave 2 | +| MI_Eb_2 | E ♭ octave 2 | +| MI_E_2 | E octave 2 | +| MI_F_2 | F octave 2 | +| MI_Fs_2 | F ♯ octave 2 | +| MI_Gb_2 | G ♭ octave 2 | +| MI_G_2 | G octave 2 | +| MI_Gs_2 | G ♯ octave 2 | +| MI_Ab_2 | A ♭ octave 2 | +| MI_A_2 | A octave 2 | +| MI_As_2 | A ♯ octave 2 | +| MI_Bb_2 | B ♭ octave 2 | +| MI_B_2 | B octave 2 | +| MI_C_3 | C octave 3 | +| MI_Cs_3 | C ♯ octave 3 | +| MI_Db_3 | D ♭ octave 3 | +| MI_D_3 | D octave 3 | +| MI_Ds_3 | D ♯ octave 3 | +| MI_Eb_3 | E ♭ octave 3 | +| MI_E_3 | E octave 3 | +| MI_F_3 | F octave 3 | +| MI_Fs_3 | F ♯ octave 3 | +| MI_Gb_3 | G ♭ octave 3 | +| MI_G_3 | G octave 3 | +| MI_Gs_3 | G ♯ octave 3 | +| MI_Ab_3 | A ♭ octave 3 | +| MI_A_3 | A octave 3 | +| MI_As_3 | A ♯ octave 3 | +| MI_Bb_3 | B ♭ octave 3 | +| MI_B_3 | B octave 3 | +| MI_C_4 | C octave 4 | +| MI_Cs_4 | C ♯ octave 4 | +| MI_Db_4 | D ♭ octave 4 | +| MI_D_4 | D octave 4 | +| MI_Ds_4 | D ♯ octave 4 | +| MI_Eb_4 | E ♭ octave 4 | +| MI_E_4 | E octave 4 | +| MI_F_4 | F octave 4 | +| MI_Fs_4 | F ♯ octave 4 | +| MI_Gb_4 | G ♭ octave 4 | +| MI_G_4 | G octave 4 | +| MI_Gs_4 | G ♯ octave 4 | +| MI_Ab_4 | A ♭ octave 4 | +| MI_A_4 | A octave 4 | +| MI_As_4 | A ♯ octave 4 | +| MI_Bb_4 | B ♭ octave 4 | +| MI_B_4 | B octave 4 | +| MI_C_5 | C octave 5 | +| MI_Cs_5 | C ♯ octave 5 | +| MI_Db_5 | D ♭ octave 5 | +| MI_D_5 | D octave 5 | +| MI_Ds_5 | D ♯ octave 5 | +| MI_Eb_5 | E ♭ octave 5 | +| MI_E_5 | E octave 5 | +| MI_F_5 | F octave 5 | +| MI_Fs_5 | F ♯ octave 5 | +| MI_Gb_5 | G ♭ octave 5 | +| MI_G_5 | G octave 5 | +| MI_Gs_5 | G ♯ octave 5 | +| MI_Ab_5 | A ♭ octave 5 | +| MI_A_5 | A octave 5 | +| MI_As_5 | A ♯ octave 5 | +| MI_Bb_5 | B ♭ octave 5 | +| MI_B_5 | B octave 5 | +| MI_OCT_N2 | Go to octave -2 | +| MI_OCT_N1 | Go to octave -1 | +| MI_OCT_0 | Go to octave 0 | +| MI_OCT_1 | Go to octave 1 | +| MI_OCT_2 | Go to octave 2 | +| MI_OCT_3 | Go to octave 3 | +| MI_OCT_4 | Go to octave 4 | +| MI_OCT_5 | Go to octave 5 | +| MI_OCT_6 | Go to octave 6 | +| MI_OCT_7 | Go to octave 7 | +| MI_OCTD | Go down an octave | +| MI_OCTU | Go up an octave | +| MI_TRNS_N6 | Transpose notes down 6 positions | +| MI_TRNS_N5 | Transpose notes down 5 positions | +| MI_TRNS_N4 | Transpose notes down 4 positions | +| MI_TRNS_N3 | Transpose notes down 3 positions | +| MI_TRNS_N2 | Transpose notes down 2 positions | +| MI_TRNS_N1 | Transpose notes down 1 positions | +| MI_TRNS_0 | No transpositions | +| MI_TRNS_1 | Transpose notes up 1 positions | +| MI_TRNS_2 | Transpose notes up 2 positions | +| MI_TRNS_3 | Transpose notes up 3 positions | +| MI_TRNS_4 | Transpose notes up 4 positions | +| MI_TRNS_5 | Transpose notes up 5 positions | +| MI_TRNS_6 | Transpose notes up 6 positions | +| MI_TRNSD | Transpose notes down a positions | +| MI_TRNSU | Transpose notes up a positions | +| MI_VEL_0 | Set Velocity to 0 | +| if VIA_ENABLE: MI_VEL_1 | If via is enabled, Velocity 1 is the same as Velocity 0 | +| if no VIA_ENABLE: MI_VEL_1 | Set Velocity to 1 | +| MI_VEL_2 | Set Velocity to 2 | +| MI_VEL_3 | Set Velocity to 3 | +| MI_VEL_4 | Set Velocity to 4 | +| MI_VEL_5 | Set Velocity to 5 | +| MI_VEL_6 | Set Velocity to 6 | +| MI_VEL_7 | Set Velocity to 7 | +| MI_VEL_8 | Set Velocity to 8 | +| MI_VEL_9 | Set Velocity to 9 | +| MI_VEL_10 | Set Velocity to 10 | +| MI_VELD | Go down one tick of velocity | +| MI_VELU | Go up one tick of velocity | +| MI_CH1 | Go to channel 1 | +| MI_CH2 | Go to channel 2 | +| MI_CH3 | Go to channel 3 | +| MI_CH4 | Go to channel 4 | +| MI_CH5 | Go to channel 5 | +| MI_CH6 | Go to channel 6 | +| MI_CH7 | Go to channel 7 | +| MI_CH8 | Go to channel 8 | +| MI_CH9 | Go to channel 9 | +| MI_CH10 | Go to channel 10 | +| MI_CH11 | Go to channel 11 | +| MI_CH12 | Go to channel 12 | +| MI_CH13 | Go to channel 13 | +| MI_CH14 | Go to channel 14 | +| MI_CH15 | Go to channel 15 | +| MI_CH16 | Go to channel 16 | +| MI_CHD | Go to channel 17 | +| MI_CHU | Go to channel 18 | +| MI_ALLOFF | Turn off all notes | +| MI_SUS | Sustain | +| MI_PORT | Portmento | +| MI_SOST | Sostenuto | +| MI_SOFT | Soft Pedal | +| MI_LEG | Legato | +| MI_MOD | Modulation | +| MI_MODSD | Decrease Modulation Speed | +| MI_MODSU | Increase Modulation Speed | +| MI_BENDD | Bend pitch down | +| MI_BENDU | Bend pitch up | ### Background From 4fbb1c8c01af7cbc9259d9a120e2b9be669d4668 Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 17:39:01 -0400 Subject: [PATCH 07/14] Add Alias Col Co-authored-by: Ryan --- docs/feature_midi.md | 327 ++++++++++++++++++++----------------------- 1 file changed, 148 insertions(+), 179 deletions(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index 4d2f039261de..15f4b40e2054 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -88,185 +88,154 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ``` -### Available MIDI Keycodes - -| Keycode | Description | -|----------------------------|---------------------------------------------------------| -| MI_ON | Turn MIDI on | -| MI_OFF | Turn MIDI off | -| MI_TOG | Toggle MIDI Enabled | -| MI_C | C | -| MI_Cs | C ♯ | -| MI_Db | D ♭ == C♯ | -| MI_D | D | -| MI_Ds | D ♯ | -| MI_Eb | E♭ == D ♯ | -| MI_E | E | -| MI_F | F | -| MI_Fs | F ♯ | -| MI_Gb | G ♭ | -| MI_G | G | -| MI_Gs | G ♯ | -| MI_Ab | A ♭ | -| MI_A | A | -| MI_As | A ♯ | -| MI_Bb | B ♭ | -| MI_B | B | -| MI_C_1 | C octave 1 | -| MI_Cs_1 | C ♯ octave 1 | -| MI_Db_1 | D ♭ octave 1 | -| MI_D_1 | D octave 1 | -| MI_Ds_1 | D ♯ octave 1 | -| MI_Eb_1 | E ♭ octave 1 | -| MI_E_1 | E octave 1 | -| MI_F_1 | F octave 1 | -| MI_Fs_1 | F ♯ octave 1 | -| MI_Gb_1 | G ♭ octave 1 | -| MI_G_1 | G octave 1 | -| MI_Gs_1 | G ♯ octave 1 | -| MI_Ab_1 | A ♭ octave 1 | -| MI_A_1 | A octave 1 | -| MI_As_1 | A ♯ octave 1 | -| MI_Bb_1 | B ♭ octave 1 | -| MI_B_1 | B octave 1 | -| MI_C_2 | C octave 2 | -| MI_Cs_2 | C ♯ octave 2 | -| MI_Db_2 | D ♭ octave 2 | -| MI_D_2 | D octave 2 | -| MI_Ds_2 | D ♯ octave 2 | -| MI_Eb_2 | E ♭ octave 2 | -| MI_E_2 | E octave 2 | -| MI_F_2 | F octave 2 | -| MI_Fs_2 | F ♯ octave 2 | -| MI_Gb_2 | G ♭ octave 2 | -| MI_G_2 | G octave 2 | -| MI_Gs_2 | G ♯ octave 2 | -| MI_Ab_2 | A ♭ octave 2 | -| MI_A_2 | A octave 2 | -| MI_As_2 | A ♯ octave 2 | -| MI_Bb_2 | B ♭ octave 2 | -| MI_B_2 | B octave 2 | -| MI_C_3 | C octave 3 | -| MI_Cs_3 | C ♯ octave 3 | -| MI_Db_3 | D ♭ octave 3 | -| MI_D_3 | D octave 3 | -| MI_Ds_3 | D ♯ octave 3 | -| MI_Eb_3 | E ♭ octave 3 | -| MI_E_3 | E octave 3 | -| MI_F_3 | F octave 3 | -| MI_Fs_3 | F ♯ octave 3 | -| MI_Gb_3 | G ♭ octave 3 | -| MI_G_3 | G octave 3 | -| MI_Gs_3 | G ♯ octave 3 | -| MI_Ab_3 | A ♭ octave 3 | -| MI_A_3 | A octave 3 | -| MI_As_3 | A ♯ octave 3 | -| MI_Bb_3 | B ♭ octave 3 | -| MI_B_3 | B octave 3 | -| MI_C_4 | C octave 4 | -| MI_Cs_4 | C ♯ octave 4 | -| MI_Db_4 | D ♭ octave 4 | -| MI_D_4 | D octave 4 | -| MI_Ds_4 | D ♯ octave 4 | -| MI_Eb_4 | E ♭ octave 4 | -| MI_E_4 | E octave 4 | -| MI_F_4 | F octave 4 | -| MI_Fs_4 | F ♯ octave 4 | -| MI_Gb_4 | G ♭ octave 4 | -| MI_G_4 | G octave 4 | -| MI_Gs_4 | G ♯ octave 4 | -| MI_Ab_4 | A ♭ octave 4 | -| MI_A_4 | A octave 4 | -| MI_As_4 | A ♯ octave 4 | -| MI_Bb_4 | B ♭ octave 4 | -| MI_B_4 | B octave 4 | -| MI_C_5 | C octave 5 | -| MI_Cs_5 | C ♯ octave 5 | -| MI_Db_5 | D ♭ octave 5 | -| MI_D_5 | D octave 5 | -| MI_Ds_5 | D ♯ octave 5 | -| MI_Eb_5 | E ♭ octave 5 | -| MI_E_5 | E octave 5 | -| MI_F_5 | F octave 5 | -| MI_Fs_5 | F ♯ octave 5 | -| MI_Gb_5 | G ♭ octave 5 | -| MI_G_5 | G octave 5 | -| MI_Gs_5 | G ♯ octave 5 | -| MI_Ab_5 | A ♭ octave 5 | -| MI_A_5 | A octave 5 | -| MI_As_5 | A ♯ octave 5 | -| MI_Bb_5 | B ♭ octave 5 | -| MI_B_5 | B octave 5 | -| MI_OCT_N2 | Go to octave -2 | -| MI_OCT_N1 | Go to octave -1 | -| MI_OCT_0 | Go to octave 0 | -| MI_OCT_1 | Go to octave 1 | -| MI_OCT_2 | Go to octave 2 | -| MI_OCT_3 | Go to octave 3 | -| MI_OCT_4 | Go to octave 4 | -| MI_OCT_5 | Go to octave 5 | -| MI_OCT_6 | Go to octave 6 | -| MI_OCT_7 | Go to octave 7 | -| MI_OCTD | Go down an octave | -| MI_OCTU | Go up an octave | -| MI_TRNS_N6 | Transpose notes down 6 positions | -| MI_TRNS_N5 | Transpose notes down 5 positions | -| MI_TRNS_N4 | Transpose notes down 4 positions | -| MI_TRNS_N3 | Transpose notes down 3 positions | -| MI_TRNS_N2 | Transpose notes down 2 positions | -| MI_TRNS_N1 | Transpose notes down 1 positions | -| MI_TRNS_0 | No transpositions | -| MI_TRNS_1 | Transpose notes up 1 positions | -| MI_TRNS_2 | Transpose notes up 2 positions | -| MI_TRNS_3 | Transpose notes up 3 positions | -| MI_TRNS_4 | Transpose notes up 4 positions | -| MI_TRNS_5 | Transpose notes up 5 positions | -| MI_TRNS_6 | Transpose notes up 6 positions | -| MI_TRNSD | Transpose notes down a positions | -| MI_TRNSU | Transpose notes up a positions | -| MI_VEL_0 | Set Velocity to 0 | -| if VIA_ENABLE: MI_VEL_1 | If via is enabled, Velocity 1 is the same as Velocity 0 | -| if no VIA_ENABLE: MI_VEL_1 | Set Velocity to 1 | -| MI_VEL_2 | Set Velocity to 2 | -| MI_VEL_3 | Set Velocity to 3 | -| MI_VEL_4 | Set Velocity to 4 | -| MI_VEL_5 | Set Velocity to 5 | -| MI_VEL_6 | Set Velocity to 6 | -| MI_VEL_7 | Set Velocity to 7 | -| MI_VEL_8 | Set Velocity to 8 | -| MI_VEL_9 | Set Velocity to 9 | -| MI_VEL_10 | Set Velocity to 10 | -| MI_VELD | Go down one tick of velocity | -| MI_VELU | Go up one tick of velocity | -| MI_CH1 | Go to channel 1 | -| MI_CH2 | Go to channel 2 | -| MI_CH3 | Go to channel 3 | -| MI_CH4 | Go to channel 4 | -| MI_CH5 | Go to channel 5 | -| MI_CH6 | Go to channel 6 | -| MI_CH7 | Go to channel 7 | -| MI_CH8 | Go to channel 8 | -| MI_CH9 | Go to channel 9 | -| MI_CH10 | Go to channel 10 | -| MI_CH11 | Go to channel 11 | -| MI_CH12 | Go to channel 12 | -| MI_CH13 | Go to channel 13 | -| MI_CH14 | Go to channel 14 | -| MI_CH15 | Go to channel 15 | -| MI_CH16 | Go to channel 16 | -| MI_CHD | Go to channel 17 | -| MI_CHU | Go to channel 18 | -| MI_ALLOFF | Turn off all notes | -| MI_SUS | Sustain | -| MI_PORT | Portmento | -| MI_SOST | Sostenuto | -| MI_SOFT | Soft Pedal | -| MI_LEG | Legato | -| MI_MOD | Modulation | -| MI_MODSD | Decrease Modulation Speed | -| MI_MODSU | Increase Modulation Speed | -| MI_BENDD | Bend pitch down | -| MI_BENDU | Bend pitch up | +### Keycodes + +|Keycode |Aliases |Description | +|------------|---------|---------------------------------| +|`MI_ON` | |Turn MIDI on | +|`MI_OFF` | |Turn MIDI off | +|`MI_TOG` | |Toggle MIDI enabled | +|`MI_C` | |C octave 0 | +|`MI_Cs` |`MI_Db` |C♯/D♭ octave 0 | +|`MI_D` | |D octave 0 | +|`MI_Ds` |`MI_Eb` |D♯/E♭ octave 0 | +|`MI_E` | |E octave 0 | +|`MI_F` | |F octave 0 | +|`MI_Fs` |`MI_Gb` |F♯/G♭ octave 0 | +|`MI_G` | |G octave 0 | +|`MI_Gs` |`MI_Gs` |G♯/A♭ octave 0 | +|`MI_A` | |A octave 0 | +|`MI_As` |`MI_Bb` |A♯/B♭ octave 0 | +|`MI_B` | |B octave 0 | +|`MI_C_1` | |C octave 1 | +|`MI_Cs_1` |`MI_Db_1`|C♯/D♭ octave 1 | +|`MI_D_1` | |D octave 1 | +|`MI_Ds_1` |`MI_Eb_1`|D♯/E♭ octave 1 | +|`MI_E_1` | |E octave 1 | +|`MI_F_1` | |F octave 1 | +|`MI_Fs_1` |`MI_Gb_1`|F♯/G♭ octave 1 | +|`MI_G_1` | |G octave 1 | +|`MI_Gs_1` |`MI_Ab_1`|G♯/A♭ octave 1 | +|`MI_A_1` | |A octave 1 | +|`MI_As_1` |`MI_Bb_1`|A♯/B♭ octave 1 | +|`MI_B_1` | |B octave 1 | +|`MI_C_2` | |C octave 2 | +|`MI_Cs_2` |`MI_Db_2`|C♯/D♭ octave 2 | +|`MI_D_2` | |D octave 2 | +|`MI_Ds_2` |`MI_Eb_2`|D♯/E♭ octave 2 | +|`MI_E_2` | |E octave 2 | +|`MI_F_2` | |F octave 2 | +|`MI_Fs_2` |`MI_Gb_2`|F♯/G♭ octave 2 | +|`MI_G_2` | |G octave 2 | +|`MI_Gs_2` |`MI_Ab_2`|G♯/A♭ octave 2 | +|`MI_A_2` | |A octave 2 | +|`MI_As_2` |`MI_Bb_2`|A♯/B♭ octave 2 | +|`MI_B_2` | |B octave 2 | +|`MI_C_3` | |C octave 3 | +|`MI_Cs_3` |`MI_Db_3`|C♯/D♭ octave 3 | +|`MI_D_3` | |D octave 3 | +|`MI_Ds_3` |`MI_Eb_3`|D♯/E♭ octave 3 | +|`MI_E_3` | |E octave 3 | +|`MI_F_3` | |F octave 3 | +|`MI_Fs_3` |`MI_Gb_3`|F♯/G♭ octave 3 | +|`MI_G_3` | |G octave 3 | +|`MI_Gs_3` |`MI_Ab_3`|G♯/A♭ octave 3 | +|`MI_A_3` | |A octave 3 | +|`MI_As_3` |`MI_Bb_3`|A♯/B♭ octave 3 | +|`MI_B_3` | |B octave 3 | +|`MI_C_4` | |C octave 4 | +|`MI_Cs_4` |`MI_Db_4`|C♯/D♭ octave 4 | +|`MI_D_4` | |D octave 4 | +|`MI_Ds_4` |`MI_Eb_4`|D♯/E♭ octave 4 | +|`MI_E_4` | |E octave 4 | +|`MI_F_4` | |F octave 4 | +|`MI_Fs_4` |`MI_Gb_4`|F♯/G♭ octave 4 | +|`MI_G_4` | |G octave 4 | +|`MI_Gs_4` |`MI_Ab_4`|G♯/A♭ octave 4 | +|`MI_A_4` | |A octave 4 | +|`MI_As_4` |`MI_Bb_4`|A♯/B♭ octave 4 | +|`MI_B_4` | |B octave 4 | +|`MI_C_5` | |C octave 5 | +|`MI_Cs_5` |`MI_Db_5`|C♯/D♭ octave 5 | +|`MI_D_5` | |D octave 5 | +|`MI_Ds_5` |`MI_Eb_5`|D♯/E♭ octave 5 | +|`MI_E_5` | |E octave 5 | +|`MI_F_5` | |F octave 5 | +|`MI_Fs_5` |`MI_Gb_5`|F♯/G♭ octave 5 | +|`MI_G_5` | |G octave 5 | +|`MI_Gs_5` |`MI_Ab_5`|G♯/A♭ octave 5 | +|`MI_A_5` | |A octave 5 | +|`MI_As_5` |`MI_Bb_5`|A♯/B♭ octave 5 | +|`MI_B_5` | |B octave 5 | +|`MI_OCT_N2` | |Set octave to -2 | +|`MI_OCT_N1` | |Set octave to -1 | +|`MI_OCT_0` | |Set octave to 0 | +|`MI_OCT_1` | |Set octave to 1 | +|`MI_OCT_2` | |Set octave to 2 | +|`MI_OCT_3` | |Set octave to 3 | +|`MI_OCT_4` | |Set octave to 4 | +|`MI_OCT_5` | |Set octave to 5 | +|`MI_OCT_6` | |Set octave to 6 | +|`MI_OCT_7` | |Set octave to 7 | +|`MI_OCTD` | |Move down an octave | +|`MI_OCTU` | |Move up an octave | +|`MI_TRNS_N6`| |Set transposition to -6 semitones| +|`MI_TRNS_N5`| |Set transposition to -5 semitones| +|`MI_TRNS_N4`| |Set transposition to -4 semitones| +|`MI_TRNS_N3`| |Set transposition to -3 semitones| +|`MI_TRNS_N2`| |Set transposition to -2 semitones| +|`MI_TRNS_N1`| |Set transposition to -1 semitone | +|`MI_TRNS_0` | |No transposition | +|`MI_TRNS_1` | |Set transposition to +1 semitone | +|`MI_TRNS_2` | |Set transposition to +2 semitones| +|`MI_TRNS_3` | |Set transposition to +3 semitones| +|`MI_TRNS_4` | |Set transposition to +4 semitones| +|`MI_TRNS_5` | |Set transposition to +5 semitones| +|`MI_TRNS_6` | |Set transposition to +6 semitones| +|`MI_TRNSD` | |Decrease transposition | +|`MI_TRNSU` | |Increase transposition | +|`MI_VEL_0` | |Set velocity to 0 | +|`MI_VEL_1` | |Set velocity to 12 | +|`MI_VEL_2` | |Set velocity to 25 | +|`MI_VEL_3` | |Set velocity to 38 | +|`MI_VEL_4` | |Set velocity to 51 | +|`MI_VEL_5` | |Set velocity to 64 | +|`MI_VEL_6` | |Set velocity to 76 | +|`MI_VEL_7` | |Set velocity to 89 | +|`MI_VEL_8` | |Set velocity to 102 | +|`MI_VEL_9` | |Set velocity to 114 | +|`MI_VEL_10` | |Set velocity to 127 | +|`MI_VELD` | |Decrease velocity | +|`MI_VELU` | |Increase velocity | +|`MI_CH1` | |Set channel to 1 | +|`MI_CH2` | |Set channel to 2 | +|`MI_CH3` | |Set channel to 3 | +|`MI_CH4` | |Set channel to 4 | +|`MI_CH5` | |Set channel to 5 | +|`MI_CH6` | |Set channel to 6 | +|`MI_CH7` | |Set channel to 7 | +|`MI_CH8` | |Set channel to 8 | +|`MI_CH9` | |Set channel to 9 | +|`MI_CH10` | |Set channel to 10 | +|`MI_CH11` | |Set channel to 11 | +|`MI_CH12` | |Set channel to 12 | +|`MI_CH13` | |Set channel to 13 | +|`MI_CH14` | |Set channel to 14 | +|`MI_CH15` | |Set channel to 15 | +|`MI_CH16` | |Set channel to 16 | +|`MI_CHD` | |Decrease channel | +|`MI_CHU` | |Increase channel | +|`MI_ALLOFF` | |Stop all notes | +|`MI_SUS` | |Sustain | +|`MI_PORT` | |Portmento | +|`MI_SOST` | |Sostenuto | +|`MI_SOFT` | |Soft Pedal | +|`MI_LEG` | |Legato | +|`MI_MOD` | |Modulation | +|`MI_MODSD` | |Decrease modulation speed | +|`MI_MODSU` | |Increase modulation speed | +|`MI_BENDD` | |Bend pitch down | +|`MI_BENDU` | |Bend pitch up | ### Background From d54f6119c8f408799247c6b18f2514eb6d90f383 Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 17:53:00 -0400 Subject: [PATCH 08/14] As per @fauxpark's second review Removed background section Commented out QMK Internals section, because while it may be useful, it's autogenerated and thus not of high quality. Kept list of MIDI c files because they haven't changed and aren't likely to change, and if they do change, it would be simple enough for me to update the list, as I plan to make more PRs with more information on the MIDI system. --- docs/feature_midi.md | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index 15f4b40e2054..961d972616c9 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -42,7 +42,7 @@ For an overview of that process look at: [Macros](feature_macros.md) 1. First enable MIDI_ADVANCED 2. use an `extern MidiDevice midi_device;` statement to bring the MIDI device into scope. -3. Send a control code with the `midi_send_cc(*midi_device, channel, number, value)` +3. Send a control code with the `midi_send_cc(*midi_device, channel, number, value)` function For reference of all the possible control code numbers see [MIDI Specification](#midi-specification) @@ -64,7 +64,7 @@ values off = 0-63 #define ON 127 -enum custom_keycodes { MIDI_CC80 = SAFE_RANGE, MIDI_CC81, MIDI_CC82, MIDI_CC83 }; +enum custom_keycodes { MIDI_CC80 = SAFE_RANGE }; bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { @@ -81,7 +81,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = { - {MIDI_CC80, MIDI_CC81, MIDI_CC82, MIDI_CC83}, + {MIDI_CC80, KC_ESC}, // ... }, }; @@ -237,21 +237,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |`MI_BENDD` | |Bend pitch down | |`MI_BENDU` | |Bend pitch up | -### Background - -QMK MIDI is based on TMK MIDI which in turn is based on `avr-midi` - -QMK MIDI is a subset implementation of the MIDI 1.0 specification. - ### References +#### MIDI Specification -#### QMK Internals - - * [Internals/MIDI Device Setup Process](internals_midi_device_setup_process.md) - * [Internals/MIDI Device](internals_midi_device.md) - * [Internals/MIDI Util](internals_midi_util.md) - - + * [MIDI.org](https://www.midi.org/specifications-old/item/table-1-summary-of-midi-message) + * [CMU MIDI Programmer's Reference](https://www.cs.cmu.edu/~music/cmsip/readings/MIDI%20tutorial%20for%20programmers.html) #### QMK C Files * `quantum/process_keycode/process_midi.c` @@ -261,7 +251,10 @@ QMK MIDI is a subset implementation of the MIDI 1.0 specification. * `tmk_core/protocol/qmk_midi.c` * `tmk_core/protocol/midi_device.h` -#### MIDI Specification - - * [MIDI.org](https://www.midi.org/specifications-old/item/table-1-summary-of-midi-message) - * [CMU MIDI Programmer's Reference](https://www.cs.cmu.edu/~music/cmsip/readings/MIDI%20tutorial%20for%20programmers.html) + From 70eda391f076afe755114af9e536bffff649ca43 Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 18:19:08 -0400 Subject: [PATCH 09/14] MIDI Mode Description Co-authored-by: Ryan --- docs/feature_midi.md | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index 961d972616c9..41ae0741fbb0 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -1,38 +1,32 @@ # MIDI -## Enabling MIDI +## Usage -Add the following to the keyboard's rules.mk +First, enable MIDI by adding the following to your `rules.mk`: ```c MIDI_ENABLE = yes ``` -## Using Basic MIDI +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 `MI_OCTU` and `MI_OCTD` will not work. Advanced MIDI allows you to do things like octave shifts, channel changes, velocity changes, modulation, and more. -Enabling Basic MIDI +### Basic MIDI -Add the following to your keyboard's config.h +To enable basic MIDI, add the following to your `config.h`: ```c #define MIDI_BASIC ``` -With basic MIDI you will only be able to send `NOTE_ON` and `NOTE_OFF` Commands to the internal MIDI device, meaning that keycodes like `MI_OCTU` and `MI_OCTD` will not work. +### Advanced MIDI -## Advanced MIDI - -Enabling Advanced MIDI - -Add the following to your keyboard's config.h +To enable advanced MIDI, add the following to your `config.h`: ```c #define MIDI_ADVANCED ``` -With advanced MIDI you can do things like octave shifts, channel changes, velocity changes, and modulation. - -### Sending MIDI Control Codes (MIDI CC) +#### Sending MIDI Control Codes (MIDI CC) If you're aiming to emulate the features of something like a Launchpad or other MIDI controller you'll need to access the internal MIDI device directly. From 9fa9b48f0cd0a09620c0565785e5eebf808fb1b2 Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 18:26:42 -0400 Subject: [PATCH 10/14] Changed rules.mk to makefile (rules.mk) --- docs/feature_midi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index 41ae0741fbb0..2592daa1ef47 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -2,7 +2,7 @@ ## Usage -First, enable MIDI by adding the following to your `rules.mk`: +First, enable MIDI by adding the following to your makefile (`rules.mk`): ```c MIDI_ENABLE = yes From 6f5041689077cc732fbe6e69cf7eca0c733f45a6 Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 18:40:23 -0400 Subject: [PATCH 11/14] Make codetype for codeblock 'makefile' Co-authored-by: Ryan Co-authored-by: Joel Challis --- docs/feature_midi.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index 2592daa1ef47..af2c016f3ddc 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -2,9 +2,9 @@ ## Usage -First, enable MIDI by adding the following to your makefile (`rules.mk`): +First, enable MIDI by adding the following to your `rules.mk`: -```c +```makefile MIDI_ENABLE = yes ``` From 5168f867316934732809cf7b2f77f91117192390 Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 19:36:30 -0400 Subject: [PATCH 12/14] @fauxpark Changes for clarification Co-authored-by: Ryan --- docs/feature_midi.md | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index af2c016f3ddc..312bd65efa50 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -26,17 +26,12 @@ To enable advanced MIDI, add the following to your `config.h`: #define MIDI_ADVANCED ``` -#### Sending MIDI Control Codes (MIDI CC) +#### Sending Control Change (CC) Messages If you're aiming to emulate the features of something like a Launchpad or other MIDI controller you'll need to access the internal MIDI device directly. -When sending MIDI CC you don't get the advantages of a preimplemented keycode and you will need to implement custom keycodes if you want to use them in your keymap directly using the function `process_record_user`. It is the same process as implementing custom keycodes for macros. +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 [custom keycodes](feature_macros.md) if you want to use them in your keymap directly using `process_record_user()`. -For an overview of that process look at: [Macros](feature_macros.md) - -1. First enable MIDI_ADVANCED -2. use an `extern MidiDevice midi_device;` statement to bring the MIDI device into scope. -3. Send a control code with the `midi_send_cc(*midi_device, channel, number, value)` function For reference of all the possible control code numbers see [MIDI Specification](#midi-specification) @@ -46,19 +41,16 @@ For reference of all the possible control code numbers see [MIDI Specification]( extern MidiDevice midi_device; -/* -MIDI CC codes for generic ON/OFF swiches -80,81,82,83 -values off = 0-63 +// MIDI CC codes for generic on/off switches (80, 81, 82, 83) +// Off: 0-63 +// On: 64-127 */ +#define MIDI_CC_OFF 0 +#define MIDI_CC_ON 127 -#define OFF 0 - -/*values on = 64-127*/ - -#define ON 127 - -enum custom_keycodes { MIDI_CC80 = SAFE_RANGE }; +enum custom_keycodes { + MIDI_CC80 = SAFE_RANGE, +}; bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { @@ -74,12 +66,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = { - {MIDI_CC80, KC_ESC}, + LAYOUT( + // ... + MIDI_CC80, // ... - }, + ) }; - ``` ### Keycodes From c0baef534701fd4e8ad88337a42eee19d1a42dee Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sat, 5 Jun 2021 21:32:06 -0400 Subject: [PATCH 13/14] removed extra comment marker from example code --- docs/feature_midi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index 312bd65efa50..0f7f768cda37 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -44,7 +44,7 @@ extern MidiDevice midi_device; // MIDI CC codes for generic on/off switches (80, 81, 82, 83) // Off: 0-63 // On: 64-127 -*/ + #define MIDI_CC_OFF 0 #define MIDI_CC_ON 127 From fc7526e53380f577699d6cadfc5032a66af646ff Mon Sep 17 00:00:00 2001 From: wxyangf <2058629+wxyangf@users.noreply.github.com> Date: Sun, 6 Jun 2021 14:22:25 -0400 Subject: [PATCH 14/14] Add midi struct info Co-authored-by: Ryan --- docs/feature_midi.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/feature_midi.md b/docs/feature_midi.md index 0f7f768cda37..ab29d89db6d7 100644 --- a/docs/feature_midi.md +++ b/docs/feature_midi.md @@ -223,6 +223,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |`MI_BENDD` | |Bend pitch down | |`MI_BENDU` | |Bend pitch up | +### Configuration + +Certain values are stored in the `midi_config` struct. This configuration is not persisted to EEPROM. By default, these values are: + +|Configuration |Value|Comments | +|-------------------|-----|-------------------------| +|Octave |`4` |Corresponds to `MI_OCT_2`| +|Transposition |`0` | | +|Velocity |`127`| | +|Channel |`0` | | +|Modulation Interval|`8` | | + +For the above, the `MI_C` keycode will produce a C3 (note number 48), and so on. + ### References #### MIDI Specification