1
0
Fork 0

add different scales for music mode

This commit is contained in:
Jack Humbert 2016-12-23 20:59:00 -05:00
parent cae269b08b
commit 273faa4d9c

View file

@ -115,7 +115,16 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
return false; return false;
} }
#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)); 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) { if (record->event.pressed) {
play_note(freq, 0xF); play_note(freq, 0xF);
if (music_sequence_recording) { if (music_sequence_recording) {