limit voices by default, add some drums

daktil_thumb_popravljen
Jack Humbert 2016-12-20 19:38:22 -05:00
parent 53ea854462
commit 438a5d685b
4 changed files with 82 additions and 21 deletions

View File

@ -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 MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
#define UNUSED_PINS #define UNUSED_PINS
#define AUDIO_VOICES
#define BACKLIGHT_PIN B7 #define BACKLIGHT_PIN B7
/* COL2ROW or ROW2COL */ /* COL2ROW or ROW2COL */

View File

@ -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 MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
#define UNUSED_PINS #define UNUSED_PINS
#define AUDIO_VOICES
#define BACKLIGHT_PIN B7 #define BACKLIGHT_PIN B7
/* COL2ROW or ROW2COL */ /* COL2ROW or ROW2COL */

View File

@ -33,6 +33,8 @@ float voice_envelope(float frequency) {
polyphony_rate = 0; polyphony_rate = 0;
break; break;
#ifdef AUDIO_VOICES
case something: case something:
glissando = false; glissando = false;
polyphony_rate = 0; polyphony_rate = 0;
@ -58,36 +60,87 @@ float voice_envelope(float frequency) {
case drums: case drums:
glissando = false; glissando = false;
polyphony_rate = 0; polyphony_rate = 0;
note_timbre = 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;
// }
// frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8);
if (frequency < 80.0) {
} else if (frequency < 160.0) {
// Bass drum: 60 - 100 Hz
frequency = (rand() % (int)(40)) + 60;
switch (envelope_index) { switch (envelope_index) {
case 0 ... 20: case 0 ... 10:
note_timbre = 0.5; note_timbre = 0.5;
break;
case 11 ... 20:
note_timbre = 0.5 * (21 - envelope_index) / 10;
break;
default: default:
frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8); note_timbre = 0;
break; 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;
// default:
// break;
// }
// } else if (frequency < 160.0) {
// } else if (frequency < 320.0) { } else if (frequency < 320.0) {
// } else if (frequency < 640.0) {
// } else if (frequency < 1280.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; break;
case butts_fader: case butts_fader:
glissando = true; glissando = true;
@ -217,6 +270,8 @@ float voice_envelope(float frequency) {
// note_timbre = 0.25; // note_timbre = 0.25;
// break; // break;
#endif
default: default:
break; break;
} }

View File

@ -11,6 +11,7 @@ float voice_envelope(float frequency);
typedef enum { typedef enum {
default_voice, default_voice,
#ifdef AUDIO_VOICES
something, something,
drums, drums,
butts_fader, butts_fader,
@ -23,6 +24,7 @@ typedef enum {
// duty_fourth_down, // duty_fourth_down,
// duty_third_down, // duty_third_down,
// duty_fifth_third_down, // duty_fifth_third_down,
#endif
number_of_voices // important that this is last number_of_voices // important that this is last
} voice_type; } voice_type;