Initial 16 voices chord added.

Added macro for default MIDI channel
master
Holger Wirtz 6 years ago
parent 6ffb41447b
commit b710d5fd4e
  1. 70
      MIDITESTER.ino

@ -7,6 +7,7 @@
#define LED_DECAY_MS 50 #define LED_DECAY_MS 50
#define MIDI_EVENT_SCHED_MS 100 #define MIDI_EVENT_SCHED_MS 100
#define MIDI_CHANNEL 1
#define TEST_NOTE_MIN MIDI_A0 #define TEST_NOTE_MIN MIDI_A0
#define TEST_NOTE_MAX MIDI_B5 #define TEST_NOTE_MAX MIDI_B5
#define TEST_VEL_MIN 60 #define TEST_VEL_MIN 60
@ -14,6 +15,10 @@
#define TEST_DUR_MIN 200 #define TEST_DUR_MIN 200
#define TEST_DUR_MAX 1500 #define TEST_DUR_MAX 1500
#define TEST_NOTE MIDI_E2
#define TEST_VEL_MIN 60
#define TEST_VEL_MAX 110
#define MASTER_KEY_MIDI MIDI_C7 #define MASTER_KEY_MIDI MIDI_C7
#define MASTER_NUM1 MIDI_C2 #define MASTER_NUM1 MIDI_C2
@ -41,7 +46,7 @@ void setup()
randomSeed(analogRead(A0)); randomSeed(analogRead(A0));
// Bank change 1 /* // Bank change 1
change_bank(1); change_bank(1);
delay(2000); delay(2000);
@ -59,11 +64,46 @@ void setup()
// Sound change 17 // Sound change 17
change_sound(17); change_sound(17);
delay(2000); delay(2000); */
// Volume change 0.1 // Volume change 0.1
change_volume(1); change_volume(1);
delay(5000); delay(2000);
MIDI.sendNoteOn(TEST_NOTE, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 1
MIDI.sendNoteOn(TEST_NOTE + 5, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 2
MIDI.sendNoteOn(TEST_NOTE + 8, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 3
MIDI.sendNoteOn(TEST_NOTE + 12, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 4
MIDI.sendNoteOn(TEST_NOTE + 17, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 5
MIDI.sendNoteOn(TEST_NOTE + 20, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 6
MIDI.sendNoteOn(TEST_NOTE + 24, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 7
MIDI.sendNoteOn(TEST_NOTE + 29, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 8
MIDI.sendNoteOn(TEST_NOTE + 32, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 9
MIDI.sendNoteOn(TEST_NOTE + 37, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 10
MIDI.sendNoteOn(TEST_NOTE + 40, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 11
MIDI.sendNoteOn(TEST_NOTE + 46, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 12
MIDI.sendNoteOn(TEST_NOTE + 49, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 13
MIDI.sendNoteOn(TEST_NOTE + 52, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 14
MIDI.sendNoteOn(TEST_NOTE + 57, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 15
MIDI.sendNoteOn(TEST_NOTE + 60, random(TEST_VEL_MIN, TEST_VEL_MAX), MIDI_CHANNEL); // 16
delay(1000);
MIDI.sendNoteOff(TEST_NOTE, 0, MIDI_CHANNEL); // 1
MIDI.sendNoteOff(TEST_NOTE + 5, 0, MIDI_CHANNEL); // 2
MIDI.sendNoteOff(TEST_NOTE + 8, 0, MIDI_CHANNEL); // 3
MIDI.sendNoteOff(TEST_NOTE + 12, 0, MIDI_CHANNEL); // 4
MIDI.sendNoteOff(TEST_NOTE + 17, 0, MIDI_CHANNEL); // 5
MIDI.sendNoteOff(TEST_NOTE + 20, 0, MIDI_CHANNEL); // 6
MIDI.sendNoteOff(TEST_NOTE + 24, 0, MIDI_CHANNEL); // 7
MIDI.sendNoteOff(TEST_NOTE + 29, 0, MIDI_CHANNEL); // 8
MIDI.sendNoteOff(TEST_NOTE + 32, 0, MIDI_CHANNEL); // 9
MIDI.sendNoteOff(TEST_NOTE + 37, 0, MIDI_CHANNEL); // 10
MIDI.sendNoteOff(TEST_NOTE + 40, 0, MIDI_CHANNEL); // 11
MIDI.sendNoteOff(TEST_NOTE + 46, 0, MIDI_CHANNEL); // 12
MIDI.sendNoteOff(TEST_NOTE + 49, 0, MIDI_CHANNEL); // 13
MIDI.sendNoteOff(TEST_NOTE + 52, 0, MIDI_CHANNEL); // 14
MIDI.sendNoteOff(TEST_NOTE + 57, 0, MIDI_CHANNEL); // 15
MIDI.sendNoteOff(TEST_NOTE + 60, 0, MIDI_CHANNEL); // 16
delay(2000);
} }
void loop() void loop()
@ -101,39 +141,39 @@ void change_sound(uint8_t sound)
{ {
uint8_t sound_key = base_c_num_key(sound); uint8_t sound_key = base_c_num_key(sound);
MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, 1); MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, MIDI_CHANNEL);
delay(500); delay(500);
MIDI.sendNoteOn(sound_key, 66, 1); MIDI.sendNoteOn(sound_key, 66, MIDI_CHANNEL);
delay(500); delay(500);
MIDI.sendNoteOff(sound_key, 0, 1); MIDI.sendNoteOff(sound_key, 0, MIDI_CHANNEL);
delay(500); delay(500);
MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, 1); MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, MIDI_CHANNEL);
} }
void change_volume(uint8_t volume) void change_volume(uint8_t volume)
{ {
uint8_t volume_key = base_c_num_key(volume * -1); uint8_t volume_key = base_c_num_key(volume * -1);
MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, 1); MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, MIDI_CHANNEL);
delay(500); delay(500);
MIDI.sendNoteOn(volume_key, 66, 1); MIDI.sendNoteOn(volume_key, 66, MIDI_CHANNEL);
delay(500); delay(500);
MIDI.sendNoteOff(volume_key, 0, 1); MIDI.sendNoteOff(volume_key, 0, MIDI_CHANNEL);
delay(500); delay(500);
MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, 1); MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, MIDI_CHANNEL);
} }
void change_bank(uint8_t bank) void change_bank(uint8_t bank)
{ {
uint8_t bank_key = base_c_num_key(bank * -1) + 24; uint8_t bank_key = base_c_num_key(bank * -1) + 24;
MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, 1); MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, MIDI_CHANNEL);
delay(500); delay(500);
MIDI.sendNoteOn(bank_key, 66, 1); MIDI.sendNoteOn(bank_key, 66, MIDI_CHANNEL);
delay(500); delay(500);
MIDI.sendNoteOff(bank_key, 0, 1); MIDI.sendNoteOff(bank_key, 0, MIDI_CHANNEL);
delay(500); delay(500);
MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, 1); MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, MIDI_CHANNEL);
} }
uint8_t base_c_num_key(int8_t number) uint8_t base_c_num_key(int8_t number)

Loading…
Cancel
Save