aboutsummaryrefslogtreecommitdiffstats
path: root/quantum/process_keycode/process_music.c
diff options
context:
space:
mode:
authorGravatar Stanley Lai <stanleylai.sg@gmail.com>2017-02-13 12:36:22 -0800
committerGravatar Stanley Lai <stanleylai.sg@gmail.com>2017-02-13 12:36:22 -0800
commita8eba1bddaf55224939a86bfa4d8e1b53e1d82db (patch)
tree906568677ed027a807d5e9c0c1bc1c2ae001f0f6 /quantum/process_keycode/process_music.c
parent53ea854462c0b3b2c3c58a36b714ac02f773c74f (diff)
parentfd2925efbac0d7963f3d267dd5264f08a0a4e9dc (diff)
downloadqmk_firmware-a8eba1bddaf55224939a86bfa4d8e1b53e1d82db.tar.gz
Merge remote-tracking branch 'refs/remotes/qmk/master'
Diffstat (limited to 'quantum/process_keycode/process_music.c')
-rw-r--r--quantum/process_keycode/process_music.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index bae43943e..1e2648bff 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -114,8 +114,18 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
music_sequence_interval+=10;
return false;
}
-
+ #define MUSIC_MODE_GUITAR
+
+ #ifdef MUSIC_MODE_CHROMATIC
+ float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(MATRIX_ROWS - record->event.key.row));
+ #elif defined(MUSIC_MODE_GUITAR)
+ float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(float)(MATRIX_ROWS - record->event.key.row + 7)*5.0/12);
+ #elif defined(MUSIC_MODE_VIOLIN)
+ float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(float)(MATRIX_ROWS - record->event.key.row + 5)*7.0/12);
+ #else
float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + SCALE[record->event.key.col + music_offset])/12.0+(MATRIX_ROWS - record->event.key.row));
+ #endif
+
if (record->event.pressed) {
play_note(freq, 0xF);
if (music_sequence_recording) {