mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
limit voices by default, add some drums
This commit is contained in:
parent
53ea854462
commit
438a5d685b
@ -36,6 +36,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
#define AUDIO_VOICES
|
||||
|
||||
#define BACKLIGHT_PIN B7
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
|
@ -37,6 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
#define AUDIO_VOICES
|
||||
|
||||
#define BACKLIGHT_PIN B7
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
|
@ -33,6 +33,8 @@ float voice_envelope(float frequency) {
|
||||
polyphony_rate = 0;
|
||||
break;
|
||||
|
||||
#ifdef AUDIO_VOICES
|
||||
|
||||
case something:
|
||||
glissando = false;
|
||||
polyphony_rate = 0;
|
||||
@ -58,36 +60,87 @@ float voice_envelope(float frequency) {
|
||||
case drums:
|
||||
glissando = false;
|
||||
polyphony_rate = 0;
|
||||
note_timbre = 0;
|
||||
switch (envelope_index) {
|
||||
case 0 ... 20:
|
||||
note_timbre = 0.5;
|
||||
default:
|
||||
frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8);
|
||||
break;
|
||||
}
|
||||
// if (frequency < 80.0) {
|
||||
// switch (envelope_index % 4) {
|
||||
// case 0:
|
||||
// frequency = 348.0;
|
||||
// case 1:
|
||||
// frequency = 53.0;
|
||||
// case 2:
|
||||
// frequency = 128.0;
|
||||
// case 3:
|
||||
// frequency = 934.0;
|
||||
// switch (compensated_index) {
|
||||
// case 0 ... 10:
|
||||
// note_timbre = 0.5;
|
||||
// break;
|
||||
// case 11 ... 20:
|
||||
// note_timbre = 0.5 * (21 - compensated_index) / 10;
|
||||
// break;
|
||||
// default:
|
||||
// note_timbre = 0;
|
||||
// break;
|
||||
// }
|
||||
// } else if (frequency < 160.0) {
|
||||
// frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8);
|
||||
|
||||
// } else if (frequency < 320.0) {
|
||||
if (frequency < 80.0) {
|
||||
|
||||
// } else if (frequency < 640.0) {
|
||||
} else if (frequency < 160.0) {
|
||||
|
||||
// } else if (frequency < 1280.0) {
|
||||
// Bass drum: 60 - 100 Hz
|
||||
frequency = (rand() % (int)(40)) + 60;
|
||||
switch (envelope_index) {
|
||||
case 0 ... 10:
|
||||
note_timbre = 0.5;
|
||||
break;
|
||||
case 11 ... 20:
|
||||
note_timbre = 0.5 * (21 - envelope_index) / 10;
|
||||
break;
|
||||
default:
|
||||
note_timbre = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// }
|
||||
} else if (frequency < 320.0) {
|
||||
|
||||
|
||||
// Snare drum: 1 - 2 KHz
|
||||
frequency = (rand() % (int)(1000)) + 1000;
|
||||
switch (envelope_index) {
|
||||
case 0 ... 5:
|
||||
note_timbre = 0.5;
|
||||
break;
|
||||
case 6 ... 20:
|
||||
note_timbre = 0.5 * (21 - envelope_index) / 15;
|
||||
break;
|
||||
default:
|
||||
note_timbre = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (frequency < 640.0) {
|
||||
|
||||
// Closed Hi-hat: 3 - 5 KHz
|
||||
frequency = (rand() % (int)(2000)) + 3000;
|
||||
switch (envelope_index) {
|
||||
case 0 ... 15:
|
||||
note_timbre = 0.5;
|
||||
break;
|
||||
case 16 ... 20:
|
||||
note_timbre = 0.5 * (21 - envelope_index) / 5;
|
||||
break;
|
||||
default:
|
||||
note_timbre = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (frequency < 1280.0) {
|
||||
|
||||
// Open Hi-hat: 3 - 5 KHz
|
||||
frequency = (rand() % (int)(2000)) + 3000;
|
||||
switch (envelope_index) {
|
||||
case 0 ... 35:
|
||||
note_timbre = 0.5;
|
||||
break;
|
||||
case 36 ... 50:
|
||||
note_timbre = 0.5 * (51 - envelope_index) / 15;
|
||||
break;
|
||||
default:
|
||||
note_timbre = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case butts_fader:
|
||||
glissando = true;
|
||||
@ -217,6 +270,8 @@ float voice_envelope(float frequency) {
|
||||
// note_timbre = 0.25;
|
||||
// break;
|
||||
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ float voice_envelope(float frequency);
|
||||
|
||||
typedef enum {
|
||||
default_voice,
|
||||
#ifdef AUDIO_VOICES
|
||||
something,
|
||||
drums,
|
||||
butts_fader,
|
||||
@ -23,6 +24,7 @@ typedef enum {
|
||||
// duty_fourth_down,
|
||||
// duty_third_down,
|
||||
// duty_fifth_third_down,
|
||||
#endif
|
||||
number_of_voices // important that this is last
|
||||
} voice_type;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user