Skip to content

Instantly share code, notes, and snippets.

@catskull
Created April 22, 2020 22:15
Show Gist options
  • Save catskull/166a304accc2815eb29a90df0f2df552 to your computer and use it in GitHub Desktop.
Save catskull/166a304accc2815eb29a90df0f2df552 to your computer and use it in GitHub Desktop.
SEGA MEGA DRIVE PORT 2 PIN 1 <--- ARDUINO ANALOG PIN 0 = teensy 0
SEGA MEGA DRIVE PORT 2 PIN 2 <--- ARDUINO ANALOG PIN 1 = teensy 1
SEGA MEGA DRIVE PORT 2 PIN 3 <--- ARDUINO ANALOG PIN 2 = teensy 2
SEGA MEGA DRIVE PORT 2 PIN 4 <--- ARDUINO ANALOG PIN 3 = teensy 3
SEGA MEGA DRIVE PORT 2 PIN 5 ---> ARDUINO 5V = teensy NA
SEGA MEGA DRIVE PORT 2 PIN 6 <--- ARDUINO DIGITAL PIN 4 = teensy 6 = nb
SEGA MEGA DRIVE PORT 2 PIN 7 <--- ARDUINO DIGITAL PIN 2 = teensy 5 = wr
SEGA MEGA DRIVE PORT 2 PIN 8 <--> ARDUINO 0V = teensy ground
SEGA MEGA DRIVE PORT 2 PIN 9 <--- ARDUINO DIGITAL PIN 3 = teensy 4 = ad
*/
// Arduino Software
#include <math.h>
#include <avr/pgmspace.h>
/* Protocol and Pin Values */
int dT = 20; // delay time
int NB = 23;
int AD = 21;
int WR = 22;
int bendAmount = 2;
byte dataIn; // general working byte for serially-received data
byte data;
byte page_number = 0;
/* Noise 1/2 Channel */
byte noise_flag = 0;
byte noise_data = 0;
byte noise_velocity = 0;
byte save_speed = 1;
byte tri_flag = 1;
/* MIDI Values */
byte channel;
byte pitch;
byte velocity;
byte ccnumber;
byte ccvalue;
byte ccvalue2;
byte bendLSB;
byte bendMSB;
byte rstat;
byte byte_counter;
/* Polyphonic Handler Values */
byte polyFlag = 0;
byte polyBusy[6];
byte pitchTracking[6];
/* Pitch Values */
byte octDiv = 12;
byte pitchOffset = 64;
int pitchInt;
double pitchDouble;
double constantDouble = 6.711;
int freqLSB;
byte reg22 = 0;
int flag_previous = 0; // keeps track of the previus MIDI byte type received
byte bend[] = {
64, 64, 64, 64, 64, 64,
};
// SAMPLES
int SPB_flag = 0;
int SPB_sound = 0;
int SPB_counter = 0;
int SPB_speed = 0;
int SPB_tick = 1;
int sample_on = 0; // turn sample mode on
byte SPB_volume;
byte overSamp = 1;
int SPB_max = 400;
int sample_length_list[] = {
1200,
600,
250,
1200,
700,
700,
450,
1200,
1200,
300,
1000,
1200,
1500,
1500,
1000,
1000,
4000
};
// kick 1 1200
const char kick[] PROGMEM = {
138, 127, 152, 158, 177, 166, 216, 161, 254, 254, 254, 254, 254, 254, 190, 249, 48, 121, 0, 0, 0, 0, 0, 0, 0, 0, 44, 2, 158, 105, 250, 212, 254, 254, 254, 254, 254, 254, 203, 236, 93, 157, 0, 33, 0, 0, 0, 0, 0, 0, 12, 0, 80, 41, 174, 128, 254, 217, 254, 254, 254, 254, 254, 254, 236, 254, 167, 206, 79, 123, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 38, 14, 104, 65, 185, 149, 254, 222, 254, 254, 254, 254, 254, 254, 254, 254, 216, 240, 154, 193, 70, 112, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 20, 1, 60, 42, 115, 80, 183, 150, 242, 209, 254, 254, 254, 254, 254, 254, 254, 254, 250, 254, 206, 229, 158, 185, 94, 125, 28, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 2, 55, 37, 89, 71, 137, 110, 188, 163, 232, 212, 254, 252, 254, 254, 254, 254, 254, 254, 254, 254, 234, 252, 194, 213, 160, 178, 118, 141, 62, 90, 16, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 2, 41, 27, 70, 56, 97, 83, 129, 111, 171, 149, 209, 191, 241, 226, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 237, 249, 214, 226, 182, 197, 154, 168, 126, 141, 88, 108, 45, 66, 12, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 32, 21, 52, 42, 77, 65, 98, 88, 119, 108, 146, 132, 179, 163, 208, 194, 232, 220, 251, 242, 254, 254, 254, 254, 254, 254, 254, 254, 245, 254, 225, 235, 206, 215, 188, 198, 164, 175, 143, 153, 123, 133, 99, 112, 67, 84, 36, 51, 13, 24, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 28, 18, 46, 37, 63, 55, 81, 71, 99, 90, 245, 239, 233, 225, 217, 208, 198, 187, 175, 163, 151, 140, 130, 122, 114, 107, 254, 251, 254, 254, 254, 254, 253, 254, 236, 245, 218, 227, 201, 209, 187, 194, 175, 181, 39, 49, 61, 73, 85, 95, 104, 112, 119, 126, 30, 133, 141, 149, 157, 167, 18, 23, 10, 13, 6, 8, 5, 6, 7, 6, 12, 9, 23, 16, 38, 30, 54, 46, 141, 135, 129, 124, 119, 113, 108, 101, 94, 86, 155, 147, 81, 75, 69, 62, 172, 164, 188, 181, 201, 195, 212, 207, 220, 216, 228, 224, 234, 231, 237, 236, 234, 235, 160, 164, 168, 173, 178, 183, 189, 195, 202, 208, 150, 156, 214, 221, 226, 230, 137, 143, 126, 132, 117, 122, 107, 112, 95, 102, 80, 88, 63, 72, 50, 56, 40, 44, 34, 37, 31, 32, 30, 30, 31, 30, 33, 32, 37, 35, 44, 40, 56, 50, 68, 62, 80, 74, 90, 85, 98, 94, 107, 102, 117, 112, 124, 121, 131, 128, 139, 135, 148, 143, 160, 153, 171, 165, 182, 177, 190, 186, 197, 194, 203, 200, 208, 205, 211, 210, 211, 211, 210, 211, 207, 208, 200, 204, 192, 196, 182, 187, 169, 173, 178, 165, 158, 162, 152, 155, 147, 149, 138, 143, 129, 133, 122, 126, 115, 119, 109, 112, 100, 105, 90, 95, 77, 84, 66, 71, 58, 62, 53, 55, 50, 51, 49, 49, 49, 49, 51, 50, 53, 52, 57, 55, 63, 59, 71, 66, 80, 76, 89, 85, 97, 93, 104, 100, 109, 106, 117, 113, 123, 120, 129, 126, 134, 131, 139, 136, 146, 142, 154, 150, 163, 159, 171, 167, 177, 174, 183, 180, 187, 185, 191, 189, 193, 192, 193, 193, 192, 192, 191, 192, 189, 190, 184, 187, 167, 171, 174, 178, 181, 164, 157, 161, 152, 155, 147, 150, 143, 145, 139, 141, 131, 135, 125, 128, 120, 123, 115, 118, 110, 113, 104, 107, 96, 100, 86, 91, 77, 81, 71, 74, 67, 69, 65, 66, 64, 64, 64, 64, 66, 65, 67, 66, 70, 68, 73, 71, 79, 76, 86, 82, 93, 89, 100, 96, 105, 103, 110, 108, 114, 112, 120, 118, 125, 123, 127, 129, 133, 131, 137, 135, 142, 139, 148, 144, 155, 151, 161, 158, 166, 164, 170, 168, 174, 172, 177, 176, 180, 179, 180, 180, 179, 179, 179, 179, 178, 178, 176, 177, 172, 175, 167, 170, 162, 164, 156, 159, 151, 154, 147, 149, 143, 145, 140, 142, 137, 139, 131, 134, 126, 129, 122, 124, 118, 120, 114, 116, 110, 112, 104, 107, 97, 101, 90, 94, 84, 87, 80, 82, 77, 78, 76, 77, 76, 76, 76, 76, 78, 77, 79, 78, 81, 80, 84, 83, 89, 86, 95, 92, 100, 98, 106, 103, 110, 108, 114, 112, 117, 116, 122, 120, 126, 124, 129, 127, 132, 130, 135, 133, 138, 136, 143, 140, 148, 146, 153, 151, 158, 156, 161, 160, 165, 163, 167, 166, 169, 168, 170, 170, 170, 170, 169, 169, 169, 169, 168, 168, 165, 167, 162, 164, 158, 160, 153, 155, 149, 151, 145, 147, 142, 143, 139, 140, 137, 138, 134, 136, 129, 131, 125, 127, 122, 123, 119, 120, 116, 117, 112, 114, 107, 110, 101, 104, 95, 98, 91, 93, 88, 89, 86, 87, 85, 85, 85, 85, 86, 85, 87, 86, 88, 87, 90, 89, 93, 91, 97, 94, 101, 99, 106, 104, 110, 108, 114, 112, 117, 115, 119, 118, 123, 121, 126, 125, 129, 127, 131, 130, 133, 132, 136, 135, 140, 138, 144, 142, 148, 146, 152, 150, 155, 153, 157, 156, 159, 158, 161, 160, 162, 162, 162, 162, 162, 162, 161, 161, 161, 161, 159, 160, 156, 158, 153, 155, 149, 151, 146, 147, 143, 144, 140, 141, 137, 138, 135, 136, 134, 134, 130, 131, 126, 128, 123, 125, 121, 122, 118, 120, 115, 117, 112, 114, 107, 110, 102, 105, 98, 100, 95, 97, 93, 94, 93, 93, 93, 93, 93, 93, 94, 93, 95, 94, 96, 95, 98, 97, 101, 99, 105, 103, 115, 114, 112, 110, 108, 106, 118, 117, 120, 119, 123, 121, 125, 124, 128, 126, 130, 129, 131, 130, 134, 132, 136, 135, 140, 138, 143, 141, 146, 145, 149, 148, 151, 150, 156, 155, 155, 154, 153, 152, 155, 156, 155, 155, 155, 155, 155, 155, 154, 154, 152, 153, 149, 151, 146, 148, 143, 145, 141, 142, 138, 139, 136, 137, 134, 135, 133, 134, 125, 126, 127, 129, 130, 132, 123, 124, 121, 122, 118, 120, 116, 117, 112, 114, 108, 110, 104, 106, 102, 103, 100, 101, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 106, 105, 104, 103, 102, 101, 101, 107, 110, 109, 114, 112, 116, 115, 119, 118, 121, 120, 122, 122, 125, 124, 127, 126, 128, 128, 130, 129, 132, 131, 133, 132, 136, 135, 140, 139, 137, 141, 144, 143, 146, 145, 147, 147, 149, 148, 150, 149, 150, 150, 150, 150, 150, 150, 150, 150, 149, 150, 148, 149, 146, 147, 144, 145, 142, 143, 139, 140, 136, 137, 138, 135, 134, 134, 132, 133, 131, 132, 128, 130, 126, 127, 124, 125, 123, 123, 121, 122, 119, 120, 116, 118, 113, 115, 110, 111, 107, 108, 106
};
// snare 1 600
const char snare[] PROGMEM = {
127, 209, 127, 127, 83, 134, 130, 183, 88, 135, 71, 118, 80, 153, 240, 254, 235, 254, 254, 254, 254, 16, 0, 0, 119, 0, 173, 248, 254, 244, 254, 212, 160, 188, 142, 124, 127, 103, 30, 0, 0, 17, 0, 0, 35, 117, 254, 211, 254, 254, 251, 254, 254, 0, 75, 171, 0, 0, 0, 0, 34, 93, 171, 166, 254, 226, 254, 254, 187, 100, 161, 150, 47, 96, 78, 80, 95, 0, 28, 0, 113, 161, 166, 103, 115, 139, 141, 236, 227, 192, 221, 197, 126, 175, 150, 21, 0, 0, 0, 0, 0, 17, 111, 53, 128, 222, 188, 186, 254, 253, 199, 236, 81, 237, 97, 129, 81, 42, 58, 37, 55, 91, 28, 51, 109, 128, 173, 154, 199, 175, 103, 136, 199, 179, 159, 133, 202, 201, 130, 53, 11, 18, 34, 17, 44, 52, 45, 5, 91, 101, 202, 215, 232, 247, 249, 123, 175, 235, 136, 143, 117, 109, 15, 146, 35, 67, 77, 94, 89, 107, 101, 110, 157, 126, 170, 204, 208, 188, 138, 225, 163, 173, 208, 167, 148, 127, 50, 30, 0, 47, 36, 84, 45, 23, 42, 179, 54, 123, 168, 196, 186, 223, 163, 220, 199, 213, 99, 153, 254, 145, 220, 131, 114, 163, 86, 82, 62, 123, 150, 120, 180, 138, 204, 103, 0, 45, 75, 142, 67, 96, 128, 129, 122, 50, 112, 30, 64, 53, 90, 32, 152, 131, 57, 135, 183, 60, 97, 180, 218, 98, 159, 192, 143, 202, 113, 189, 117, 159, 87, 100, 69, 96, 87, 128, 109, 145, 177, 86, 182, 115, 196, 193, 120, 140, 222, 111, 101, 154, 156, 97, 121, 108, 105, 120, 80, 115, 106, 141, 113, 133, 127, 153, 102, 141, 190, 122, 169, 178, 177, 127, 124, 136, 148, 115, 139, 82, 71, 136, 69, 146, 69, 109, 94, 71, 175, 136, 186, 149, 199, 159, 171, 209, 91, 133, 152, 120, 96, 71, 121, 97, 93, 108, 94, 124, 136, 103, 102, 107, 170, 119, 194, 82, 174, 110, 175, 140, 152, 168, 138, 91, 143, 93, 146, 119, 74, 196, 87, 128, 133, 167, 76, 51, 116, 157, 95, 186, 150, 190, 173, 104, 67, 157, 187, 114, 109, 98, 146, 90, 80, 87, 98, 195, 100, 76, 108, 139, 145, 164, 164, 172, 138, 148, 148, 109, 89, 118, 78, 185, 95, 45, 126, 100, 149, 94, 94, 130, 93, 115, 136, 75, 143, 71, 189, 177, 108, 121, 127, 73, 142, 92, 168, 130, 64, 79, 144, 34, 115, 125, 118, 80, 93, 103, 142, 118, 129, 94, 164, 166, 98, 132, 160, 118, 114, 104, 138, 31, 118, 100, 97, 130, 107, 188, 133, 99, 159, 102, 106, 131, 128, 155, 139, 173, 166, 173, 149, 101, 90, 108, 119, 161, 145, 115, 104, 119, 149, 91, 126, 151, 149, 168, 160, 130, 118, 163, 154, 193, 130, 134, 95, 97, 131, 131, 102, 141, 138, 84, 77, 70, 122, 141, 134, 83, 147, 126, 71, 142, 128, 203, 92, 193, 211, 127, 138, 106, 141, 122, 170, 97, 110, 86, 153, 123, 198, 66, 115, 135, 185, 191, 108, 112, 58, 114, 154, 213, 131, 84, 137, 107, 113, 125, 88, 94, 147, 86, 128, 50, 113, 160, 129, 129, 70, 157, 98, 136, 91, 92, 128, 129, 90, 102, 96, 151, 155, 155, 155, 152, 140, 135, 110, 148, 139, 66, 127, 117, 122, 192, 147, 168, 110, 136, 153, 149, 100, 130, 123, 115, 134, 145, 127, 161, 88, 106, 52, 145, 105, 81, 164, 160, 109, 125, 148
};
// hat c 1 250
const char hat_closed[] PROGMEM = {
128, 127, 191, 132, 254, 30, 0, 119, 0, 101, 0, 0, 109, 236, 0, 150, 0, 13, 244, 178, 38, 148, 254, 254, 212, 232, 139, 254, 254, 0, 106, 110, 254, 0, 26, 99, 46, 0, 254, 117, 185, 151, 120, 225, 254, 136, 0, 49, 204, 69, 57, 135, 195, 233, 151, 150, 131, 247, 131, 228, 98, 128, 107, 0, 30, 0, 172, 114, 79, 118, 203, 114, 212, 139, 47, 142, 216, 192, 4, 180, 207, 108, 110, 44, 129, 84, 225, 113, 125, 213, 46, 183, 115, 218, 53, 214, 64, 102, 65, 147, 37, 77, 131, 86, 207, 109, 79, 117, 83, 199, 166, 171, 162, 131, 107, 144, 109, 165, 109, 20, 188, 119, 164, 120, 185, 128, 139, 109, 164, 90, 81, 88, 145, 151, 135, 153, 177, 108, 78, 190, 140, 76, 78, 126, 136, 142, 138, 135, 100, 85, 84, 49, 142, 113, 189, 135, 122, 144, 141, 106, 76, 72, 148, 156, 86, 141, 117, 131, 117, 130, 58, 132, 126, 147, 123, 108, 116, 149, 147, 142, 148, 144, 124, 141, 137, 133, 116, 152, 113, 142, 142, 112, 137, 95, 135, 116, 113, 121, 163, 138, 106, 136, 130, 114, 141, 150, 142, 153, 125, 139, 144, 129, 106, 124, 104, 125, 139, 128, 117, 140, 113, 107, 127, 137, 134, 97, 116, 152, 132, 142, 125, 127, 135, 122, 140, 111, 138, 119, 134, 150, 138, 132, 120, 134, 131, 128, 128, 131, 137, 143, 129
};
// hat o 1 1200
const char hat_open[] PROGMEM = {
126, 127, 229, 0, 93, 80, 77, 115, 8, 60, 124, 140, 80, 110, 154, 254, 98, 120, 153, 73, 129, 0, 104, 244, 81, 130, 254, 139, 128, 254, 142, 208, 165, 78, 108, 105, 94, 0, 156, 239, 119, 92, 0, 254, 171, 176, 4, 33, 254, 122, 61, 158, 254, 192, 137, 159, 141, 0, 100, 168, 105, 87, 37, 156, 145, 189, 215, 122, 98, 90, 34, 215, 148, 0, 254, 119, 132, 183, 126, 32, 146, 36, 86, 138, 143, 143, 149, 118, 141, 0, 165, 254, 168, 129, 152, 254, 177, 139, 158, 239, 120, 103, 64, 189, 158, 89, 91, 0, 94, 159, 218, 97, 0, 133, 0, 209, 85, 245, 149, 70, 125, 203, 126, 121, 98, 101, 45, 0, 0, 97, 157, 0, 74, 50, 110, 163, 185, 9, 103, 177, 0, 252, 87, 244, 254, 81, 0, 52, 227, 252, 55, 114, 176, 136, 75, 103, 0, 232, 190, 114, 47, 15, 254, 179, 122, 109, 209, 195, 210, 132, 153, 123, 119, 71, 131, 205, 187, 132, 194, 50, 195, 85, 82, 160, 239, 128, 20, 120, 213, 31, 153, 24, 140, 254, 181, 186, 103, 83, 184, 120, 144, 83, 37, 142, 83, 126, 106, 71, 97, 170, 65, 192, 88, 125, 166, 143, 106, 51, 214, 128, 29, 0, 158, 44, 183, 121, 105, 66, 147, 192, 190, 184, 169, 225, 110, 222, 178, 199, 58, 159, 204, 112, 167, 85, 131, 158, 203, 200, 152, 95, 121, 202, 113, 145, 132, 147, 39, 179, 168, 194, 44, 137, 150, 75, 162, 37, 105, 171, 155, 88, 141, 74, 109, 151, 115, 133, 66, 97, 51, 151, 77, 127, 86, 140, 119, 132, 161, 197, 161, 105, 96, 114, 125, 135, 154, 129, 108, 135, 59, 111, 128, 80, 94, 156, 171, 160, 81, 126, 152, 157, 34, 196, 119, 151, 119, 47, 130, 134, 186, 115, 140, 161, 184, 112, 155, 134, 149, 159, 115, 118, 138, 109, 160, 104, 116, 133, 105, 127, 133, 147, 141, 136, 144, 130, 141, 132, 179, 107, 126, 109, 127, 115, 109, 48, 94, 131, 138, 105, 162, 193, 101, 129, 103, 139, 202, 115, 90, 104, 172, 69, 101, 130, 144, 158, 130, 139, 113, 143, 144, 101, 117, 133, 133, 186, 125, 147, 165, 174, 140, 85, 127, 116, 190, 60, 97, 95, 128, 129, 115, 148, 168, 195, 140, 135, 127, 160, 132, 117, 87, 145, 126, 122, 101, 117, 126, 94, 123, 131, 118, 145, 122, 108, 131, 141, 150, 136, 108, 155, 137, 139, 122, 162, 147, 137, 105, 109, 100, 161, 152, 118, 77, 109, 139, 119, 146, 107, 76, 130, 105, 136, 101, 138, 125, 127, 148, 123, 113, 128, 143, 106, 128, 121, 148, 114, 147, 129, 129, 125, 146, 125, 149, 122, 135, 143, 142, 155, 127, 88, 176, 130, 126, 137, 124, 110, 123, 127, 93, 128, 91, 113, 132, 121, 111, 125, 136, 111, 157, 130, 129, 116, 112, 141, 100, 96, 109, 97, 149, 141, 141, 154, 117, 121, 128, 127, 116, 145, 116, 137, 157, 130, 133, 139, 129, 113, 138, 127, 126, 157, 94, 139, 126, 129, 130, 128, 140, 84, 134, 148, 134, 102, 108, 127, 148, 112, 107, 122, 135, 134, 125, 101, 126, 158, 130, 153, 113, 133, 130, 116, 131, 108, 112, 124, 122, 113, 133, 117, 130, 123, 147, 128, 101, 132, 111, 129, 118, 121, 91, 128, 128, 123, 126, 116, 143, 138, 130, 113, 143, 141, 123, 111, 93, 156, 105, 149, 123, 135, 138, 131, 129, 131, 144, 104, 124, 113, 123, 130, 139, 134, 133, 122, 126, 140, 153, 143, 119, 108, 128, 121, 132, 123, 138, 139, 130, 132, 127, 139, 132, 118, 136, 126, 124, 140, 115, 106, 114, 103, 116, 125, 120, 110, 149, 125, 112, 145, 143, 142, 122, 109, 120, 112, 105, 142, 143, 128, 142, 138, 105, 126, 122, 109, 129, 121, 136, 132, 118, 140, 147, 114, 137, 129, 112, 145, 114, 98, 132, 135, 133, 130, 151, 135, 145, 140, 115, 120, 130, 116, 124, 117, 129, 138, 109, 130, 125, 128, 137, 133, 88, 120, 143, 127, 130, 140, 151, 123, 147, 121, 118, 126, 131, 111, 123, 130, 153, 119, 136, 127, 131, 153, 127, 132, 139, 132, 110, 141, 117, 113, 130, 111, 124, 124, 137, 107, 145, 127, 105, 117, 125, 128, 125, 133, 110, 109, 137, 135, 128, 122, 133, 105, 141, 116, 139, 122, 128, 132, 143, 131, 110, 111, 119, 120, 122, 112, 115, 131, 116, 123, 142, 128, 115, 128, 139, 129, 134, 123, 122, 134, 137, 124, 129, 127, 129, 125, 122, 131, 132, 125, 130, 113, 133, 145, 132, 134, 125, 137, 127, 129, 111, 125, 111, 118, 136, 134, 134, 129, 110, 125, 130, 126, 131, 110, 137, 123, 142, 127, 126, 130, 129, 125, 130, 136, 113, 120, 127, 136, 132, 122, 130, 124, 126, 133, 137, 127, 131, 133, 129, 135, 125, 102, 124, 126, 129, 119, 107, 122, 128, 130, 131, 118, 129, 128, 126, 130, 137, 128, 125, 127, 116, 139, 128, 122, 121, 125, 129, 128, 123, 138, 121, 128, 126, 116, 134, 128, 125, 123, 124, 126, 135, 123, 122, 127, 127, 105, 114, 131, 135, 132, 127, 130, 139, 136, 113, 125, 133, 135, 127, 142, 120, 123, 129, 120, 130, 128, 137, 137, 121, 130, 126, 132, 124, 127, 117, 127, 113, 124, 132, 127, 123, 118, 122, 136, 107, 127, 126, 121, 127, 121, 130, 140, 122, 121, 119, 132, 133, 131, 126, 128, 140, 127, 120, 131, 127, 135, 112, 125, 129, 128, 129, 114, 131, 138, 129, 131, 128, 123, 127, 126, 119, 131, 135, 130, 118, 130, 128, 133, 136, 118, 121, 131, 135, 126, 134, 137, 122, 118, 129, 124, 118, 114, 129, 120, 135, 129, 133, 131, 131, 130, 127, 127, 134, 128, 127, 131, 128, 125, 123, 117, 129, 127, 131, 125, 135, 131, 136, 121, 127, 129, 123, 121, 119, 109, 123, 127, 129, 129, 131, 137, 126, 123, 116, 123, 130, 133, 126, 123, 129, 127, 125, 122, 116, 128, 131, 126, 123, 127, 119, 136, 132, 131, 127, 122, 132, 128, 128, 125, 121, 133, 129, 127, 127, 132, 128, 122, 127, 127, 123, 120, 126, 139, 132, 125, 124, 133, 129, 125, 123, 130, 126, 119, 129, 122, 128, 133, 125, 124, 119, 125, 125, 117, 115, 127, 135, 132, 124, 135, 126, 124, 126, 123, 119, 123, 132, 119, 120, 128, 129, 131, 127, 128, 127, 132, 123, 124, 127, 131, 130, 122, 126, 128, 129, 121, 127, 128, 132, 128, 135, 127, 128, 125, 122, 113, 127, 124, 127, 129, 126, 131, 129, 123, 121, 131, 126, 125, 128, 119, 128, 130, 132, 127, 130, 127, 128, 127, 129, 116, 125, 127, 129, 129, 124, 125, 121, 125, 127, 131, 127, 125, 126, 126, 126, 132, 127, 125, 124, 127, 129, 125, 132, 128, 127, 130, 127, 129, 123, 127, 130, 123, 126, 126, 125, 128, 130, 128, 124, 130, 126, 124, 124, 129, 130, 128, 123, 125, 121, 130, 123, 123, 131, 126, 126, 130, 131
};
// tom lo 1 700
const char tom_lo[] PROGMEM = {
127, 209, 130, 127, 225, 176, 254, 245, 234, 217, 193, 205, 165, 170, 164, 174, 203, 176, 254, 254, 238, 250, 185, 214, 143, 155, 124, 135, 124, 133, 124, 119, 138, 132, 142, 130, 156, 146, 201, 176, 250, 236, 245, 245, 195, 211, 155, 197, 63, 123, 6, 36, 11, 10, 0, 0, 0, 0, 0, 0, 4, 0, 17, 0, 35, 32, 60, 48, 66, 71, 84, 78, 93, 92, 146, 121, 191, 185, 179, 193, 207, 191, 233, 217, 254, 254, 254, 254, 216, 238, 181, 203, 147, 162, 118, 121, 132, 96, 96, 101, 98, 99, 95, 97, 100, 100, 105, 103, 99, 102, 112, 99, 142, 128, 141, 145, 116, 139, 60, 83, 61, 60, 59, 55, 51, 59, 51, 42, 69, 66, 62, 73, 75, 70, 91, 82, 101, 88, 119, 112, 130, 122, 136, 136, 141, 140, 149, 146, 164, 153, 201, 176, 250, 227, 254, 254, 254, 254, 254, 254, 254, 254, 228, 245, 207, 216, 173, 191, 152, 167, 127, 139, 113, 119, 97, 108, 91, 92, 90, 90, 83, 85, 72, 75, 58, 66, 43, 52, 33, 33, 32, 34, 43, 34, 52, 52, 44, 49, 46, 43, 59, 50, 64, 58, 74, 70, 82, 77, 82, 86, 86, 85, 83, 87, 88, 86, 96, 92, 108, 102, 118, 113, 127, 123, 154, 139, 185, 168, 209, 196, 232, 223, 254, 247, 250, 254, 241, 247, 226, 234, 211, 218, 203, 205, 194, 201, 184, 191, 175, 181, 173, 175, 157, 164, 145, 150, 130, 137, 120, 124, 103, 112, 90, 94, 74, 81, 61, 66, 55, 58, 53, 52, 52, 52, 64, 55, 77, 70, 93, 86, 97, 92, 105, 99, 105, 103, 109, 106, 107, 107, 108, 104, 110, 110, 106, 109, 104, 104, 102, 102, 106, 101, 123, 114, 144, 134, 166, 155, 182, 172, 193, 188, 190, 192, 177, 184, 170, 172, 166, 167, 164, 165, 158, 160, 150, 153, 140, 146, 133, 138, 125, 129, 124, 124, 117, 122, 111, 113, 100, 108, 87, 94, 71, 82, 63, 66, 56, 58, 54, 55, 54, 54, 59, 56, 73, 66, 62, 89, 81, 98, 122, 114, 106, 130, 142, 136, 150, 147, 159, 156, 152, 161, 156, 156, 157, 158, 160, 161, 161, 162, 161, 157, 164, 159, 184, 177, 170, 190, 201, 194, 210, 206, 208, 211, 197, 203, 183, 190, 172, 178, 158, 162, 166, 153, 147, 151, 128, 131, 133, 137, 138, 141, 144, 118, 123, 115, 109, 112, 98, 104, 86, 93, 73, 80, 58, 65, 45, 51, 38, 41, 33, 35, 32, 32, 37, 34, 46, 40, 59, 52, 92, 88, 83, 77, 72, 65, 100, 96, 107, 104, 114, 111, 121, 117, 127, 124, 131, 129, 135, 132, 137, 135, 143, 139, 154, 147, 168, 162, 181, 175, 192, 188, 200, 196, 182, 186, 190, 195, 199, 203, 203, 180, 176, 178, 172, 174, 169, 170, 171, 167, 162, 164, 160, 161, 157, 159, 155, 154, 147, 150, 140, 145, 132, 136, 119, 125, 105, 112, 80, 82, 87, 92, 97, 77, 74, 75, 71, 73, 73, 72, 79, 76, 86, 82, 93, 90, 99, 96, 101, 103, 107, 105, 110, 109, 113, 111, 117, 116, 115, 118, 119, 118, 122, 121, 120, 120, 119, 125, 135, 129, 145, 140, 155, 150, 164, 160, 172, 171, 167, 170, 164, 167, 159, 156, 148, 152, 143, 146, 140, 141, 138, 137, 135, 133, 130, 124, 125, 126, 128, 129, 123, 120, 121, 122, 119, 114, 116, 117, 112, 99, 103, 108, 95, 88, 91, 84, 86, 82, 83, 82, 81, 85, 88, 83, 92, 102, 97, 111, 107, 116, 129, 126, 122, 119, 134, 132, 137, 139, 141, 143, 146, 145, 147, 147, 147, 146, 147, 146, 146, 147, 146, 153, 149, 161, 157, 170, 166, 177, 174, 184, 180, 186, 186, 184, 172, 176, 181, 163, 167, 155, 158, 148, 151, 145, 142, 140, 137, 131, 134, 129, 126, 124, 122, 120, 119, 117, 115, 113, 110, 105, 102, 108, 99, 90, 95, 81, 85, 74, 77, 72, 70, 69, 69, 69, 69, 71, 69, 80, 76, 73, 84, 92, 88, 99, 96, 102, 105, 110, 108, 114, 112
};
// tom hi 1 700
const char tom_hi[] PROGMEM = {
127, 236, 139, 127, 236, 238, 239, 229, 254, 254, 254, 254, 190, 219, 171, 178, 167, 157, 221, 160, 247, 254, 79, 130, 35, 46, 0, 18, 41, 28, 0, 0, 0, 0, 0, 120, 254, 254, 254, 254, 254, 254, 175, 228, 115, 129, 93, 98, 88, 98, 0, 0, 81, 10, 100, 78, 110, 105, 100, 117, 69, 74, 254, 244, 245, 248, 208, 148, 88, 59, 254, 254, 220, 241, 161, 191, 60, 113, 0, 7, 0, 0, 0, 0, 0, 0, 87, 49, 105, 93, 123, 105, 173, 153, 240, 216, 223, 239, 247, 247, 245, 246, 222, 216, 225, 237, 153, 194, 84, 118, 22, 55, 0, 0, 0, 0, 6, 3, 19, 6, 76, 45, 176, 128, 254, 219, 253, 254, 215, 231, 122, 127, 131, 139, 160, 186, 86, 110, 73, 69, 88, 84, 89, 87, 103, 98, 93, 102, 83, 86, 94, 84, 143, 109, 224, 183, 254, 254, 254, 254, 225, 247, 170, 196, 40, 69, 98, 122, 145, 14, 0, 0, 0, 0, 8, 0, 52, 37, 75, 68, 91, 82, 119, 102, 179, 141, 254, 219, 254, 254, 254, 254, 244, 254, 233, 237, 205, 220, 56, 86, 119, 155, 186, 26, 0, 4, 0, 0, 5, 1, 18, 10, 53, 33, 90, 71, 158, 118, 221, 186, 224, 233, 199, 209, 179, 188, 160, 169, 149, 155, 144, 144, 128, 138, 102, 111, 79, 89, 83, 79, 81, 83, 83, 81, 94, 88, 111, 102, 156, 127, 225, 189, 247, 252, 212, 231, 176, 192, 140, 161, 110, 122, 90, 99, 57, 78, 21, 35, 6, 10, 30, 13, 53, 42, 71, 65, 90, 81, 117, 103, 156, 132, 226, 192, 254, 254, 254, 254, 246, 254, 229, 239, 195, 209, 168, 183, 132, 153, 69, 101, 23, 45, 0, 5, 5, 0, 18, 11, 38, 26, 67, 54, 89, 77, 134, 106, 185, 162, 213, 207, 201, 210, 192, 196, 177, 185, 174, 175, 177, 176, 160, 174, 119, 140, 81, 99, 71, 73, 75, 73, 81, 78, 91, 85, 102, 96, 117, 108, 160, 136, 195, 179, 199, 205, 175, 186, 155, 165, 134, 143, 123, 128, 111, 118, 84, 101, 52, 66, 38, 43, 46, 38, 64, 55, 84, 74, 109, 96, 131, 119, 158, 144, 197, 177, 234, 217, 242, 245, 229, 236, 208, 218, 182, 195, 160, 171, 136, 149, 92, 119, 44, 66, 15, 27, 14, 10, 30, 21, 51, 41, 71, 61, 88, 79, 107, 96, 146, 125, 187, 167, 204, 202, 197, 201, 193, 194, 190, 192, 189, 189, 180, 186, 148, 168, 105, 125, 77, 90, 70, 70, 78, 73, 86, 82, 94, 89, 103, 99, 111, 107, 133, 119, 160, 146, 174, 173, 164, 170, 154, 158, 144, 150, 135, 140, 125, 130, 108, 118, 79, 92, 61, 68, 61, 57, 80, 70, 101, 91, 121, 111, 137, 130, 145, 142, 166, 152, 197, 181, 218, 211, 207, 215, 190, 198, 173, 183, 154, 164, 133, 144, 105, 120, 66, 85, 39, 51, 31, 32, 47, 38, 64, 56, 78, 71, 92, 85, 104, 98, 124, 112, 159, 141, 191, 176, 198, 197, 198, 198, 197, 197, 190, 195, 176, 183, 157, 167, 125, 143, 94, 108, 75, 83, 77, 74, 85, 81, 91, 88, 96, 93, 97, 97, 101, 98, 125, 111, 152, 138, 166, 163, 161, 164, 155, 158, 147, 152, 138, 142, 131, 135, 116, 125, 91, 102, 79, 83, 86, 79, 111, 103, 94, 118, 126, 123, 131, 129, 136, 133, 153, 142, 176, 165, 193, 187, 185, 191, 173, 179, 149, 159, 166, 138, 121, 129, 104, 113, 77, 91, 60, 67, 56, 56, 67, 61, 85, 79, 73, 90, 101, 96, 111, 106, 125, 116, 153, 138, 184, 168, 197, 194, 196, 197, 190, 194, 176, 184, 162, 169, 149, 156, 91, 90, 90, 89, 87, 85, 82, 81, 84, 91, 93, 92, 100, 112, 127, 140, 98, 95, 116, 105, 142, 129, 162, 155, 161, 163, 156, 158, 150, 153, 143, 146, 136, 140, 122, 120, 119, 117, 114, 111, 105, 100, 99, 101, 124, 105, 111, 120, 128, 133, 128, 126, 135, 131, 153, 144, 170, 162, 173, 175, 168
};
// clap 450
const char cow[] PROGMEM = {
127, 127, 209, 132, 0, 115, 100, 80, 194, 206, 102, 38, 139, 108, 62, 94, 120, 184, 107, 143, 138, 225, 70, 104, 154, 104, 123, 150, 92, 105, 143, 130, 147, 135, 115, 143, 112, 82, 132, 143, 127, 134, 119, 128, 135, 123, 125, 122, 122, 129, 139, 125, 121, 123, 131, 117, 135, 129, 121, 145, 112, 107, 148, 126, 117, 136, 0, 179, 254, 194, 144, 186, 43, 0, 254, 99, 68, 86, 106, 187, 185, 150, 82, 124, 201, 205, 88, 105, 228, 72, 95, 167, 120, 102, 153, 128, 91, 157, 115, 115, 147, 106, 132, 126, 145, 126, 123, 121, 113, 124, 151, 129, 100, 124, 122, 112, 135, 139, 120, 127, 123, 136, 130, 120, 126, 127, 124, 125, 134, 145, 111, 121, 128, 114, 239, 134, 95, 234, 110, 4, 133, 83, 195, 131, 178, 109, 50, 31, 188, 105, 203, 123, 97, 179, 68, 93, 149, 117, 45, 162, 135, 174, 115, 87, 141, 86, 173, 148, 79, 93, 169, 121, 117, 157, 127, 112, 136, 127, 136, 141, 0, 0, 248, 132, 35, 141, 31, 95, 87, 209, 163, 52, 147, 111, 146, 167, 0, 121, 173, 141, 178, 126, 25, 92, 253, 91, 10, 152, 138, 159, 145, 64, 75, 115, 169, 135, 147, 46, 150, 176, 123, 86, 254, 114, 74, 144, 95, 76, 167, 170, 190, 85, 81, 103, 170, 177, 117, 76, 80, 123, 87, 163, 174, 119, 55, 239, 102, 122, 187, 60, 116, 205, 76, 50, 129, 107, 154, 197, 64, 79, 143, 146, 85, 110, 140, 147, 140, 102, 120, 154, 123, 116, 83, 110, 145, 83, 172, 168, 132, 75, 183, 95, 95, 139, 121, 139, 113, 200, 118, 82, 152, 107, 123, 158, 126, 55, 129, 173, 99, 141, 133, 88, 108, 182, 145, 104, 76, 132, 143, 130, 153, 163, 112, 123, 118, 97, 169, 200, 74, 84, 173, 78, 126, 140, 98, 126, 140, 133, 139, 105, 152, 106, 174, 112, 109, 106, 111, 115, 130, 98, 154, 145, 104, 118, 173, 146, 94, 132, 180, 89, 75, 131, 159, 110, 130, 128, 161, 112, 111, 118, 100, 132, 158, 126, 121, 144, 103, 86, 160, 124, 96, 151, 121, 86, 170, 163, 98, 111, 137, 119, 120, 117, 122, 122, 124, 127, 149, 135, 117, 140, 89, 105, 150, 97, 141, 155, 128, 124, 111, 116, 141, 139, 138, 124, 99, 131, 131, 114, 133, 136, 136, 121, 118, 120, 129, 149, 119, 111, 146, 125, 117, 137, 147, 128, 105, 120, 120, 111, 144, 146, 119, 124, 138, 128, 114, 142, 128, 118, 132, 119, 134, 122, 128, 117, 132, 122, 125, 139, 123, 127, 126
};
// kick2 1200
const char kick2[] PROGMEM = {
127, 127, 127, 127, 128, 128, 97, 126, 150, 152, 157, 131, 99, 83, 82, 76, 123, 80, 128, 160, 34, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 17, 84, 155, 232, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 224, 255, 227, 227, 226, 209, 212, 144, 97, 76, 42, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 35, 81, 125, 145, 146, 174, 199, 206, 236, 255, 255, 255, 255, 255, 255, 255, 255, 240, 223, 207, 190, 176, 163, 159, 141, 148, 140, 137, 132, 148, 158, 163, 166, 162, 157, 145, 119, 97, 66, 54, 42, 35, 13, 13, 25, 36, 29, 38, 49, 41, 76, 77, 94, 109, 106, 130, 140, 145, 163, 181, 193, 205, 214, 211, 221, 214, 239, 235, 242, 245, 255, 248, 245, 250, 246, 240, 245, 247, 247, 252, 240, 233, 234, 239, 240, 218, 210, 194, 184, 147, 134, 109, 85, 68, 72, 45, 33, 24, 9, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 6, 16, 36, 55, 68, 84, 89, 103, 118, 128, 139, 148, 156, 171, 174, 177, 191, 189, 197, 207, 205, 203, 207, 211, 215, 224, 234, 233, 250, 245, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 242, 230, 213, 188, 173, 162, 141, 130, 125, 119, 111, 110, 102, 100, 93, 84, 80, 67, 62, 61, 58, 44, 47, 45, 39, 44, 37, 34, 39, 39, 42, 46, 55, 64, 76, 91, 97, 114, 123, 126, 140, 150, 148, 164, 171, 179, 195, 197, 207, 213, 215, 218, 216, 217, 214, 211, 197, 192, 183, 175, 156, 159, 156, 148, 152, 147, 143, 143, 147, 137, 136, 134, 130, 123, 118, 105, 90, 82, 73, 63, 55, 42, 32, 20, 12, 12, 4, 1, 2, 0, 0, 0, 0, 0, 0, 4, 20, 21, 30, 39, 43, 56, 70, 74, 83, 90, 99, 103, 107, 124, 134, 145, 155, 168, 175, 182, 187, 187, 188, 192, 194, 194, 191, 192, 193, 188, 195, 201, 203, 210, 209, 209, 207, 201, 196, 192, 180, 178, 173, 167, 160, 153, 151, 146, 147, 148, 145, 139, 131, 122, 109, 96, 75, 66, 56, 53, 52, 49, 48, 49, 50, 52, 55, 56, 56, 55, 58, 62, 64, 72, 79, 86, 94, 108, 120, 133, 138, 146, 150, 154, 163, 164, 167, 172, 180, 190, 199, 208, 209, 222, 228, 236, 245, 246, 245, 247, 248, 244, 244, 234, 229, 226, 217, 212, 209, 199, 195, 187, 184, 176, 169, 157, 151, 142, 134, 125, 119, 112, 108, 105, 98, 94, 93, 86, 78, 76, 72, 63, 60, 52, 50, 52, 53, 53, 52, 52, 53, 54, 54, 56, 55, 57, 64, 75, 81, 88, 94, 105, 114, 121, 130, 138, 147, 155, 164, 168, 174, 181, 185, 190, 198, 203, 209, 215, 219, 220, 222, 218, 214, 213, 213, 209, 202, 194, 191, 185, 177, 175, 168, 166, 165, 159, 155, 146, 138, 133, 129, 119, 111, 104, 102, 95, 90, 89, 83, 79, 75, 75, 66, 64, 61, 55, 48, 48, 46, 44, 47, 46, 47, 53, 57, 60, 64, 69, 75, 82, 84, 89, 96, 104, 110, 118, 124, 129, 136, 142, 147, 154, 161, 166, 174, 181, 184, 186, 188, 189, 191, 194, 193, 194, 193, 190, 189, 188, 185, 184, 181, 179, 176, 172, 167, 163, 157, 148, 141, 136, 129, 123, 117, 111, 108, 106, 104, 100, 94, 91, 89, 82, 79, 75, 70, 69, 65, 62, 61, 59, 60, 62, 63, 65, 66, 68, 67, 69, 70, 73, 76, 80, 82, 87, 92, 98, 104, 108, 114, 121, 126, 132, 135, 140, 145, 149, 152, 158, 162, 165, 169, 172, 175, 180, 181, 184, 185, 185, 185, 186, 183, 181, 180, 176, 170, 165, 160, 158, 153, 149, 143, 138, 132, 127, 121, 115, 111, 108, 105, 102, 100, 97, 94, 92, 90, 88, 86, 84, 81, 79, 77, 77, 76, 75, 76, 78, 78, 78, 77, 78, 79, 81, 85, 87, 90, 94, 98, 102, 106, 110, 115, 119, 124, 127, 130, 133, 136, 138, 141, 143, 146, 149, 151, 153, 155, 157, 159, 160, 162, 165, 166, 166, 166, 166, 166, 166, 165, 163, 162, 159, 156, 153, 149, 145, 142, 138, 135, 132, 127, 124, 121, 118, 115, 112, 110, 108, 105, 102, 98, 97, 96, 94, 93, 92, 89, 89, 88, 88, 88, 88, 88, 89, 89, 89, 89, 91, 94, 97, 100, 103, 105, 108, 110, 113, 116, 119, 123, 126, 129, 133, 136, 139, 142, 146, 149, 150, 153, 155, 156, 155, 155, 154, 154, 154, 154, 155, 156, 157, 159, 160, 161, 161, 160, 159, 156, 153, 150, 147, 143, 140, 137, 135, 132, 129, 126, 123, 121, 118, 116, 112, 108, 105, 103, 100, 98, 97, 96, 96, 96, 96, 95, 95, 95, 96, 96, 97, 99, 100, 101, 103, 104, 106, 108, 110, 111, 113, 115, 117, 118, 119, 121, 122, 124, 127, 129, 133, 136, 138, 140, 143, 146, 147, 149, 149, 149, 150, 150, 150, 150, 150, 150, 151, 151, 152, 152, 153, 153, 153, 152, 150, 148, 145, 142, 140, 138, 135, 133, 130, 128, 126, 124, 122, 120, 117, 115, 113, 111, 109, 107, 106, 105, 104, 103, 102, 101, 102, 102, 103, 103, 103, 103, 103, 103, 104, 106, 107, 108, 109, 110, 111, 112, 114, 116, 118, 121, 123, 126, 129, 132, 134, 136, 138, 141, 142, 144, 145, 146, 146, 147, 147, 148, 148, 149, 149, 149, 148, 147, 147, 146, 145, 144, 143, 143, 142, 140, 139, 139, 138, 136, 135, 134, 132, 131, 129, 126, 124, 122, 121, 119, 118, 116, 114, 113, 112, 111, 110, 109, 108, 107, 106, 106, 106, 105, 106, 106, 106, 107, 107, 108, 108, 109, 110, 112, 113, 116, 118, 119, 121, 123, 125, 127, 128, 129, 131, 132, 134, 135, 136, 138, 139, 139, 140, 141, 141, 142, 143, 144, 144, 144, 144, 144, 143, 142, 142, 141, 141, 140, 140, 139, 139, 138, 137, 136, 135, 134, 132, 131, 129, 127, 125, 124, 122, 121, 119, 118, 117, 116, 115, 114, 113, 112, 112, 111, 111, 110, 110, 109, 109, 109, 109, 110, 110, 111, 112, 113, 114, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 139, 140, 141, 141, 141, 142, 142, 142, 142, 141, 140, 140, 139, 138, 138, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 118, 117, 117, 116, 116, 116, 116, 116, 115, 115, 115, 114, 114, 114, 114, 114, 114, 115, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138, 138, 139, 139, 139, 139, 139, 139, 139, 139, 138, 138, 137, 136, 136, 135, 135, 134, 133, 132, 131, 131, 130, 129, 128, 127, 127, 126, 125, 124, 123, 122, 122, 121, 120, 119, 119
};
// snare 2 1200
const char snare2[] PROGMEM = {
127, 127, 126, 127, 127, 136, 146, 0, 66, 56, 255, 255, 16, 43, 174, 0, 129, 92, 255, 255, 255, 139, 0, 92, 85, 0, 0, 133, 219, 232, 186, 134, 149, 0, 122, 181, 210, 12, 0, 0, 39, 0, 0, 0, 64, 0, 0, 113, 211, 169, 192, 255, 255, 253, 203, 143, 5, 0, 35, 29, 0, 4, 64, 255, 255, 255, 236, 234, 255, 255, 186, 190, 113, 50, 102, 68, 32, 127, 63, 255, 255, 244, 134, 46, 94, 102, 125, 200, 250, 255, 255, 221, 141, 40, 2, 50, 95, 109, 244, 255, 251, 255, 160, 128, 116, 193, 97, 136, 204, 217, 150, 119, 132, 43, 125, 181, 225, 178, 120, 166, 114, 146, 57, 60, 114, 221, 255, 221, 213, 98, 109, 89, 127, 79, 95, 117, 172, 213, 166, 112, 112, 40, 78, 148, 193, 211, 120, 194, 121, 132, 141, 141, 51, 150, 116, 81, 40, 55, 96, 146, 204, 225, 149, 99, 126, 68, 143, 109, 108, 76, 176, 109, 151, 165, 138, 169, 146, 133, 140, 128, 75, 20, 94, 101, 115, 110, 135, 75, 131, 125, 123, 125, 189, 230, 210, 205, 141, 106, 81, 67, 52, 0, 50, 66, 72, 57, 61, 131, 126, 190, 240, 226, 141, 165, 107, 80, 30, 84, 70, 59, 25, 73, 79, 115, 179, 135, 124, 123, 220, 161, 108, 106, 150, 121, 123, 99, 40, 52, 106, 134, 86, 119, 113, 111, 126, 127, 107, 156, 166, 151, 94, 80, 55, 55, 22, 27, 140, 183, 190, 214, 190, 108, 90, 115, 57, 61, 71, 33, 87, 114, 82, 117, 137, 150, 143, 154, 133, 121, 144, 168, 162, 163, 170, 90, 96, 85, 54, 57, 82, 43, 67, 89, 71, 102, 189, 216, 211, 168, 147, 103, 93, 109, 117, 130, 76, 117, 73, 83, 73, 150, 152, 121, 110, 90, 41, 126, 102, 73, 137, 155, 210, 195, 221, 181, 157, 115, 146, 67, 101, 64, 53, 73, 47, 100, 84, 115, 126, 194, 188, 130, 144, 114, 88, 151, 171, 133, 195, 170, 148, 83, 77, 0, 69, 74, 66, 177, 126, 136, 145, 166, 202, 134, 155, 118, 138, 137, 154, 169, 152, 132, 67, 87, 91, 72, 88, 121, 128, 74, 89, 104, 102, 133, 186, 179, 187, 203, 184, 159, 185, 172, 98, 42, 54, 52, 54, 76, 105, 107, 126, 112, 127, 131, 148, 163, 187, 209, 172, 169, 141, 128, 96, 99, 100, 104, 140, 108, 127, 56, 93, 88, 117, 141, 147, 150, 133, 187, 175, 148, 136, 141, 131, 160, 141, 139, 125, 161, 109, 106, 68, 31, 89, 108, 102, 120, 144, 151, 129, 186, 172, 146, 149, 120, 128, 165, 129, 83, 115, 81, 133, 114, 115, 100, 105, 97, 188, 202, 146, 113, 69, 114, 123, 142, 144, 183, 204, 124, 108, 111, 126, 92, 132, 98, 100, 92, 147, 108, 150, 179, 150, 104, 134, 128, 132, 154, 146, 188, 164, 118, 127, 136, 142, 95, 127, 114, 109, 119, 49, 40, 43, 99, 142, 158, 152, 177, 173, 212, 157, 169, 154, 167, 145, 143, 104, 79, 51, 41, 43, 77, 104, 121, 196, 176, 212, 162, 165, 164, 152, 154, 142, 100, 113, 134, 134, 123, 100, 70, 106, 107, 95, 115, 147, 165, 144, 149, 142, 148, 187, 168, 168, 154, 106, 73, 36, 87, 113, 126, 128, 132, 149, 152, 131, 152, 182, 184, 158, 156, 128, 96, 99, 111, 95, 128, 122, 135, 94, 140, 168, 166, 148, 179, 124, 84, 102, 118, 120, 156, 145, 117, 122, 151, 143, 146, 139, 156, 131, 134, 98, 85, 111, 113, 115, 141, 127, 108, 107, 117, 128, 146, 166, 171, 189, 159, 136, 107, 83, 91, 111, 133, 96, 104, 77, 96, 134, 137, 161, 154, 192, 164, 187, 160, 121, 106, 135, 109, 108, 84, 69, 89, 129, 142, 109, 135, 152, 166, 159, 138, 133, 118, 112, 120, 107, 91, 133, 149, 134, 143, 157, 131, 120, 129, 123, 115, 108, 118, 101, 127, 148, 152, 168, 137, 136, 126, 125, 124, 127, 127, 126, 126, 136, 119, 119, 101, 121, 130, 129, 111, 130, 129, 124, 126, 135, 141, 142, 154, 165, 139, 124, 105, 109, 111, 131, 139, 132, 113, 106, 114, 112, 127, 129, 150, 146, 138, 136, 157, 155, 143, 133, 128, 123, 104, 115, 101, 112, 94, 103, 120, 142, 128, 122, 127, 147, 155, 160, 173, 156, 139, 126, 108, 114, 124, 120, 149, 128, 126, 108, 99, 80, 82, 95, 115, 132, 171, 185, 172, 137, 141, 140, 152, 149, 124, 99, 83, 82, 74, 115, 114, 128, 139, 148, 141, 132, 138, 135, 131, 153, 166, 143, 134, 124, 114, 125, 127, 109, 122, 121, 118, 116, 120, 117, 121, 130, 127, 147, 147, 143, 149, 147, 127, 121, 113, 115, 119, 118, 125, 116, 113, 124, 131, 139, 156, 145, 131, 123, 111, 107, 108, 130, 124, 121, 135, 138, 133, 150, 159, 168, 154, 118, 102, 101, 116, 118, 111, 119, 112, 114, 113, 115, 123, 138, 140, 153, 163, 151, 149, 155, 142, 125, 118, 115, 113, 108, 95, 83, 95, 119, 116, 125, 135, 140, 147, 144, 158, 150, 147, 148, 140, 129, 121, 120, 104, 108, 108, 116, 119, 127, 123, 130, 128, 127, 134, 138, 123, 131, 145, 145, 145, 141, 133, 132, 127, 119, 120, 121, 109, 117, 112, 109, 104, 113, 121, 142, 153, 163, 155, 145, 145, 134, 130, 133, 129, 116, 111, 100, 87, 92, 106, 129, 140, 158, 167, 136, 145, 147, 122, 123, 114, 112, 116, 112, 119, 128, 123, 133, 130, 132, 137, 130, 138, 137, 133, 130, 120, 105, 106, 107, 126, 129, 125, 126, 134, 149, 148, 151, 154, 144, 127, 117, 118, 105, 98, 102, 104, 109, 119, 130, 128, 140, 160, 146, 145, 138, 134, 137, 140, 134, 144, 124, 105, 96, 91, 89, 97, 112, 122, 126, 144, 155, 151, 151, 147, 145, 138, 130, 116, 117, 113, 123, 108, 107, 107, 111, 123, 128, 136, 143, 146, 139, 136, 136, 132, 127, 125, 131, 129, 122, 112, 111, 114, 114, 117, 128, 135, 150, 149, 149, 139, 132, 122, 120, 120, 115, 116, 119, 115, 124, 130, 120, 133, 134, 133, 142, 142, 130, 128, 115, 124, 130, 130, 127, 119, 126, 118, 119, 120, 121, 118, 117, 130, 132, 131, 132, 140, 140, 138, 134, 120, 125, 122, 120, 119, 118, 121, 123, 123, 125, 123, 122, 124, 128, 130, 131, 129, 137, 141, 134, 135, 125, 124, 126, 126, 134, 132, 127, 121, 111, 109, 111, 115, 123, 127, 132, 136, 141, 138, 128, 137, 142, 135, 133, 135, 132, 124, 122, 111, 108, 122, 118, 122, 120, 114, 117, 127, 130, 131, 133, 141, 134, 144, 138, 135, 129, 127, 125, 122, 129, 121, 120, 115, 115, 111, 110, 114, 120, 125, 129, 141, 146, 143, 142, 142, 137, 130, 125, 115, 118, 116, 118, 113, 116, 122, 124, 132, 132, 129, 132, 130, 127, 132, 134, 134, 135, 136, 129, 123, 116, 116, 122, 115, 114, 125, 136, 133, 135, 133, 123, 119, 120, 121, 129, 131, 134
};
// hat c 2 300
const char hat_c2[] PROGMEM = {
126, 126, 126, 126, 126, 126, 216, 109, 86, 0, 67, 219, 207, 119, 48, 203, 109, 121, 173, 123, 61, 180, 122, 101, 102, 111, 59, 84, 109, 92, 119, 135, 156, 136, 149, 109, 177, 100, 97, 72, 127, 103, 97, 53, 162, 115, 108, 75, 134, 124, 126, 147, 163, 162, 127, 80, 98, 61, 84, 100, 139, 108, 152, 70, 186, 74, 124, 170, 112, 135, 131, 156, 142, 147, 132, 125, 128, 85, 106, 128, 66, 104, 128, 161, 132, 138, 122, 138, 145, 119, 156, 90, 171, 99, 127, 118, 108, 108, 103, 158, 81, 142, 108, 133, 134, 132, 160, 144, 106, 136, 112, 123, 88, 106, 124, 97, 132, 94, 122, 122, 147, 130, 131, 132, 122, 129, 90, 110, 132, 126, 136, 104, 146, 148, 122, 119, 146, 135, 117, 155, 129, 114, 132, 120, 130, 131, 109, 120, 126, 128, 109, 122, 132, 128, 110, 113, 157, 120, 120, 130, 145, 109, 128, 126, 143, 115, 120, 129, 146, 107, 133, 129, 124, 117, 125, 141, 118, 140, 125, 127, 123, 148, 100, 136, 104, 130, 122, 115, 137, 131, 136, 132, 124, 140, 128, 116, 112, 126, 113, 137, 127, 146, 121, 135, 130, 124, 118, 115, 126, 106, 130, 116, 127, 125, 129, 139, 129, 127, 140, 123, 127, 124, 126, 121, 124, 111, 140, 110, 125, 128, 134, 126, 121, 132, 133, 116, 139, 128, 128, 125, 113, 132, 129, 124, 118, 129, 130, 124, 129, 126, 131, 125, 131, 127, 130, 126, 131, 124, 127, 126, 126, 125, 128, 127, 136, 115, 134, 133, 121, 125, 119, 129, 111, 126, 123, 136, 118, 128, 122, 123, 118, 118, 129, 127, 122, 126, 132, 115, 129, 128, 129, 122, 121, 128, 121, 120, 119, 129, 132, 116, 132
};
// hat open 1000
const char hat_o2[] PROGMEM = {
126, 126, 126, 126, 126, 124, 74, 75, 206, 255, 164, 42, 160, 95, 0, 191, 186, 239, 33, 65, 27, 186, 124, 155, 109, 101, 97, 39, 147, 110, 185, 208, 162, 173, 139, 96, 184, 117, 185, 43, 119, 46, 80, 14, 140, 151, 126, 255, 96, 211, 144, 154, 149, 100, 151, 76, 92, 70, 112, 127, 87, 144, 145, 137, 109, 150, 93, 73, 180, 81, 161, 105, 184, 91, 170, 157, 61, 94, 83, 142, 91, 108, 149, 44, 138, 173, 127, 170, 89, 141, 82, 212, 87, 55, 157, 93, 165, 148, 183, 65, 145, 63, 96, 127, 144, 100, 113, 205, 82, 40, 204, 129, 122, 152, 102, 132, 79, 96, 184, 104, 93, 155, 125, 208, 171, 59, 180, 57, 107, 189, 52, 189, 100, 96, 175, 105, 82, 112, 118, 165, 180, 89, 159, 103, 123, 195, 109, 142, 88, 117, 115, 113, 157, 130, 124, 105, 181, 119, 72, 181, 108, 165, 156, 130, 126, 104, 78, 116, 148, 9, 135, 130, 124, 191, 132, 155, 108, 92, 138, 187, 141, 177, 155, 50, 113, 52, 117, 186, 114, 184, 113, 23, 164, 32, 163, 223, 112, 146, 138, 71, 98, 90, 123, 201, 123, 117, 137, 87, 91, 161, 133, 148, 130, 167, 91, 107, 105, 77, 95, 106, 174, 111, 158, 93, 99, 132, 192, 89, 174, 143, 92, 139, 84, 123, 113, 117, 159, 143, 113, 164, 50, 111, 100, 144, 189, 179, 38, 55, 153, 136, 122, 157, 164, 92, 110, 113, 195, 93, 127, 101, 98, 93, 75, 142, 154, 151, 186, 139, 125, 126, 160, 108, 190, 76, 29, 122, 82, 109, 173, 156, 121, 134, 97, 116, 125, 119, 166, 179, 132, 75, 65, 75, 90, 190, 121, 153, 151, 146, 121, 56, 101, 75, 159, 130, 176, 137, 156, 67, 133, 115, 170, 102, 145, 150, 58, 137, 135, 94, 163, 132, 167, 120, 52, 130, 130, 96, 147, 216, 69, 183, 81, 81, 131, 127, 194, 107, 143, 164, 139, 90, 168, 126, 142, 136, 122, 64, 99, 149, 82, 116, 169, 137, 145, 173, 113, 152, 130, 143, 99, 140, 53, 110, 96, 126, 108, 147, 144, 107, 181, 125, 123, 133, 124, 99, 92, 96, 185, 100, 138, 186, 114, 96, 140, 104, 154, 84, 99, 134, 77, 166, 140, 102, 156, 155, 111, 142, 75, 124, 63, 149, 118, 145, 137, 90, 139, 98, 128, 163, 173, 120, 168, 140, 87, 104, 99, 119, 94, 133, 138, 110, 73, 123, 71, 116, 120, 173, 167, 92, 141, 106, 65, 200, 112, 93, 157, 116, 125, 101, 147, 129, 123, 111, 139, 141, 116, 139, 118, 146, 92, 182, 134, 65, 158, 76, 111, 199, 63, 157, 119, 104, 166, 115, 158, 134, 158, 100, 123, 137, 136, 107, 107, 124, 134, 107, 136, 139, 169, 106, 144, 146, 78, 170, 77, 114, 144, 112, 116, 136, 171, 125, 101, 154, 120, 133, 108, 110, 143, 83, 120, 186, 164, 106, 152, 74, 128, 148, 98, 117, 163, 138, 136, 126, 84, 123, 106, 122, 197, 122, 123, 145, 114, 147, 93, 173, 123, 119, 134, 123, 127, 104, 131, 97, 118, 113, 130, 110, 110, 131, 161, 126, 180, 153, 148, 91, 103, 111, 88, 153, 141, 129, 95, 140, 134, 141, 116, 139, 98, 125, 151, 138, 111, 93, 112, 137, 122, 152, 155, 83, 127, 138, 126, 139, 121, 129, 113, 93, 127, 134, 132, 118, 166, 121, 126, 174, 116, 85, 136, 105, 125, 128, 131, 124, 107, 127, 131, 127, 116, 161, 130, 107, 136, 115, 118, 128, 125, 158, 130, 134, 133, 122, 117, 115, 124, 132, 141, 115, 128, 113, 114, 164, 108, 158, 150, 80, 102, 123, 132, 128, 153, 128, 115, 133, 129, 114, 136, 110, 122, 122, 150, 126, 166, 109, 135, 133, 126, 117, 119, 134, 86, 137, 133, 113, 152, 132, 124, 131, 107, 129, 117, 122, 106, 154, 127, 140, 140, 113, 109, 111, 144, 119, 120, 140, 129, 103, 132, 133, 126, 127, 138, 129, 122, 125, 133, 113, 134, 133, 100, 130, 123, 136, 124, 129, 116, 129, 138, 133, 130, 110, 115, 133, 118, 112, 131, 118, 121, 125, 143, 133, 141, 112, 144, 123, 125, 116, 105, 118, 116, 123, 143, 135, 145, 136, 125, 130, 129, 128, 106, 114, 116, 125, 120, 137, 124, 132, 128, 120, 128, 136, 122, 129, 115, 131, 131, 112, 137, 121, 115, 114, 135, 124, 131, 118, 127, 140, 129, 131, 135, 115, 126, 128, 120, 127, 125, 124, 127, 130, 135, 139, 123, 121, 122, 124, 114, 126, 113, 127, 121, 136, 142, 121, 142, 125, 129, 133, 121, 117, 126, 119, 109, 128, 134, 109, 141, 128, 147, 141, 124, 136, 111, 124, 114, 119, 125, 127, 119, 129, 121, 133, 136, 125, 134, 126, 114, 121, 110, 118, 142, 130, 129, 122, 138, 120, 117, 137, 132, 131, 118, 116, 115, 128, 132, 125, 134, 129, 123, 121, 121, 129, 121, 135, 127, 121, 125, 115, 130, 128, 131, 128, 131, 122, 122, 133, 122, 126, 137, 119, 111, 124, 121, 126, 126, 136, 122, 123, 119, 135, 122, 130, 124, 132, 121, 122, 121, 115, 129, 130, 122, 123, 133, 128, 138, 119, 137, 124, 129, 116, 124, 119, 115, 128, 121, 129, 131, 127, 127, 133, 128, 127, 123, 123, 123, 123, 121, 126, 127, 121, 129, 137, 121, 123, 129, 115, 125, 124, 124, 129, 125, 128, 126, 130, 126, 124, 121, 129, 127, 126, 126, 124, 128, 126, 119, 127, 125, 128, 125, 125, 126, 128, 128, 133, 126, 128, 128, 122, 122, 123, 123, 125, 126, 122, 133, 121, 129, 121, 126, 124, 132, 121, 130, 126, 123, 125, 126, 127, 126, 128, 123, 125, 126, 126, 123, 127, 123, 125, 121, 128, 122, 125, 125, 132, 121, 125, 127, 125, 121, 133, 120, 125, 132, 121, 124, 128, 128, 125, 131, 128, 131, 125, 128, 124, 126
};
// high tom 2 1200
const char tom_hi2[] PROGMEM = {
127, 127, 127, 127, 161, 100, 145, 109, 17, 16, 255, 82, 231, 163, 178, 103, 75, 86, 103, 113, 198, 255, 236, 255, 255, 101, 147, 0, 0, 0, 0, 0, 0, 55, 150, 255, 255, 255, 255, 255, 255, 255, 255, 255, 217, 124, 168, 49, 102, 69, 23, 41, 4, 41, 0, 0, 0, 0, 0, 0, 23, 80, 209, 251, 255, 255, 255, 255, 255, 255, 255, 226, 184, 109, 77, 24, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 41, 57, 90, 171, 210, 255, 255, 255, 255, 255, 255, 255, 255, 156, 76, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 33, 42, 105, 104, 105, 127, 152, 213, 245, 255, 255, 255, 255, 255, 255, 255, 179, 98, 37, 0, 0, 0, 0, 0, 11, 34, 56, 81, 77, 81, 70, 88, 48, 78, 71, 96, 152, 180, 243, 255, 255, 255, 255, 255, 255, 255, 194, 136, 78, 6, 0, 0, 0, 0, 0, 0, 13, 25, 56, 76, 54, 103, 97, 89, 75, 101, 111, 145, 201, 245, 255, 255, 255, 255, 255, 255, 248, 209, 104, 51, 0, 0, 0, 0, 0, 0, 23, 41, 51, 33, 54, 51, 30, 76, 82, 90, 117, 146, 181, 224, 253, 255, 255, 255, 255, 255, 255, 255, 217, 162, 99, 41, 15, 0, 0, 0, 0, 1, 36, 57, 74, 64, 79, 53, 36, 31, 32, 42, 68, 100, 167, 211, 255, 255, 255, 255, 255, 255, 255, 239, 193, 146, 89, 49, 31, 0, 0, 0, 0, 21, 42, 56, 54, 59, 55, 50, 45, 65, 37, 59, 77, 93, 138, 179, 219, 250, 255, 255, 255, 255, 255, 255, 248, 183, 135, 101, 41, 7, 0, 7, 4, 33, 39, 67, 69, 68, 67, 56, 32, 32, 13, 16, 30, 37, 85, 118, 176, 223, 255, 255, 255, 255, 255, 255, 255, 250, 216, 158, 121, 63, 42, 8, 11, 11, 33, 29, 34, 45, 48, 28, 25, 36, 14, 22, 11, 30, 65, 86, 135, 167, 218, 255, 255, 255, 255, 255, 255, 255, 255, 214, 171, 119, 113, 54, 68, 45, 42, 52, 40, 43, 45, 22, 15, 0, 0, 0, 0, 0, 14, 40, 99, 119, 201, 235, 255, 255, 255, 255, 255, 255, 255, 237, 223, 177, 151, 118, 101, 93, 74, 76, 71, 60, 49, 49, 39, 31, 9, 4, 0, 0, 0, 0, 7, 29, 92, 113, 187, 225, 255, 255, 255, 255, 255, 255, 255, 245, 219, 197, 181, 158, 130, 121, 91, 88, 62, 49, 53, 39, 37, 24, 11, 3, 0, 0, 0, 0, 5, 39, 76, 115, 147, 189, 216, 254, 255, 255, 255, 255, 255, 255, 248, 234, 200, 191, 161, 130, 112, 83, 75, 61, 43, 48, 35, 28, 6, 0, 0, 0, 0, 0, 0, 22, 52, 99, 143, 189, 223, 243, 255, 255, 255, 255, 255, 248, 241, 239, 243, 235, 227, 202, 175, 147, 113, 70, 49, 28, 15, 0, 0, 0, 0, 0, 0, 0, 0, 20, 34, 77, 97, 146, 172, 199, 233, 247, 255, 255, 255, 255, 255, 255, 255, 250, 234, 209, 188, 156, 133, 101, 72, 63, 28, 15, 6, 0, 0, 0, 0, 0, 0, 0, 20, 45, 88, 133, 166, 201, 226, 242, 250, 255, 251, 255, 255, 243, 238, 234, 230, 220, 204, 199, 178, 147, 125, 94, 68, 39, 19, 8, 0, 0, 0, 0, 0, 0, 11, 22, 48, 69, 100, 134, 158, 180, 206, 232, 248, 253, 255, 255, 255, 251, 246, 237, 230, 206, 193, 166, 143, 122, 99, 66, 56, 42, 29, 22, 8, 0, 0, 0, 6, 13, 27, 45, 64, 86, 107, 132, 159, 172, 197, 211, 231, 246, 254, 253, 244, 241, 238, 228, 219, 206, 194, 172, 149, 124, 101, 83, 59, 40, 28, 19, 6, 0, 3, 8, 18, 29, 43, 60, 75, 90, 105, 122, 146, 160, 181, 202, 218, 237, 247, 247, 245, 246, 249, 240, 228, 210, 191, 172, 144, 121, 102, 76, 62, 39, 25, 15, 12, 12, 15, 23, 34, 43, 56, 61, 73, 85, 102, 120, 128, 151, 170, 189, 206, 217, 235, 244, 246, 242, 240, 235, 223, 213, 198, 184, 163, 139, 113, 91, 70, 45, 30, 19, 12, 3, 13, 26, 40, 50, 57, 65, 70, 82, 95, 107, 128, 146, 165, 185, 206, 223, 233, 237, 235, 228, 220, 216, 206, 197, 186, 177, 166, 152, 137, 119, 100, 85, 67, 48, 35, 28, 19, 17, 19, 26, 30, 44, 57, 70, 88, 109, 127, 145, 162, 175, 190, 204, 219, 220, 220, 219, 219, 218, 215, 210, 208, 203, 187, 169, 153, 126, 106, 83, 62, 46, 32, 26, 24, 27, 32, 43, 55, 62, 65, 71, 77, 86, 97, 111, 127, 146, 172, 192, 210, 224, 232, 234, 230, 227, 218, 211, 201, 189, 178, 163, 149, 132, 114, 100, 86, 76, 68, 59, 49, 45, 47, 45, 48, 49, 53, 56, 60, 67, 82, 98, 116, 137, 158, 179, 195, 208, 213, 214, 215, 214, 218, 214, 209, 203, 194, 181, 168, 154, 136, 119, 104, 93, 82, 74, 62, 51, 46, 44, 45, 49, 54, 59, 63, 68, 78, 90, 99, 115, 128, 142, 162, 177, 190, 201, 206, 208, 212, 218, 222, 220, 213, 203, 191, 176, 161, 141, 124, 108, 90, 77, 70, 63, 57, 51, 49, 51, 53, 56, 57, 60, 63, 70, 79, 92, 110, 127, 145, 164, 179, 194, 206, 208, 208, 207, 208, 208, 206, 202, 197, 189, 180, 169, 157, 138, 121, 105, 90, 80, 67, 58, 53, 45, 41, 42, 45, 47, 52, 60, 72, 86, 102, 118, 131, 143, 160, 174, 185, 195, 203, 204, 203, 205, 207, 203, 201, 197, 192, 183, 173, 160, 142, 124, 106, 89, 77, 67, 57, 54, 54, 54, 56, 59, 64, 64, 64, 67, 74, 86, 102, 120, 136, 153, 174, 189, 199, 205, 207, 207, 204, 199, 193, 187, 181, 176, 170, 163, 155, 146, 136, 123, 113, 103, 91, 80, 73, 67, 62, 60, 60, 61, 61, 62, 65, 70, 78, 89, 104, 120, 136, 153, 169, 181, 189, 193, 195, 198, 200, 200, 198, 197, 194, 188, 180, 170, 158, 144, 130, 114, 101, 91, 80, 72, 66, 65, 64, 65, 65, 67, 68, 70, 73, 77, 85, 94, 107, 122, 136, 150, 161, 173, 183, 191, 197, 203, 207, 206, 204, 198, 194, 186, 176, 165, 149, 133, 119, 107, 94, 84, 79, 77, 75, 73, 73, 72, 69, 66, 64, 67, 71, 78, 88, 104, 119, 134, 148, 159, 168, 174, 178, 180, 183, 186, 187, 187, 187, 186, 187, 187, 183, 175, 163, 147, 131, 116, 101, 86, 77, 73, 67, 65, 68, 71, 74, 75, 76, 78, 82, 88, 94, 103, 113, 123, 134, 144, 154, 163, 172, 179, 186, 190, 194, 196, 195, 193, 190, 185, 178, 170, 157, 142, 127, 116, 104, 95, 88, 83, 77, 71, 68, 66, 65, 65, 66, 69, 74, 83, 93, 106, 120, 133, 144, 153, 160, 166, 171, 176, 183, 186, 188, 188, 188, 188, 185, 180, 172, 162, 150, 138, 128, 120, 110, 102, 94, 89
};
// crash 1500
const char crash[] PROGMEM = {
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 159, 89, 143, 255, 255, 136, 156, 110, 6, 243, 255, 0, 111, 210, 255, 196, 38, 97, 209, 214, 78, 78, 78, 118, 148, 141, 177, 81, 192, 184, 88, 135, 0, 132, 248, 188, 96, 9, 65, 154, 255, 196, 17, 114, 189, 157, 125, 110, 14, 144, 146, 151, 107, 78, 126, 242, 215, 97, 59, 28, 174, 177, 176, 30, 121, 149, 125, 197, 97, 101, 158, 126, 142, 58, 90, 166, 164, 164, 44, 142, 100, 150, 220, 70, 124, 186, 54, 184, 68, 76, 162, 152, 112, 137, 114, 107, 181, 189, 17, 178, 163, 111, 102, 99, 57, 196, 231, 49, 167, 76, 100, 216, 143, 90, 93, 139, 155, 198, 103, 99, 151, 133, 152, 117, 22, 152, 217, 175, 171, 69, 78, 157, 210, 102, 89, 149, 58, 139, 215, 20, 126, 172, 171, 201, 79, 99, 115, 204, 33, 186, 115, 100, 181, 64, 101, 156, 144, 156, 237, 82, 85, 119, 76, 155, 147, 56, 134, 226, 148, 88, 105, 114, 163, 166, 88, 97, 137, 172, 150, 103, 51, 131, 141, 151, 161, 93, 78, 167, 193, 61, 74, 144, 128, 171, 123, 30, 134, 155, 201, 208, 84, 21, 138, 138, 124, 156, 87, 94, 146, 138, 77, 154, 133, 144, 158, 52, 149, 175, 136, 178, 72, 33, 151, 226, 177, 99, 101, 58, 145, 171, 158, 134, 140, 99, 104, 72, 65, 194, 197, 169, 137, 110, 39, 190, 124, 77, 111, 100, 133, 137, 169, 80, 170, 162, 116, 236, 54, 27, 147, 169, 138, 100, 119, 62, 186, 136, 117, 136, 92, 230, 102, 121, 111, 180, 105, 147, 147, 0, 156, 156, 155, 120, 117, 90, 163, 170, 132, 131, 130, 139, 53, 80, 79, 149, 220, 109, 147, 59, 62, 180, 141, 147, 92, 164, 105, 205, 72, 60, 139, 114, 167, 118, 96, 94, 205, 218, 113, 114, 38, 64, 173, 180, 110, 56, 137, 104, 189, 131, 106, 147, 118, 180, 124, 65, 113, 158, 110, 181, 120, 106, 121, 179, 82, 121, 131, 98, 199, 95, 74, 120, 82, 187, 178, 121, 134, 164, 126, 89, 138, 76, 102, 178, 121, 159, 63, 115, 205, 152, 116, 146, 110, 95, 182, 90, 143, 130, 139, 164, 108, 80, 154, 138, 140, 144, 53, 122, 164, 133, 139, 87, 119, 127, 146, 142, 115, 130, 145, 190, 91, 76, 122, 112, 127, 143, 80, 101, 181, 86, 174, 116, 98, 130, 167, 129, 85, 135, 152, 134, 144, 102, 112, 119, 109, 183, 128, 137, 126, 139, 132, 139, 135, 127, 142, 72, 73, 153, 137, 173, 170, 50, 80, 129, 194, 151, 165, 70, 63, 131, 142, 144, 97, 113, 181, 196, 103, 79, 133, 82, 184, 168, 114, 95, 97, 204, 144, 123, 48, 75, 173, 139, 188, 121, 112, 148, 135, 136, 149, 135, 142, 106, 78, 105, 96, 157, 165, 207, 99, 82, 121, 121, 108, 142, 155, 113, 183, 75, 132, 148, 142, 114, 114, 98, 94, 127, 138, 141, 155, 145, 116, 183, 93, 166, 82, 122, 169, 92, 169, 130, 123, 66, 122, 133, 84, 178, 130, 160, 172, 99, 140, 107, 140, 45, 137, 160, 122, 155, 134, 115, 115, 136, 120, 160, 79, 145, 140, 111, 91, 123, 179, 120, 180, 105, 73, 135, 90, 220, 111, 116, 100, 96, 145, 117, 182, 79, 180, 96, 114, 124, 116, 202, 126, 133, 95, 73, 113, 127, 180, 154, 73, 134, 136, 160, 105, 130, 102, 182, 133, 132, 91, 95, 171, 134, 169, 27, 134, 122, 154, 169, 106, 107, 108, 176, 131, 166, 95, 107, 162, 112, 94, 156, 88, 154, 164, 120, 120, 140, 120, 190, 144, 87, 114, 139, 134, 150, 191, 44, 155, 146, 92, 145, 142, 123, 89, 133, 91, 181, 142, 111, 161, 134, 100, 134, 180, 93, 166, 101, 91, 180, 36, 192, 122, 130, 146, 143, 75, 56, 233, 129, 116, 120, 105, 102, 130, 175, 145, 125, 90, 177, 138, 70, 152, 89, 128, 139, 141, 124, 93, 214, 122, 105, 76, 99, 108, 168, 174, 130, 125, 52, 139, 88, 154, 159, 139, 133, 29, 173, 90, 180, 163, 128, 134, 111, 131, 110, 142, 123, 123, 151, 157, 124, 111, 121, 121, 147, 131, 90, 124, 140, 174, 89, 81, 120, 139, 162, 160, 152, 109, 127, 130, 127, 128, 142, 69, 172, 123, 90, 131, 125, 187, 176, 129, 76, 83, 122, 147, 178, 96, 135, 128, 84, 182, 88, 111, 161, 151, 165, 125, 115, 111, 120, 118, 121, 164, 109, 137, 137, 124, 124, 106, 145, 134, 124, 113, 141, 154, 81, 122, 77, 102, 192, 170, 152, 132, 108, 100, 70, 172, 142, 127, 154, 57, 119, 79, 138, 200, 147, 133, 52, 99, 90, 158, 179, 60, 151, 115, 121, 141, 126, 135, 149, 165, 108, 130, 82, 99, 146, 91, 169, 122, 111, 144, 137, 124, 139, 168, 91, 108, 152, 92, 130, 111, 98, 167, 90, 176, 151, 87, 164, 56, 160, 116, 131, 145, 95, 170, 159, 155, 106, 46, 181, 78, 180, 113, 116, 164, 84, 171, 109, 115, 110, 146, 173, 131, 124, 91, 133, 159, 169, 108, 76, 151, 109, 171, 91, 132, 140, 96, 172, 124, 113, 66, 162, 116, 199, 80, 124, 119, 122, 117, 149, 96, 53, 231, 103, 135, 168, 144, 159, 123, 100, 131, 141, 137, 135, 111, 40, 168, 134, 124, 162, 92, 106, 82, 163, 108, 170, 143, 142, 151, 76, 128, 133, 155, 128, 157, 69, 105, 136, 136, 115, 137, 144, 107, 139, 88, 103, 165, 142, 174, 105, 78, 79, 162, 100, 115, 172, 93, 173, 153, 148, 124, 76, 142, 125, 132, 142, 120, 144, 103, 142, 106, 103, 209, 108, 98, 101, 146, 132, 171, 144, 108, 89, 126, 166, 149, 134, 94, 120, 130, 112, 101, 129, 152, 168, 151, 106, 71, 161, 129, 147, 138, 63, 136, 146, 152, 122, 73, 53, 185, 115, 135, 166, 93, 131, 142, 134, 98, 157, 96, 187, 153, 93, 117, 94, 123, 171, 104, 89, 129, 163, 159, 140, 161, 93, 118, 110, 108, 150, 99, 142, 142, 85, 135, 159, 147, 172, 120, 123, 70, 144, 155, 124, 136, 110, 102, 133, 144, 141, 140, 105, 115, 110, 95, 138, 160, 191, 137, 102, 138, 104, 148, 122, 113, 154, 117, 185, 121, 70, 121, 119, 129, 166, 104, 91, 102, 193, 138, 101, 114, 38, 172, 157, 136, 157, 106, 162, 113, 82, 136, 101, 140, 167, 138, 114, 74, 179, 75, 152, 150, 95, 87, 112, 144, 129, 175, 122, 165, 121, 68, 96, 152, 149, 130, 137, 61, 142, 119, 163, 196, 129, 149, 117, 105, 99, 169, 104, 157, 135, 82, 96, 95, 211, 112, 142, 111, 114, 170, 132, 126, 117, 112, 112, 149, 136, 115, 138, 158, 136, 124, 122, 135, 129, 111, 137, 103, 87, 162, 172, 95, 128, 125, 127, 143, 172, 119, 66, 120, 103, 159, 136, 128, 132, 155, 117, 144, 89, 149, 156, 122, 128, 73, 147, 119, 155, 128, 106, 147, 83, 174, 127, 91, 118, 106, 176, 88, 114, 111, 106, 189, 126, 134, 96, 143, 109, 167, 126, 90, 153, 146, 152, 106, 124, 120, 144, 109, 127, 118, 36, 149, 169, 116, 135, 147, 103, 124, 142, 108, 142, 99, 136, 156, 86, 184, 120, 154, 93, 100, 130, 94, 173, 78, 194, 118, 149, 102, 70, 161, 125, 197, 103, 105, 114, 96, 133, 177, 161, 70, 130, 128, 182, 120, 109, 143, 127, 127, 138, 145, 74, 191, 118, 126, 107, 103, 155, 161, 140, 76, 91, 91, 180, 165, 148, 66, 114, 144, 180, 135, 145, 77, 123, 117, 116, 151, 73, 180, 121, 123, 120, 102, 125, 117, 143, 132, 147, 140, 90, 113, 170, 97, 154, 149, 88, 127, 55, 135, 112, 150, 169, 87, 117, 160, 135, 129, 85, 172, 120, 101, 157, 137, 133, 137, 118, 121, 91, 125, 140, 88, 155, 72, 159, 151, 102, 154, 89, 136, 136, 169, 101, 110, 118, 98, 180, 105, 106, 116, 123, 155, 152, 146, 99, 164, 68, 111, 166, 110, 185, 149, 104, 95, 128, 146, 152, 148, 78, 119, 111, 127, 169, 134, 79, 99, 133, 152, 161, 88, 144, 109, 100, 141, 110, 194, 118, 139, 68, 106, 165, 144, 177, 109, 110, 96, 128, 156, 110, 111, 119, 107, 181, 145, 121, 98, 124, 159, 150, 112, 79, 152, 105, 186, 109, 145, 75, 136, 182, 123, 126, 101, 162, 93, 122, 132, 144, 120, 146, 97, 74, 125, 146, 176, 97, 120, 115, 89, 186, 140, 150, 120, 137, 144, 103, 116, 126, 141, 85, 122, 132, 132, 144, 132, 107, 118, 148, 114, 185, 117, 107, 112, 111, 156, 141, 131, 55, 144, 141, 128, 135, 107, 123, 130, 155, 136, 134, 90, 167, 130, 139, 135, 125, 132, 86, 116
};
// ride 1500
const char ride[] PROGMEM = {
126, 126, 126, 126, 126, 126, 127, 127, 120, 99, 127, 180, 190, 103, 255, 199, 171, 255, 255, 157, 50, 24, 213, 181, 112, 72, 128, 106, 163, 153, 71, 96, 118, 208, 163, 95, 73, 67, 109, 197, 143, 87, 94, 75, 141, 171, 128, 129, 100, 74, 148, 144, 138, 128, 123, 163, 171, 145, 128, 81, 78, 130, 133, 139, 90, 72, 126, 130, 174, 139, 87, 86, 103, 134, 138, 112, 123, 138, 147, 138, 105, 96, 113, 137, 137, 132, 87, 37, 112, 213, 190, 163, 135, 108, 123, 172, 126, 82, 44, 81, 145, 143, 130, 107, 91, 146, 166, 161, 109, 26, 48, 146, 181, 200, 108, 78, 103, 130, 158, 151, 55, 85, 117, 102, 158, 118, 84, 128, 160, 198, 204, 98, 115, 124, 133, 172, 80, 84, 105, 108, 183, 123, 122, 120, 94, 164, 168, 81, 115, 102, 118, 192, 124, 87, 101, 84, 155, 164, 105, 99, 90, 110, 173, 132, 150, 131, 124, 167, 181, 171, 127, 68, 111, 191, 125, 130, 90, 109, 172, 161, 148, 114, 66, 81, 127, 131, 142, 141, 100, 147, 157, 160, 104, 109, 118, 124, 151, 87, 67, 86, 105, 161, 150, 150, 175, 144, 144, 162, 190, 109, 75, 90, 99, 131, 147, 132, 119, 141, 137, 155, 164, 84, 116, 112, 122, 163, 136, 109, 138, 111, 122, 143, 102, 107, 104, 121, 114, 102, 146, 147, 92, 109, 151, 175, 182, 153, 94, 113, 73, 143, 106, 81, 158, 164, 130, 179, 94, 75, 131, 109, 137, 101, 81, 169, 124, 162, 168, 102, 104, 147, 123, 105, 48, 97, 137, 99, 184, 143, 96, 168, 184, 148, 185, 88, 86, 82, 77, 119, 114, 84, 124, 110, 145, 185, 130, 75, 67, 86, 146, 114, 136, 97, 106, 201, 152, 117, 66, 87, 174, 153, 90, 87, 35, 98, 192, 174, 149, 105, 102, 173, 181, 141, 83, 67, 95, 110, 145, 167, 55, 83, 120, 176, 180, 118, 52, 49, 98, 150, 215, 141, 101, 102, 150, 140, 82, 80, 68, 100, 150, 129, 164, 98, 125, 190, 164, 146, 171, 121, 151, 140, 91, 102, 110, 115, 182, 117, 130, 159, 112, 137, 139, 50, 88, 64, 114, 181, 131, 147, 140, 95, 208, 153, 81, 109, 18, 104, 164, 141, 144, 113, 96, 176, 160, 192, 202, 107, 123, 132, 123, 115, 79, 106, 134, 129, 164, 152, 93, 128, 106, 137, 131, 112, 147, 102, 153, 164, 129, 132, 115, 87, 149, 132, 82, 98, 91, 154, 154, 141, 188, 94, 113, 132, 139, 146, 133, 123, 130, 98, 119, 156, 112, 145, 169, 138, 125, 106, 77, 108, 89, 167, 179, 154, 129, 86, 154, 174, 131, 126, 54, 60, 102, 91, 149, 173, 105, 154, 133, 150, 165, 131, 144, 148, 91, 170, 95, 77, 131, 105, 129, 144, 144, 163, 103, 108, 143, 83, 59, 78, 101, 200, 202, 83, 107, 92, 148, 185, 66, 67, 84, 100, 157, 176, 109, 114, 99, 128, 170, 164, 164, 90, 109, 136, 117, 94, 94, 111, 126, 128, 125, 131, 94, 106, 118, 124, 147, 138, 95, 112, 164, 194, 146, 84, 89, 93, 92, 105, 91, 105, 151, 193, 143, 93, 84, 127, 175, 185, 153, 69, 44, 109, 159, 193, 152, 70, 109, 150, 150, 151, 112, 108, 74, 81, 108, 164, 170, 117, 134, 127, 162, 175, 136, 14, 43, 72, 157, 158, 89, 133, 117, 141, 192, 129, 140, 117, 111, 156, 144, 102, 121, 66, 142, 179, 132, 151, 105, 50, 134, 127, 161, 144, 68, 113, 121, 165, 210, 146, 93, 88, 117, 120, 80, 103, 149, 175, 170, 148, 69, 120, 146, 167, 160, 81, 94, 116, 120, 188, 153, 71, 123, 106, 146, 157, 104, 108, 86, 117, 155, 95, 119, 143, 143, 198, 187, 127, 104, 79, 121, 148, 138, 90, 99, 100, 206, 222, 117, 101, 90, 124, 186, 144, 100, 94, 102, 151, 173, 129, 100, 88, 90, 180, 174, 111, 76, 77, 118, 175, 156, 120, 93, 116, 175, 190, 130, 70, 37, 84, 173, 194, 130, 95, 66, 153, 204, 185, 129, 96, 64, 181, 148, 119, 138, 109, 150, 121, 85, 122, 86, 111, 167, 130, 118, 67, 66, 157, 160, 177, 131, 77, 118, 137, 161, 112, 60, 69, 129, 155, 190, 150, 104, 142, 139, 163, 154, 99, 68, 121, 165, 167, 105, 86, 131, 130, 158, 136, 84, 126, 99, 132, 130, 114, 116, 96, 105, 178, 160, 132, 117, 94, 109, 140, 121, 78, 82, 114, 167, 144, 127, 113, 111, 137, 172, 139, 100, 84, 136, 175, 176, 133, 59, 72, 141, 160, 160, 120, 102, 89, 117, 156, 163, 131, 127, 98, 132, 154, 154, 110, 61, 99, 135, 131, 124, 93, 102, 126, 196, 173, 116, 87, 83, 150, 143, 151, 123, 90, 152, 166, 140, 116, 98, 109, 153, 135, 128, 85, 106, 161, 129, 143, 130, 127, 160, 151, 145, 126, 75, 88, 121, 128, 150, 145, 121, 130, 146, 163, 162, 102, 88, 106, 115, 173, 149, 98, 109, 109, 154, 158, 111, 101, 84, 135, 166, 131, 103, 111, 124, 154, 154, 135, 130, 113, 131, 147, 119, 112, 103, 96, 139, 160, 168, 133, 115, 124, 129, 137, 145, 99, 116, 148, 135, 179, 111, 100, 103, 116, 173, 127, 80, 90, 104, 162, 158, 130, 114, 109, 136, 168, 120, 107, 89, 95, 125, 133, 120, 113, 105, 145, 175, 156, 126, 93, 90, 153, 157, 118, 97, 111, 156, 166, 148, 110, 77, 95, 152, 152, 143, 75, 84, 133, 146, 186, 131, 71, 108, 146, 177, 159, 93, 89, 99, 126, 155, 129, 94, 109, 136, 164, 176, 115, 82, 74, 134, 185, 152, 96, 89, 99, 147, 172, 114, 93, 74, 115, 156, 134, 130, 112, 109, 155, 155, 120, 103, 123, 133, 145, 132, 102, 88, 110, 145, 147, 136, 121, 115, 124, 152, 141, 116, 81, 113, 141, 152, 159, 117, 96, 123, 145, 151, 95, 95, 105, 122, 157, 150, 93, 110, 119, 159, 165, 121, 110, 101, 119, 171, 130, 104, 106, 105, 141, 156, 174, 137, 113, 116, 139, 134, 133, 123, 104, 135, 151, 147, 122, 96, 124, 139, 128, 119, 89, 97, 148, 151, 145, 135, 93, 107, 126, 153, 160, 103, 100, 101, 114, 141, 137, 132, 125, 115, 141, 151, 128, 133, 108, 117, 143, 147, 134, 123, 108, 137, 163, 128, 113, 92, 104, 146, 140, 137, 118, 116, 135, 145, 148, 131, 109, 109, 137, 130, 124, 107, 99, 117, 127, 144, 131, 120, 139, 139, 135, 119, 118, 100, 129, 149, 148, 127, 117, 117, 138, 148, 144, 103, 91, 94, 138, 161, 138, 131, 97, 119, 148, 150, 124, 113, 107, 126, 130, 127, 108, 89, 140, 142, 137, 126, 107, 118, 139, 150, 143, 92, 94, 137, 146, 158, 140, 111, 105, 115, 128, 119, 117, 111, 127, 128, 156, 150, 110, 130, 125, 138, 138, 110, 122, 104, 116, 151, 119, 116, 118, 115, 148, 154, 117, 107, 98, 121, 152, 130, 127, 109, 108, 143, 142, 132, 118, 111, 116, 112, 106, 126, 132, 134, 144, 128, 123, 115, 117, 147, 141, 127, 112, 110, 126, 126, 125, 138, 127, 129, 122, 135, 142, 128, 121, 126, 119, 133, 134, 125, 132, 131, 134, 136, 102, 104, 126, 123, 131, 132, 126, 122, 120, 130, 146, 141, 116, 108, 103, 141, 141, 125, 124, 117, 136, 121, 122, 134, 129, 135, 129, 126, 133, 132, 128, 119, 127, 146, 130, 121, 128, 126, 125, 114, 106, 117, 118, 126, 144, 129, 129, 127, 111, 135, 157, 129, 114, 99, 105, 137, 132, 125, 137, 114, 138, 136, 123, 145, 127, 125, 129, 123, 134, 125, 119, 139, 142, 141, 138, 110, 104, 127, 122, 132, 128, 118, 128, 126, 137, 143, 128, 114, 121, 128, 125, 128, 118, 117, 132, 133, 119, 121, 122, 128, 143, 118, 127, 121, 112, 139, 140, 123, 130, 117, 130, 137, 131, 122, 106, 103, 124, 132, 133, 131, 121, 123, 141, 138, 130, 121, 114, 127, 116, 130, 128, 110, 128, 143, 134, 118, 112, 126, 135, 136, 131, 118, 109, 121, 131, 149, 141, 125, 120, 111, 135, 132, 106, 121, 118, 121, 133, 128, 123, 127, 137, 141, 131, 107, 121, 113, 120, 149, 134, 118, 117, 108, 131, 134, 134, 137, 116, 118, 131, 122, 132, 133, 115, 135, 127, 123, 131, 116, 128, 128, 114, 124, 119, 122, 133, 134, 129, 130, 125, 128, 132, 131, 118, 113, 122, 134, 128, 131, 113, 127, 135, 122, 133, 121, 123, 133, 124, 129, 125, 122, 127, 129, 138, 140, 125, 109, 114, 121, 136, 125, 120, 123, 130, 136, 135, 136, 134, 121, 116, 122, 130, 120, 121, 124, 131, 134, 115, 117, 125, 135, 136, 120, 117, 113, 138, 139, 124, 133, 122, 126, 131, 126, 131, 127, 117, 126, 123, 121, 123, 120
};
// kick 3 1000
const char kick3[] PROGMEM = {
127, 128, 127, 126, 36, 163, 127, 125, 102, 108, 88, 92, 105, 95, 113, 56, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 108, 179, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 207, 186, 159, 143, 127, 110, 113, 109, 106, 93, 77, 59, 31, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 12, 25, 43, 54, 69, 83, 98, 113, 123, 133, 140, 141, 138, 136, 139, 142, 146, 152, 162, 172, 182, 193, 208, 224, 235, 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 253, 250, 244, 234, 230, 224, 220, 218, 221, 224, 223, 224, 223, 222, 222, 221, 219, 215, 206, 195, 181, 167, 152, 138, 127, 117, 105, 94, 82, 69, 60, 52, 47, 45, 42, 37, 33, 29, 25, 22, 18, 17, 19, 20, 21, 23, 24, 25, 25, 24, 24, 26, 29, 31, 31, 27, 23, 20, 17, 18, 23, 32, 42, 56, 67, 81, 93, 106, 121, 136, 151, 164, 173, 180, 186, 191, 196, 202, 205, 207, 209, 213, 215, 219, 221, 223, 225, 228, 232, 234, 237, 240, 244, 246, 246, 246, 244, 240, 232, 223, 213, 202, 190, 176, 165, 156, 146, 138, 131, 124, 120, 117, 116, 116, 120, 122, 124, 127, 129, 130, 131, 129, 128, 126, 123, 120, 117, 113, 109, 106, 105, 106, 108, 110, 112, 113, 113, 114, 112, 110, 108, 105, 102, 98, 93, 85, 78, 71, 66, 62, 60, 59, 58, 57, 57, 57, 58, 59, 59, 60, 61, 62, 63, 64, 64, 66, 69, 74, 79, 86, 94, 104, 116, 126, 136, 145, 154, 163, 173, 182, 189, 195, 201, 206, 212, 216, 220, 224, 228, 234, 240, 246, 251, 255, 255, 255, 255, 255, 255, 255, 255, 254, 243, 229, 213, 195, 181, 166, 152, 140, 129, 120, 115, 111, 110, 112, 118, 121, 124, 128, 131, 133, 132, 130, 127, 124, 120, 116, 111, 106, 100, 96, 96, 98, 101, 104, 106, 107, 108, 108, 105, 103, 99, 95, 90, 84, 76, 66, 55, 46, 38, 34, 31, 30, 29, 28, 28, 28, 29, 31, 31, 32, 33, 34, 37, 38, 38, 41, 44, 51, 60, 70, 81, 95, 109, 122, 132, 142, 152, 161, 170, 178, 185, 191, 195, 198, 201, 203, 206, 207, 208, 210, 210, 212, 214, 216, 220, 225, 228, 229, 228, 227, 226, 223, 222, 220, 219, 217, 214, 210, 207, 204, 203, 201, 200, 198, 196, 190, 186, 180, 177, 174, 172, 169, 166, 164, 163, 164, 164, 167, 171, 175, 178, 181, 184, 185, 186, 186, 185, 184, 183, 180, 177, 171, 163, 155, 143, 131, 117, 105, 91, 78, 66, 53, 40, 29, 19, 13, 8, 5, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 14, 24, 37, 52, 68, 84, 101, 117, 131, 144, 155, 161, 164, 163, 159, 155, 150, 145, 138, 131, 124, 119, 114, 111, 109, 109, 109, 110, 111, 112, 114, 115, 117, 119, 122, 126, 131, 136, 142, 148, 157, 167, 177, 188, 200, 211, 224, 234, 243, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 243, 229, 215, 201, 187, 173, 161, 149, 138, 127, 118, 110, 104, 98, 93, 87, 83, 78, 72, 66, 60, 56, 52, 49, 46, 45, 45, 47, 50, 54, 58, 63, 69, 74, 79, 84, 89, 93, 96, 97, 98, 97, 96, 94, 93, 91, 88, 86, 81, 77, 74, 72, 70, 71, 71, 71, 72, 73, 74, 76, 78, 82, 85, 87, 88, 86, 85, 83, 81, 80, 80, 82, 85, 90, 95, 101, 106, 113, 120, 128, 136, 144, 151, 158, 165, 172, 178, 184, 191, 198, 205, 213, 221, 229, 236, 240, 243, 246, 247, 246, 245, 243, 241, 238, 234, 230, 225, 220, 215, 210, 206, 202, 195, 189, 182, 173, 164, 154, 144, 135, 126, 118, 112, 107, 105, 103, 103, 105, 105, 105, 107, 108, 112, 115, 120, 124, 128, 131, 133, 134, 135, 137, 137, 138, 138, 137, 136, 132, 128, 124, 120, 115, 110, 104, 98, 92, 85, 78, 72, 65, 58, 51, 44, 38, 33, 28, 26, 24, 24, 25, 27, 30, 35, 40, 45, 52, 57, 63, 67, 70, 73, 76, 80, 85, 89, 93, 98, 105, 113, 122, 132, 143, 152, 159, 165, 168, 169, 170, 166, 162, 157, 151, 145, 137, 130, 123, 116, 109, 101, 94, 87, 81, 74, 67, 60, 53, 46, 40, 34, 29, 26, 23, 22, 23, 24, 27, 31, 35, 41, 47, 54, 59, 65, 69, 72, 75, 78, 82, 86, 90, 96, 102, 109, 118, 127, 138, 148, 159, 168, 175, 181, 185, 187, 188, 188, 187, 185, 181, 177, 172, 169, 167, 166, 166, 166, 165, 164, 164, 163, 163, 164, 165, 166, 167, 169, 170, 171, 171, 172, 173, 172, 171, 170, 169, 167, 166, 164, 163, 162, 161, 160, 159, 159, 160, 161, 162, 163, 163, 163, 163, 162, 161, 160, 159, 157, 154, 151, 147, 143, 140, 136, 133, 130, 126, 122, 117, 112, 107, 103, 99, 96, 93, 89, 86, 84, 82, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 78, 78, 77, 77, 76, 76, 75, 75, 75, 76, 77, 79, 81, 84, 87, 90, 94, 98, 103, 108, 112, 117, 121, 125, 129, 132, 134, 136, 137, 138, 137, 136, 134, 132, 131, 129, 128, 127, 127, 128, 129, 131, 133, 135, 136, 138, 139, 140, 141, 141, 140, 140, 139, 139, 139, 139, 140, 141, 143, 145, 147, 150, 152, 155, 157, 159, 161, 162, 163, 163, 163, 163, 162, 161, 160, 158, 156, 154, 151, 149, 147, 145, 144, 142, 142, 140, 139, 138, 135, 132, 129
};
// snare 3 1000
const char snare3[] PROGMEM = {
127, 127, 127, 127, 127, 165, 160, 68, 103, 143, 116, 248, 186, 113, 49, 55, 76, 170, 244, 255, 255, 221, 129, 86, 18, 12, 63, 77, 116, 184, 255, 255, 255, 255, 192, 159, 95, 37, 0, 0, 0, 0, 34, 90, 111, 159, 231, 255, 255, 255, 255, 201, 191, 116, 19, 0, 0, 0, 12, 60, 82, 153, 167, 255, 255, 255, 255, 236, 181, 87, 7, 0, 0, 0, 12, 40, 132, 153, 190, 238, 218, 255, 255, 221, 212, 159, 81, 30, 7, 0, 0, 0, 62, 67, 191, 203, 255, 238, 255, 255, 202, 108, 110, 82, 34, 78, 70, 55, 48, 81, 100, 138, 182, 214, 168, 154, 158, 143, 140, 178, 169, 104, 128, 124, 111, 81, 64, 117, 121, 76, 47, 120, 116, 131, 183, 109, 205, 169, 177, 188, 102, 99, 94, 123, 48, 13, 78, 80, 116, 88, 104, 156, 172, 197, 183, 190, 147, 142, 179, 126, 119, 136, 95, 43, 45, 50, 90, 113, 112, 122, 176, 210, 174, 181, 167, 175, 153, 111, 84, 96, 94, 105, 91, 85, 104, 85, 155, 200, 148, 172, 166, 138, 134, 143, 152, 120, 79, 123, 120, 93, 109, 102, 128, 65, 118, 107, 159, 151, 126, 182, 138, 142, 142, 159, 183, 96, 142, 108, 117, 43, 87, 103, 122, 109, 140, 139, 103, 152, 180, 137, 151, 136, 132, 146, 126, 131, 144, 154, 105, 110, 97, 72, 72, 67, 126, 139, 158, 156, 169, 197, 172, 177, 153, 124, 74, 68, 60, 101, 61, 136, 102, 103, 141, 153, 165, 151, 158, 145, 149, 140, 84, 72, 103, 107, 121, 125, 108, 115, 89, 130, 130, 131, 155, 121, 109, 135, 102, 153, 116, 105, 147, 121, 96, 124, 127, 76, 132, 124, 87, 134, 123, 153, 178, 118, 159, 126, 87, 103, 89, 124, 117, 121, 138, 113, 127, 110, 112, 101, 108, 104, 138, 150, 144, 154, 130, 161, 137, 129, 113, 109, 91, 83, 89, 72, 133, 171, 123, 116, 163, 158, 141, 120, 149, 136, 115, 94, 114, 86, 111, 70, 113, 94, 121, 139, 127, 149, 135, 173, 119, 140, 113, 137, 120, 92, 99, 88, 95, 143, 130, 161, 111, 143, 152, 128, 109, 109, 108, 116, 131, 93, 133, 132, 133, 123, 125, 112, 103, 152, 130, 99, 135, 130, 105, 124, 142, 140, 111, 95, 136, 150, 115, 137, 146, 130, 125, 120, 118, 107, 118, 136, 110, 119, 126, 155, 165, 165, 138, 138, 124, 110, 100, 92, 102, 107, 99, 108, 114, 133, 143, 156, 143, 131, 143, 140, 136, 94, 101, 115, 89, 98, 121, 148, 142, 157, 143, 128, 136, 134, 146, 158, 122, 118, 114, 95, 106, 125, 119, 125, 126, 115, 94, 114, 149, 147, 134, 155, 154, 142, 125, 137, 102, 100, 111, 104, 119, 125, 111, 125, 118, 146, 160, 143, 156, 137, 132, 131, 109, 117, 115, 132, 126, 106, 121, 98, 108, 120, 131, 149, 158, 140, 158, 142, 157, 128, 127, 99, 89, 111, 125, 127, 129, 116, 112, 129, 130, 121, 152, 140, 137, 143, 139, 144, 128, 124, 108, 117, 92, 108, 94, 118, 109, 131, 130, 152, 138, 165, 159, 146, 144, 142, 113, 119, 91, 117, 109, 118, 129, 135, 127, 128, 133, 137, 150, 143, 150, 133, 131, 115, 118, 109, 119, 102, 131, 119, 117, 126, 130, 140, 149, 147, 148, 139, 138, 135, 128, 117, 115, 127, 112, 112, 107, 116, 126, 123, 148, 146, 143, 150, 139, 127, 141, 121, 131, 103, 108, 131, 119, 126, 119, 127, 129, 140, 136, 148, 128, 137, 124, 122, 129, 123, 131, 139, 137, 121, 121, 118, 118, 112, 125, 135, 133, 133, 136, 132, 133, 147, 137, 127, 124, 130, 123, 130, 124, 120, 128, 118, 124, 127, 140, 138, 138, 141, 151, 129, 122, 119, 115, 119, 126, 126, 131, 134, 137, 136, 141, 132, 134, 127, 123, 126, 126, 121, 131, 119, 121, 126, 125, 127, 142, 140, 131, 135, 127, 127, 123, 122, 121, 127, 123, 125, 132, 131, 129, 141, 139, 151, 141, 132, 132, 126, 123, 117, 120, 117, 118, 132, 128, 135, 139, 138, 140, 135, 136, 126, 126, 135, 127, 130, 129, 127, 124, 122, 118, 129, 130, 129, 132, 139, 136, 135, 133, 135, 130, 128, 132, 128, 121, 122, 117, 122, 130, 132, 134, 133, 136, 137, 137, 140, 131, 129, 129, 126, 127, 122, 120, 127, 122, 127, 128, 134, 136, 136, 142, 138, 135, 130, 128, 123, 124, 123, 126, 126, 124, 128, 131, 131, 136, 136, 137, 136, 128, 127, 128, 130, 126, 128, 129, 132, 131, 132, 132, 128, 131, 128, 125, 126, 128, 130, 132, 133, 132, 131, 132, 132, 131, 132, 127, 126, 125, 125, 129, 128, 134, 133, 132, 129, 131, 130, 129, 132, 132, 131, 132, 130, 126, 125, 126, 125, 128, 128, 129, 128, 132, 132, 136, 132, 133, 132, 128, 126, 126, 128, 124, 125, 127, 128, 127, 129, 130, 134, 132, 132, 132, 132, 131, 132, 130, 128, 126, 127, 126, 125, 126, 129, 131, 130, 133, 134, 134, 130, 132, 129, 129, 127, 130, 128, 130, 128, 129, 127, 128, 127, 128, 130, 132, 133, 132, 131, 129, 127, 128, 128, 128, 129, 130, 129, 127, 130, 129, 128, 130, 128, 129, 130, 129, 130, 130, 131, 131, 130, 128, 128, 127, 127, 128, 129, 130, 129, 128, 129, 129, 129, 131, 130, 131, 130, 129, 128, 129, 129, 130, 130, 129, 127, 126, 126, 128, 128, 130, 132, 132, 132, 130, 129, 126, 127, 128, 128, 128, 128, 128, 129, 129, 129, 129, 130, 129, 128, 130, 130, 129, 129, 129, 128, 128, 127, 128, 128, 129, 129, 129, 129, 129, 128, 128, 129, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 127, 127, 127, 128, 129, 129, 130, 130, 129, 129, 128, 129, 129, 129, 128, 128, 127, 126, 126, 127, 128
};
// ride 2 4000
const char ride2[] PROGMEM = {
127, 0
};
byte triangle[] = {
B00000001,
B00000010,
B00000100,
B00001000,
B00010000,
B00100000,
B01000000,
B10000000,
B01000000,
B00100000,
B00010000,
B00001000,
B00000100,
B00000010,
};
// Combined Register Arrays
byte regB0[] = {
0, 0, 0, 0, 0, 0
};
byte regB4[] = {
0, 0, 0, 0, 0, 0
};
byte reg30[] = {
0, 0, 0, 0, 0, 0
};
byte reg34[] = {
0, 0, 0, 0, 0, 0
};
byte reg38[] = {
0, 0, 0, 0, 0, 0
};
byte reg3c[] = {
0, 0, 0, 0, 0, 0
};
byte reg50[] = {
0, 0, 0, 0, 0, 0
};
byte reg54[] = {
0, 0, 0, 0, 0, 0
};
byte reg58[] = {
0, 0, 0, 0, 0, 0
};
byte reg5c[] = {
0, 0, 0, 0, 0, 0
};
byte reg60[] = {
0, 0, 0, 0, 0, 0
};
byte reg64[] = {
0, 0, 0, 0, 0, 0
};
byte reg68[] = {
0, 0, 0, 0, 0, 0
};
byte reg6c[] = {
0, 0, 0, 0, 0, 0
};
byte reg80[] = {
0, 0, 0, 0, 0, 0
};
byte reg84[] = {
0, 0, 0, 0, 0, 0
};
byte reg88[] = {
0, 0, 0, 0, 0, 0
};
byte reg8c[] = {
0, 0, 0, 0, 0, 0
};
// Total Levels
byte TL1[] = {
127, 127, 127, 127, 127, 127
};
byte TL2[] = {
127, 127, 127, 127, 127, 127
};
byte TL3[] = {
127, 127, 127, 127, 127, 127
};
byte TL4[] = {
127, 127, 127, 127, 127, 127
};
/* Presets */
// 0 = lead 1
// 1 = bass 1
// 2 = church organ
// 3 = xylophone
// 4 = string pizzicato
// 5 = brass 1
byte ALGO[16] = { 37, 62, 127, 127, 35, 0, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte FB[16] = { 0, 65, 0, 0, 0, 0, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte TLOP1[16] = { 127, 100, 100, 120, 127, 127, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte TLOP2[16] = { 127, 103, 103, 113, 127, 127, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte TLOP3[16] = { 127, 108, 108, 107, 127, 127, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte TLOP4[16] = { 127, 127, 127, 127, 127, 127, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte MULOP1[16] = { 0, 0, 25, 29, 0, 0, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte MULOP2[16] = { 0, 0, 18, 55, 0, 0, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte MULOP3[16] = { 30, 10, 8, 36, 0, 0, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte MULOP4[16] = { 0, 0, 0, 0, 0, 0, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DETUNEOP1[16] = { 0, 0, 0, 0, 0, 27, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DETUNEOP2[16] = { 0, 0, 0, 0, 0, 9, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DETUNEOP3[16] = { 0, 0, 0, 0, 0, 18, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DETUNEOP4[16] = { 0, 0, 0, 0, 0, 70, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte ATTACKOP1[16] = { 127, 127, 127, 127, 122, 54, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte ATTACKOP2[16] = { 127, 127, 127, 127, 123, 49, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte ATTACKOP3[16] = { 127, 127, 127, 127, 120, 41, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte ATTACKOP4[16] = { 127, 127, 127, 127, 118, 89, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DECAY1OP1[16] = { 0, 52, 0, 60, 58, 30, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DECAY1OP2[16] = { 0, 0, 0, 60, 127, 30, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DECAY1OP3[16] = { 0, 0, 0, 60, 122, 30, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DECAY1OP4[16] = { 0, 0, 0, 60, 75, 30, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DECAY2OP1[16] = { 127, 127, 127, 127, 87, 73, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DECAY2OP2[16] = { 127, 127, 127, 127, 68, 51, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DECAY2OP3[16] = { 127, 127, 127, 127, 88, 43, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte DECAY2OP4[16] = { 127, 127, 127, 127, 61, 65, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte AMP2OP1[16] = { 127, 127, 127, 127, 127, 127, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte AMP2OP2[16] = { 127, 127, 127, 127, 127, 127, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte AMP2OP3[16] = { 127, 127, 127, 127, 127, 127, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte AMP2OP4[16] = { 127, 127, 127, 127, 127, 127, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte RELOP1[16] = { 127, 127, 60, 127, 127, 70, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte RELOP2[16] = { 127, 127, 60, 127, 127, 70, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte RELOP3[16] = { 127, 127, 60, 127, 127, 70, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
byte RELOP4[16] = { 127, 127, 60, 127, 127, 70, 96, 112, 0, 16, 32, 48, 64, 80, 96, 112 };
// SN76489 stuff START /////////////////////////////////////
// SN76489 stuff START /////////////////////////////////////
// SN76489 stuff START /////////////////////////////////////
// SN76489 stuff START /////////////////////////////////////
byte working_byte = 0; // working byte for the SN76489 stuff
int pdatInt = 0;
byte pdat1 = 0;
byte pdat2 = 0;
int pitchTable[] =
{
1008, 951, 898, 847, 800, 755, 713, 673, 635, 599, 566, 534, 504,
475, 449, 424, 400, 378, 356, 336, 317, 300, 283, 267, 252, 238,
224, 212, 200, 189, 178, 168, 159, 150, 141, 133, 126, 119, 112,
106, 100, 94, 89, 84, 79, 75, 71, 67, 63, 59, 56, 53, 50, 47, 45,
42, 40, 37, 35, 33, 31, 30, 28, 26, 25, 24, 22, 21, 20, 19, 18, 17,
16, 15, 14, 13, 13, 12, 11, 11, 10, 9, 9,
1017, 960, 906, 855, 807, 762, 719, 679, 641, 605, 571, 539, 508, 480,
453, 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226, 214,
202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113, 107, 101, 95,
90, 85, 80, 76, 71, 67, 64, 60, 57, 53, 50, 48, 45, 42, 40, 38, 36,
34, 32, 30, 28, 27, 25, 24, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
13, 12, 11, 11, 10, 9, 9
};
int coarsePitch[] =
{
64, 64, 64, 64
};
int pitchTableOffset = 0;
// Arrays to hold running state data
byte bend_data[] =
{
64, 64, 64, 64
};
byte bend_MSB[] =
{
64, 64, 64, 64
};
byte pitchData[] =
{
0, 0, 0, 0
};
byte velocityData[] =
{
0, 0, 0, 0
};
byte noiseLookup[] = {
B11100000, // C
B11100000, // C#
B11100001, // D
B11100001, // D#
B11100010, // E
B11100100, // F
B11100101, // F#
B11100110, // G
B11100110, // G#
B11100011, // A
B11100011, // A#
B11100111, // B
};
// SN76489 stuff END /////////////////////////////////////
// SN76489 stuff END /////////////////////////////////////
// SN76489 stuff END /////////////////////////////////////
void setup() {
usbMIDI.setHandlePitchChange(doBend);
usbMIDI.setHandleControlChange(doCC);
usbMIDI.setHandleNoteOn(doNote);
usbMIDI.setHandleNoteOff(doNoteOff);
DDRB = B00001111; // set the direction for PORTB
pinMode(WR, OUTPUT);
pinMode(NB, OUTPUT);
pinMode(AD, OUTPUT);
delay(1);
doCC(1, 77, 127);
delay(1);
doCC(2, 77, 127);
delay(1);
doCC(3, 77, 127);
delay(1);
doCC(4, 77, 127);
delay(1);
doCC(5, 77, 127);
delay(1);
doCC(6, 77, 127);
delay(1);
doCC(1, 9, 40);
delay(1);
doCC(2, 9, 20);
delay(1);
doCC(3, 9, 10);
delay(1);
doCC(4, 9, 20);
delay(1);
doCC(5, 9, 60);
delay(1);
doCC(6, 9, 20);
delay(1);
delay(100);
doNote(1, 36 + 12, 119);
delay(100);
doNote(2, 43 + 12, 119);
delay(100);
doNote(3, 50 + 12, 119);
delay(100);
doNote(4, 62 + 12, 119);
delay(100);
doNote(5, 24 + 12, 119);
delay(100);
doNote(6, 31 + 12, 119);
delay(500);
doNote(1, 36 + 12, 0);
doNote(2, 43 + 12, 0);
doNote(3, 50 + 12, 0);
doNote(4, 62 + 12, 0);
doNote(5, 24 + 12, 0);
doNote(6, 31 + 12, 0);
randomSeed(analogRead(5));
}
void loop() {
doSample();
usbMIDI.read();
}
// Functions
void doNote(byte channel, byte pitch, byte velocity) {
channel --;
if(channel == 5 && sample_on == 1) {
if(pitch >= 60) {
SPB_sound = pitch % 24;
if(velocity > 0) {
SPB_speed = save_speed;
noise_flag = 0;
SPB_flag = 1;
SPB_counter = 0;
SPB_max = sample_length_list[SPB_sound];
}
else {
SPB_flag = 0;
}
}
if(pitch < 60) {
if(velocity > 0) {
SPB_flag = 1;
SPB_counter = 0;
noise_flag = tri_flag;
noise_velocity = 7 - (velocity >> 4);
SPB_speed = 59 - pitch;
}
else {
SPB_flag = 0;
}
}
}
else if(channel >=0 && channel <= 5) {
if(velocity > 0) {
if(polyFlag == 1) {
for(int i = 0; i < 6; i ++) {
if(polyBusy[i] == 0) {
channel = i;
polyBusy[i] = 1;
i = 6;
}
}
}
pitch = pitch - 64 + pitchOffset;
pitchTracking[channel] = pitch;
pitchDouble = pow(2, ((pitch % octDiv) + (0.015625 * bendAmount * (bend[channel] - 64)) + constantDouble) / octDiv) * 440;
pitchInt = (int) pitchDouble;
pitchInt = ((pitch / octDiv) << 11) | pitchInt;
writeMD(channel / 3, 0xa4 + (channel % 3), pitchInt >> 8);
writeMD(channel / 3, 0xa0 + (channel % 3), pitchInt % 256);
writeMD(channel / 3, 0x40 + (channel % 3), 127 - ((velocity * TL1[channel]) / 127));
writeMD(channel / 3, 0x44 + (channel % 3), 127 - ((velocity * TL2[channel]) / 127));
writeMD(channel / 3, 0x48 + (channel % 3), 127 - ((velocity * TL3[channel]) / 127));
writeMD(channel / 3, 0x4C + (channel % 3), 127 - ((velocity * TL4[channel]) / 127));
writeMD(0, 0x28, 0xf0 | ((channel / 3 << 2) | (channel % 3)));
}
else {
if(polyFlag == 1) {
for(int i = 0; i < 6; i++) {
if(pitchTracking[i] == pitch) {
channel = i;
polyBusy[i] = 0;
i = 6;
}
}
}
if(pitchTracking[channel] == pitch) {
writeMD(0, 0x28, ((channel / 3 << 2) | (channel % 3)));
}
}
}
// SN76489 NOTES
else if(channel >= 6 && channel <= 8 && pitch >= 45) {
channel = channel - 6;
if(velocity > 0) {
int coarsePitchVal = -12 + (coarsePitch[channel] / 5);
pitchData[channel] = pitch;
velocityData[channel] = velocity;
writeFrequency(pitch, channel);
writeAmplitude(velocity, channel);
}
else {
velocityData[channel] = 0;
writeAmplitude(0, channel);
}
}
else if(channel == 9) {
channel = channel - 6;
if(velocity > 0) {
velocityData[channel] = velocity;
writeSN76489(noiseLookup[pitch % 12]);
writeAmplitude(velocity, channel);
}
else {
velocityData[channel] = 0;
writeAmplitude(0, channel);
}
}
}
void doNoteOff(byte channel, byte pitch, byte velocity) {
channel --;
if(channel == 5 && sample_on == 1) {
SPB_flag = 0;
}
if(channel >= 0 && channel <=5) {
if(polyFlag == 1) {
for(int i = 0; i < 6; i++) {
if(pitchTracking[i] == pitch) {
channel = i;
polyBusy[i] = 0;
i = 6;
}
}
}
if(pitchTracking[channel] == pitch) {
writeMD(0, 0x28, ((channel / 3 << 2) | (channel % 3)));
}
}
else if(channel >= 6 && channel <= 8 && pitch >= 45) {
channel = channel - 6;
velocityData[channel] = 0;
writeAmplitude(0, channel);
}
else if(channel == 9) {
channel = 3;
velocityData[channel] = 0;
writeAmplitude(0, channel);
}
}
void doCC(byte channel, byte ccnumber, byte ccvalue) {
channel --;
if(channel >=0 && channel <= 5) {
if(ccnumber >= 100 && ccnumber <= 113) {
triangle[ccnumber - 100] = ccvalue << 1;
}
switch(ccnumber) {
case 79:
writeMD(0, 0x2a, ccvalue << 1);
break;
case 14:
regB0[channel] = regB0[channel] | B00000111;
ccvalue = (ccvalue >> 4) | B00111000;
regB0[channel] = regB0[channel] & ccvalue;
writeMD(channel / 3, 0xB0 + (channel % 3), regB0[channel]);
break;
case 15:
regB0[channel] = regB0[channel] | B00111000;
ccvalue2 = ((ccvalue >> 4) << 3) | B00000111;
regB0[channel] = regB0[channel] & ccvalue2;
writeMD(channel / 3, 0x38 + (channel % 3), regB0[channel]);
break;
case 16:
TL1[channel] = ccvalue;
writeMD(channel / 3, 0x40 + (channel % 3), 127 - ((velocity * TL1[channel]) / 127));
break;
case 17:
TL2[channel] = ccvalue;
writeMD(channel / 3, 0x44 + (channel % 3), 127 - ((velocity * TL2[channel]) / 127));
break;
case 18:
TL3[channel] = ccvalue;
writeMD(channel / 3, 0x48 + (channel % 3), 127 - ((velocity * TL3[channel]) / 127));
break;
case 19:
TL4[channel] = ccvalue;
writeMD(channel / 3, 0x4C + (channel % 3), 127 - ((velocity * TL4[channel]) / 127));
break;
// Registers 0x30+
case 20:
reg30[channel] = reg30[channel] | B00001111;
ccvalue2 = (ccvalue >> 3) | B01110000;
reg30[channel] = reg30[channel] & ccvalue2;
writeMD(channel / 3, 0x30 + (channel % 3), reg30[channel]);
break;
case 21:
reg34[channel] = reg34[channel] | B00001111;
ccvalue2 = (ccvalue >> 3) | B01110000;
reg34[channel] = reg34[channel] & ccvalue2;
writeMD(channel / 3, 0x34 + (channel % 3), reg34[channel]);
break;
case 22:
reg38[channel] = reg38[channel] | B00001111;
ccvalue2 = (ccvalue >> 3) | B01110000;
reg38[channel] = reg38[channel] & ccvalue2;
writeMD(channel / 3, 0x38 + (channel % 3), reg38[channel]);
break;
case 23:
reg3c[channel] = reg3c[channel] | B00001111;
ccvalue2 = (ccvalue >> 3) | B01110000;
reg3c[channel] = reg3c[channel] & ccvalue2;
writeMD(channel / 3, 0x3c + (channel % 3), reg3c[channel]);
break;
case 24:
reg30[channel] = reg30[channel] | B01110000;
ccvalue2 = ((ccvalue >> 4) << 4) | B00001111;
reg30[channel] = reg30[channel] & ccvalue2;
writeMD(channel / 3, 0x30 + (channel % 3), reg30[channel]);
break;
case 25:
reg34[channel] = reg34[channel] | B01110000;
ccvalue2 = ((ccvalue >> 4) << 4) | B00001111;
reg34[channel] = reg34[channel] & ccvalue2;
writeMD(channel / 3, 0x34 + (channel % 3), reg34[channel]);
break;
case 26:
reg38[channel] = reg38[channel] | B01110000;
ccvalue2 = ((ccvalue >> 4) << 4) | B00001111;
reg38[channel] = reg38[channel] & ccvalue2;
writeMD(channel / 3, 0x38 + (channel % 3), reg38[channel]);
break;
case 27:
reg3c[channel] = reg3c[channel] | B01110000;
ccvalue2 = ((ccvalue >> 4) << 4) | B00001111;
reg3c[channel] = reg3c[channel] & ccvalue2;
writeMD(channel / 3, 0x3c + (channel % 3), reg3c[channel]);
break;
// Registers 0x50+
case 39:
reg50[channel] = reg50[channel] | B11000000;
ccvalue2 = (ccvalue << 1) | B00011111;
reg50[channel] = reg50[channel] & ccvalue2;
writeMD(channel / 3, 0x50 + (channel % 3), reg50[channel]);
break;
case 40:
reg54[channel] = reg54[channel] | B11000000;
ccvalue2 = (ccvalue << 1) | B00011111;
reg54[channel] = reg54[channel] & ccvalue2;
writeMD(channel / 3, 0x54 + (channel % 3), reg54[channel]);
break;
case 41:
reg58[channel] = reg58[channel] | B11000000;
ccvalue2 = (ccvalue << 1) | B00011111;
reg58[channel] = reg58[channel] & ccvalue2;
writeMD(channel / 3, 0x58 + (channel % 3), reg58[channel]);
break;
case 42:
reg5c[channel] = reg5c[channel] | B11000000;
ccvalue2 = (ccvalue << 1) | B00011111;
reg5c[channel] = reg5c[channel] & ccvalue2;
writeMD(channel / 3, 0x5c + (channel % 3), reg5c[channel]);
break;
case 43:
reg50[channel] = reg50[channel] | B00011111;
ccvalue2 = (ccvalue >> 2) | B11000000;
reg50[channel] = reg50[channel] & ccvalue2;
writeMD(channel / 3, 0x50 + (channel % 3), reg50[channel]);
break;
case 44:
reg54[channel] = reg54[channel] | B00011111;
ccvalue2 = (ccvalue >> 2) | B11000000;
reg54[channel] = reg54[channel] & ccvalue2;
writeMD(channel / 3, 0x54 + (channel % 3), reg54[channel]);
break;
case 45:
reg58[channel] = reg58[channel] | B00011111;
ccvalue2 = (ccvalue >> 2) | B11000000;
reg58[channel] = reg58[channel] & ccvalue2;
writeMD(channel / 3, 0x58 + (channel % 3), reg58[channel]);
break;
case 46:
reg5c[channel] = reg5c[channel] | B00011111;
ccvalue2 = (ccvalue >> 2) | B11000000;
reg5c[channel] = reg5c[channel] & ccvalue2;
writeMD(channel / 3, 0x5c + (channel % 3), reg5c[channel]);
break;
// Registers 0x60+
case 70:
reg60[channel] = reg60[channel] | B10000000;
ccvalue2 = (ccvalue << 1) | B00011111;
reg60[channel] = reg60[channel] & ccvalue2;
writeMD(channel / 3, 0x60 + (channel % 3), reg60[channel]);
break;
case 71:
reg64[channel] = reg64[channel] | B10000000;
ccvalue2 = (ccvalue << 1) | B00011111;
reg64[channel] = reg64[channel] & ccvalue2;
writeMD(channel / 3, 0x64 + (channel % 3), reg64[channel]);
break;
case 72:
reg68[channel] = reg68[channel] | B10000000;
ccvalue2 = (ccvalue << 1) | B00011111;
reg68[channel] = reg68[channel] & ccvalue2;
writeMD(channel / 3, 0x68 + (channel % 3), reg68[channel]);
break;
case 73:
reg6c[channel] = reg6c[channel] | B10000000;
ccvalue2 = (ccvalue << 1) | B00011111;
reg6c[channel] = reg6c[channel] & ccvalue2;
writeMD(channel / 3, 0x6c + (channel % 3), reg6c[channel]);
break;
case 47:
reg60[channel] = reg60[channel] | B00011111;
ccvalue2 = (ccvalue >> 2) | B10000000;
reg60[channel] = reg60[channel] & ccvalue2;
writeMD(channel / 3, 0x60 + (channel % 3), reg60[channel]);
break;
case 48:
reg64[channel] = reg64[channel] | B00011111;
ccvalue2 = (ccvalue >> 2) | B10000000;
reg64[channel] = reg64[channel] & ccvalue2;
writeMD(channel / 3, 0x64 + (channel % 3), reg64[channel]);
break;
case 49:
reg68[channel] = reg68[channel] | B00011111;
ccvalue2 = (ccvalue >> 2) | B10000000;
reg68[channel] = reg68[channel] & ccvalue2;
writeMD(channel / 3, 0x68 + (channel % 3), reg68[channel]);
break;
case 50:
reg6c[channel] = reg6c[channel] | B00011111;
ccvalue2 = (ccvalue >> 2) | B10000000;
reg6c[channel] = reg6c[channel] & ccvalue2;
writeMD(channel / 3, 0x6c + (channel % 3), reg6c[channel]);
break;
// Registers 70+
case 51:
ccvalue2 = ccvalue;
writeMD(channel / 3, 0x70 + (channel % 3), ccvalue2 >> 3);
break;
case 52:
ccvalue2 = ccvalue;
writeMD(channel / 3, 0x70 + (channel % 3), ccvalue2 >> 3);
break;
case 53:
ccvalue2 = ccvalue;
writeMD(channel / 3, 0x70 + (channel % 3), ccvalue2 >> 3);
break;
case 54:
ccvalue2 = ccvalue;
writeMD(channel / 3, 0x70 + (channel % 3), ccvalue2 >> 3);
break;
// Registers 0x80+
case 55:
reg80[channel] = reg80[channel] | B11110000;
ccvalue2 = (ccvalue << 1) | B00001111;
reg80[channel] = reg80[channel] & ccvalue2;
writeMD(channel / 3, 0x80 + (channel % 3), reg80[channel]);
break;
case 56:
reg84[channel] = reg84[channel] | B11110000;
ccvalue2 = (ccvalue << 1) | B00001111;
reg84[channel] = reg84[channel] & ccvalue2;
writeMD(channel / 3, 0x84 + (channel % 3), reg84[channel]);
break;
case 57:
reg88[channel] = reg88[channel] | B11110000;
ccvalue2 = (ccvalue << 1) | B00001111;
reg88[channel] = reg88[channel] & ccvalue2;
writeMD(channel / 3, 0x88 + (channel % 3), reg88[channel]);
break;
case 58:
reg8c[channel] = reg8c[channel] | B11110000;
ccvalue2 = (ccvalue << 1) | B00001111;
reg8c[channel] = reg8c[channel] & ccvalue2;
writeMD(channel / 3, 0x8c + (channel % 3), reg8c[channel]);
break;
case 59:
reg80[channel] = reg80[channel] | B00001111;
ccvalue2 = (ccvalue >> 3) | B11110000;
reg80[channel] = reg80[channel] & ccvalue2;
writeMD(channel / 3, 0x80 + (channel % 3), reg80[channel]);
break;
case 60:
reg84[channel] = reg84[channel] | B00001111;
ccvalue2 = (ccvalue >> 3) | B11110000;
reg84[channel] = reg84[channel] & ccvalue2;
writeMD(channel / 3, 0x84 + (channel % 3), reg84[channel]);
break;
case 61:
reg88[channel] = reg88[channel] | B00001111;
ccvalue2 = (ccvalue >> 3) | B11110000;
reg88[channel] = reg88[channel] & ccvalue2;
writeMD(channel / 3, 0x88 + (channel % 3), reg88[channel]);
break;
case 62:
reg8c[channel] = reg8c[channel] | B00001111;
ccvalue2 = (ccvalue >> 3) | B11110000;
reg8c[channel] = reg8c[channel] & ccvalue2;
writeMD(channel / 3, 0x8c + (channel % 3), reg8c[channel]);
break;
// Register 0x22
case 1:
reg22 = reg22 | B0000111;
ccvalue2 = ccvalue >> 4 | B00001000;
reg22 = reg22 & ccvalue2;
writeMD(0, 0x22, reg22);
break;
case 74:
reg22 = reg22 | B0001000;
ccvalue2 = ((ccvalue >> 6) << 3) | B00000111;
reg22 = reg22 & ccvalue2;
writeMD(0, 0x22, reg22);
break;
// Registers 0xB4+
case 75:
regB4[channel] = regB4[channel] | B00000111;
ccvalue2 = ccvalue >> 4 | B11111000;
regB4[channel] = regB4[channel] & ccvalue2;
writeMD(channel / 3, 0xB4 + (channel % 3), regB4[channel]);
break;
case 76:
regB4[channel] = regB4[channel] | B00111000;
ccvalue2 = ((ccvalue >> 4) << 3) | B11000111;
regB4[channel] = regB4[channel] & ccvalue2;
writeMD(channel / 3, 0xB4 + (channel % 3), regB4[channel]);
break;
case 77:
regB4[channel] = regB4[channel] | B11000000;
ccvalue2 = ((ccvalue >> 5) << 6) | B00111111;
regB4[channel] = regB4[channel] & ccvalue2;
writeMD(channel / 3, 0xB4 + (channel % 3), regB4[channel]);
break;
case 78:
writeMD(0, 0x2B, ccvalue << 1);
sample_on = ccvalue >> 6;
break;
case 81:
bendAmount = ccvalue / 18;
break;
case 83:
if(ccvalue > 63) {
constantDouble = 6.41; // NTSC Tuning
}
else {
constantDouble = 6.711; // PAL Tuning
}
break;
case 84:
octDiv = ccvalue + 1;
break;
case 85:
pitchOffset = ccvalue;
break;
case 86:
SPB_speed = ccvalue;
save_speed = SPB_speed;
break;
case 87:
polyFlag = ccvalue >> 6;
break;
case 88:
overSamp = (ccvalue >> 3) + 1;
break;
case 89:
tri_flag = (ccvalue >> 6) + 1;
break;
case 9:
ccvalue = ccvalue / 8;
doCC(channel, 14, ALGO[ccvalue]);
doCC(channel, 15, FB[ccvalue]);
doCC(channel, 16, TLOP1[ccvalue]);
doCC(channel, 17, TLOP2[ccvalue]);
doCC(channel, 18, TLOP3[ccvalue]);
doCC(channel, 19, TLOP4[ccvalue]);
doCC(channel, 20, MULOP1[ccvalue]);
doCC(channel, 21, MULOP2[ccvalue]);
doCC(channel, 22, MULOP3[ccvalue]);
doCC(channel, 23, MULOP4[ccvalue]);
doCC(channel, 24, DETUNEOP1[ccvalue]);
doCC(channel, 25, DETUNEOP2[ccvalue]);
doCC(channel, 26, DETUNEOP3[ccvalue]);
doCC(channel, 27, DETUNEOP4[ccvalue]);
doCC(channel, 43, ATTACKOP1[ccvalue]);
doCC(channel, 44, ATTACKOP2[ccvalue]);
doCC(channel, 45, ATTACKOP3[ccvalue]);
doCC(channel, 46, ATTACKOP4[ccvalue]);
doCC(channel, 47, DECAY1OP1[ccvalue]);
doCC(channel, 48, DECAY1OP2[ccvalue]);
doCC(channel, 49, DECAY1OP3[ccvalue]);
doCC(channel, 50, DECAY1OP4[ccvalue]);
doCC(channel, 51, DECAY2OP1[ccvalue]);
doCC(channel, 52, DECAY2OP2[ccvalue]);
doCC(channel, 53, DECAY2OP3[ccvalue]);
doCC(channel, 54, DECAY2OP4[ccvalue]);
doCC(channel, 55, AMP2OP1[ccvalue]);
doCC(channel, 56, AMP2OP2[ccvalue]);
doCC(channel, 57, AMP2OP3[ccvalue]);
doCC(channel, 58, AMP2OP4[ccvalue]);
doCC(channel, 59, RELOP1[ccvalue]);
doCC(channel, 60, RELOP2[ccvalue]);
doCC(channel, 61, RELOP3[ccvalue]);
doCC(channel, 62, RELOP4[ccvalue]);
break;
}
}
// SN76489 CC MESSAGES
else if(channel >= 6 && channel <= 8) {
// CC83 = tuning mode
if(ccnumber == 83 && channel == 0) {
if(ccvalue > 63) {
pitchTableOffset = 84;
}
else{
pitchTableOffset = 0;
}
}
// MIDI CC 85 = coarse tuning
else if(ccnumber == 42) {
coarsePitch[channel] = ccvalue;
writeFrequency(pitchData[channel], channel);
}
// MIDI CC 11 = expression
else if(ccnumber == 11) {
velocityData[channel] = ccvalue;
writeAmplitude(ccvalue, channel);
}
}
}
void doBend(uint8_t channel, int bend_usb) {
channel --;
bendMSB = bend_usb >> 7;
bendLSB = bend_usb % B01111111;
if(channel >=0 && channel <=5) {
bend[channel] = bendMSB;
pitchDouble = pow(2, ((pitchTracking[channel] % octDiv) + (0.015625 * bendAmount * (bend[channel] - 64)) + constantDouble) / octDiv) * 440;
pitchInt = (int) pitchDouble;
pitchInt = ((pitchTracking[channel] / octDiv) << 11) | pitchInt;
writeMD(channel / 3, 0xa4 + (channel % 3), pitchInt >> 8);
writeMD(channel / 3, 0xa0 + (channel % 3), pitchInt % 256);
}
else if(channel >= 6 && channel <= 8) {
channel = channel - 6;
bend_MSB[channel] = bendMSB;
bend_data[channel] = bend_MSB[channel];
writeFrequency(pitchData[channel], channel);
}
}
////////////////////////////////////////////////////////
//
// DEALING WITH THE YM2612
//
////////////////////////////////////////////////////////
void writeMD(byte page, byte address, byte data) {
// set page flag
if(page_number != page) {
page_number = page;
if(page == 0) {
PORTB = B00001101;
digitalWrite(NB, HIGH);
digitalWrite(AD, HIGH);
digitalWrite(WR, HIGH);
delayMicroseconds(dT);
digitalWrite(WR, LOW);
delayMicroseconds(dT);
}
else if(page == 1) {
PORTB = B00001110;
digitalWrite(NB, HIGH);
digitalWrite(AD, HIGH);
digitalWrite(WR, HIGH);
delayMicroseconds(dT);
digitalWrite(WR, LOW);
delayMicroseconds(dT);
}
}
// write data
PORTB = data;
digitalWrite(NB, LOW);
digitalWrite(AD, LOW);
digitalWrite(WR, HIGH);
delayMicroseconds(dT);
digitalWrite(WR, LOW);
delayMicroseconds(dT);
PORTB = data >> 4;
digitalWrite(NB, HIGH);
digitalWrite(AD, LOW);
digitalWrite(WR, HIGH);
delayMicroseconds(dT);
digitalWrite(WR, LOW);
delayMicroseconds(dT);
PORTB = address;
digitalWrite(NB, LOW);
digitalWrite(AD, HIGH);
digitalWrite(WR, HIGH);
delayMicroseconds(dT);
digitalWrite(WR, LOW);
delayMicroseconds(dT);
PORTB = address >> 4;
digitalWrite(NB, HIGH);
digitalWrite(AD, HIGH);
digitalWrite(WR, HIGH);
delayMicroseconds(dT);
digitalWrite(WR, LOW);
delayMicroseconds(dT);
}
// SAMPLES
void doSample() {
if(SPB_flag == 1 && sample_on == 1) {
if(SPB_counter >= SPB_max && noise_flag == 0) {
SPB_flag = 0;
SPB_counter = 0;
}
if(SPB_tick >= SPB_speed && noise_flag == 1) {
SPB_counter = SPB_counter + overSamp;
SPB_tick = 0;
noise_data = byte(random(256)) >> noise_velocity;
writeMD(0, 0x2a, noise_data);
}
if(SPB_tick >= SPB_speed && noise_flag == 2) {
SPB_counter = SPB_counter + overSamp;
SPB_tick = 0;
noise_data = triangle[SPB_counter % 14] >> noise_velocity;
writeMD(0, 0x2a, noise_data);
}
else if(SPB_tick >= SPB_speed && noise_flag == 0) {
SPB_tick = 0;
switch (SPB_sound) {
case 0:
writeMD(0, 0x2a, pgm_read_byte_near(kick + SPB_counter));
break;
case 1:
writeMD(0, 0x2a, pgm_read_byte_near(snare + SPB_counter));
break;
case 2:
writeMD(0, 0x2a, pgm_read_byte_near(hat_closed + SPB_counter));
break;
case 3:
writeMD(0, 0x2a, pgm_read_byte_near(hat_open + SPB_counter));
break;
case 4:
writeMD(0, 0x2a, pgm_read_byte_near(tom_lo + SPB_counter));
break;
case 5:
writeMD(0, 0x2a, pgm_read_byte_near(tom_hi + SPB_counter));
break;
case 6:
writeMD(0, 0x2a, pgm_read_byte_near(cow + SPB_counter));
break;
case 7:
writeMD(0, 0x2a, pgm_read_byte_near(kick2 + SPB_counter));
break;
case 8:
writeMD(0, 0x2a, pgm_read_byte_near(snare2 + SPB_counter));
break;
case 9:
writeMD(0, 0x2a, pgm_read_byte_near(hat_c2 + SPB_counter));
break;
case 10:
writeMD(0, 0x2a, pgm_read_byte_near(hat_o2 + SPB_counter));
break;
case 11:
writeMD(0, 0x2a, pgm_read_byte_near(tom_hi2 + SPB_counter));
break;
case 12:
writeMD(0, 0x2a, pgm_read_byte_near(crash + SPB_counter));
break;
case 13:
writeMD(0, 0x2a, pgm_read_byte_near(ride + SPB_counter));
break;
case 14:
writeMD(0, 0x2a, pgm_read_byte_near(kick3 + SPB_counter));
break;
case 15:
writeMD(0, 0x2a, pgm_read_byte_near(snare3 + SPB_counter));
break;
case 16:
writeMD(0, 0x2a, pgm_read_byte_near(ride2 + SPB_counter));
break;
}
SPB_counter = SPB_counter + overSamp;
SPB_tick = 0;
}
if(SPB_tick < SPB_speed) {
SPB_tick = SPB_tick + 1;
}
}
}
// SN76489 FUNCTIONS
void writeSN76489(byte data) {
PORTB = data;
digitalWrite(NB, LOW);
digitalWrite(AD, LOW);
digitalWrite(WR, HIGH);
delayMicroseconds(dT);
digitalWrite(WR, LOW);
delayMicroseconds(dT);
PORTB = data >> 4;
digitalWrite(NB, HIGH);
digitalWrite(AD, LOW);
digitalWrite(WR, HIGH);
delayMicroseconds(dT);
digitalWrite(WR, LOW);
delayMicroseconds(dT);
PORTB = B00001100; // unique special code for SN76489 writing
digitalWrite(NB, HIGH);
digitalWrite(AD, HIGH);
digitalWrite(WR, HIGH);
delayMicroseconds(dT);
digitalWrite(WR, LOW);
delayMicroseconds(dT);
delayMicroseconds(dT);
delayMicroseconds(dT);
}
void writeAmplitude(byte velocity, byte channel) {
// latch byte
channel = channel << 5;
velocity = 15 - (velocity >> 3);
working_byte = B10010000 + channel + velocity;
writeSN76489(working_byte);
}
void writeFrequency(byte pitch, byte channel) {
// latch byte
int pdaInt;
int coarsePitchVal = -12 + (coarsePitch[channel] / 5);
pdatInt = (pitchTable[pitch - 45 + pitchTableOffset + coarsePitchVal]) + (64 - bend_data[channel]);
if(pdatInt < 0) {
pdatInt = 0;
}
else if(pdatInt > 1023) {
pdatInt = 1023;
}
pdat1 = pdatInt % 16;
channel = channel << 5;
working_byte = B10000000 + channel + pdat1;
writeSN76489(working_byte);
// data byte
pdat2 = pdatInt >> 4;
writeSN76489(pdat2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment