Skip to content

Commit

Permalink
adds option for alt pitch standards
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhumbert committed Jul 24, 2017
1 parent a543ad4 commit cefc09a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/modding_your_keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ By default, `MUSIC_MASK` is set to `keycode < 0xFF` which means keycodes less th

Which will capture all keycodes - be careful, this will get you stuck in music mode until you restart your keyboard!

The pitch standard (`PITCH_STANDARD_A`) is 440.0f by default - to change this, add something like this to your `config.h`:

#define PITCH_STANDARD_A 432.0f

## MIDI functionalty

This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile.
Expand Down
6 changes: 5 additions & 1 deletion quantum/process_keycode/process_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
#endif
float voice_change_song[][2] = VOICE_CHANGE_SONG;

#ifndef PITCH_STANDARD_A
#define PITCH_STANDARD_A 440.0f
#endif

static float compute_freq_for_midi_note(uint8_t note)
{
// https://en.wikipedia.org/wiki/MIDI_tuning_standard
return pow(2.0, (note - 69) / 12.0) * 440.0f;
return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A;
}

bool process_audio(uint16_t keycode, keyrecord_t *record) {
Expand Down

0 comments on commit cefc09a

Please sign in to comment.