├── sd.ino ├── samples.ino ├── ads1115 module.rar ├── custom_partitions.csv ├── midi.ino ├── LICENSE ├── README.md ├── sequencer.ino ├── touch.ino ├── synthESP32LowPassFilter_E.h ├── files_tools.ino ├── reverb.ino ├── rots.ino ├── SOUNDS ├── zSAMPLE48.h ├── zSAMPLE40.h ├── zSAMPLE06.h ├── zSAMPLE47.h └── zSAMPLE20.h ├── keys.ino ├── synthESP32.ino ├── LCD_tools.ino └── DRUM_2025_VSAMPLER.ino /sd.ino: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples.ino: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ads1115 module.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zircothc/DRUM_2025_VSAMPLER/HEAD/ads1115 module.rar -------------------------------------------------------------------------------- /custom_partitions.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | phy_init, data, phy, 0xe000, 0x1000, 4 | app0, app, factory, 0x10000, 0x380000, 5 | spiffs, data, spiffs, 0x390000, 0x70000, 6 | -------------------------------------------------------------------------------- /midi.ino: -------------------------------------------------------------------------------- 1 | // void onNoteOnBLE(uint8_t channel, uint8_t note, uint8_t velocity, uint16_t timestamp) 2 | // { 3 | // synthESP32_TRIGGER(note % 12); 4 | // } 5 | 6 | // void handleNoteOn(byte channel, byte pitch, byte velocity){ 7 | // synthESP32_TRIGGER_P(channel,pitch); 8 | // if (recording && playing){ 9 | // bitWrite(pattern[channel],sstep,1); 10 | // melodic[channel][sstep]=pitch; 11 | // } 12 | // Serial.print(channel); 13 | // Serial.print(" "); 14 | // Serial.println(pitch); 15 | // } 16 | // void handleCC(byte channel, byte ccnumber, byte value){ 17 | // int nvalue=value; 18 | // // arreglar pan 19 | // if (ccnumber==6) { 20 | // nvalue=map(nvalue,0,127,-99,99); 21 | // } 22 | // // despreciar maximos y mínimos 23 | // if (nvalue>max_values[ccnumber]) return; 24 | // if (nvalue 0 && bitRead(solos, f))) { 47 | if (bitRead(pattern[f], sstep)) { // note on 48 | latch[f]=0; 49 | if (bitRead(isMelodic,f)){ 50 | synthESP32_TRIGGER_P(f,melodic[f][sstep]); 51 | } else { 52 | // Trigger con el pitch del canal 53 | synthESP32_TRIGGER(f); 54 | } 55 | } 56 | } 57 | } 58 | } 59 | 60 | sstep++; 61 | // Comprobar step final 62 | if (sstep==(lastStep+1) || sstep==(newLastStep+1) || sstep==16) { 63 | lastStep=newLastStep; 64 | sstep=firstStep; 65 | if (songing){ 66 | load_flag=true; // inside loop I will load next pattern 67 | } 68 | } 69 | refreshPADSTEP=true; 70 | } 71 | 72 | 73 | void onSync24Callback(uint32_t tick){ 74 | 75 | // FX1 76 | if (playing){ 77 | if (!(tick % (12)) && fx1==1) { 78 | synthESP32_TRIGGER(selected_sound); 79 | } 80 | if (!(tick % (6)) && fx1==2) { 81 | synthESP32_TRIGGER(selected_sound); 82 | } 83 | if (!(tick % (3)) && fx1==3) { 84 | synthESP32_TRIGGER(selected_sound); 85 | } 86 | } 87 | 88 | // Lanzar cambio de step 89 | if (!(tick % (6))) tic(); 90 | 91 | // Limpiar marcas de sound y step 92 | if ((tick % (6))==4) clearPADSTEP=true; 93 | 94 | } 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /touch.ino: -------------------------------------------------------------------------------- 1 | // Reset GT911 2 | void resetGT911() { 3 | pinMode(TOUCH_RST, OUTPUT); 4 | pinMode(TOUCH_INT, OUTPUT); 5 | digitalWrite(TOUCH_INT, LOW); 6 | delay(5); 7 | digitalWrite(TOUCH_RST, LOW); 8 | delay(10); 9 | digitalWrite(TOUCH_RST, HIGH); 10 | delay(50); 11 | pinMode(TOUCH_INT, INPUT); 12 | delay(50); 13 | } 14 | 15 | // Read register GT911 16 | uint8_t readRegister8(uint16_t reg) { 17 | Wire.beginTransmission(GT911_ADDR); 18 | Wire.write(reg >> 8); 19 | Wire.write(reg & 0xFF); 20 | Wire.endTransmission(false); 21 | Wire.requestFrom(GT911_ADDR, 1); 22 | return Wire.available() ? Wire.read() : 0; 23 | } 24 | 25 | // Read registers GT911 26 | void readRegisterMultiple(uint16_t reg, uint8_t *buffer, uint8_t length) { 27 | Wire.beginTransmission(GT911_ADDR); 28 | Wire.write(reg >> 8); 29 | Wire.write(reg & 0xFF); 30 | Wire.endTransmission(false); 31 | Wire.requestFrom((uint8_t)GT911_ADDR, (uint8_t)length); 32 | for (uint8_t i = 0; i < length && Wire.available(); i++) { 33 | buffer[i] = Wire.read(); 34 | } 35 | } 36 | 37 | // Write register GT911 38 | void writeRegister8(uint16_t reg, uint8_t value) { 39 | Wire.beginTransmission(GT911_ADDR); 40 | Wire.write(reg >> 8); 41 | Wire.write(reg & 0xFF); 42 | Wire.write(value); 43 | Wire.endTransmission(); 44 | } 45 | 46 | /////////////////////////////////////////////////////////////////////////////////////////////////////////// 47 | /////////////////////////////////////////////////////////////////////////////////////////////////////////// 48 | /////////////////////////////////////////////////////////////////////////////////////////////////////////// 49 | 50 | void read_touch(){ 51 | 52 | uint8_t status = readRegister8(0x814E); // Estado de toque 53 | 54 | if (status & 0x80) { // Si hay un toque detectado 55 | if (!touchActivo){ 56 | touchActivo = true; 57 | uint8_t data[8] = {0}; 58 | readRegisterMultiple(0x8150, data, 8); //read 59 | 60 | uint16_t x = (data[1] << 8) | data[0]; 61 | uint16_t y = (data[3] << 8) | data[2]; 62 | uint8_t size = data[4]; 63 | writeRegister8(0x814E, 0x00); // clear 64 | cox=x; 65 | coy=y; 66 | 67 | for (byte f=0;f<48;f++){ 68 | if ( (cox > BPOS[f][0]) && (cox < (BPOS[f][0]+BPOS[f][2])) && (coy > BPOS[f][1]) && (coy < (BPOS[f][1]+BPOS[f][3])) ) { 69 | if (f==last_touched ){ 70 | if (start_debounce+debounce_time > millis() ){ 71 | break; 72 | } 73 | } 74 | trigger_on[f]=1; 75 | last_touched=f; 76 | start_debounce=millis(); 77 | touchActivo = true; 78 | // Serial.print("t "); 79 | // Serial.println(f); 80 | break; 81 | } 82 | } 83 | } 84 | } else { 85 | touchActivo = false; 86 | } 87 | writeRegister8(0x814E, 0x00); // clear 88 | } -------------------------------------------------------------------------------- /synthESP32LowPassFilter_E.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LowPassFilter.h 3 | * 4 | * Copyright 2012 Tim Barrass 5 | * 6 | * This file is part of Mozzi. 7 | * 8 | * Mozzi is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. 9 | * 10 | */ 11 | 12 | #ifndef LOWPASS_H_ 13 | #define LOWPASS_H_ 14 | 15 | /* 16 | simple resonant filter posted to musicdsp.org by Paul Kellett http://www.musicdsp.org/archive.php?classid=3#259 17 | 18 | // set feedback amount given f and q between 0 and 1 19 | fb = q + q/(1.0 - f); 20 | 21 | // for each sample... 22 | buf0 = buf0 + f * (in - buf0 + fb * (buf0 - buf1)); 23 | buf1 = buf1 + f * (buf0 - buf1); 24 | out = buf1; 25 | 26 | fixed point version of the filter 27 | "dave's blog of art and programming" http://www.pawfal.org/dave/blog/2011/09/ 28 | */ 29 | 30 | 31 | // we are using .n fixed point (n bits for the fractional part) 32 | #define FX_SHIFT 8 33 | #define SHIFTED_1 ((uint8_t) 255) 34 | 35 | /** A resonant low pass filter for audio signals. 36 | */ 37 | class LowPassFilter 38 | { 39 | 40 | public: 41 | 42 | 43 | /** Constructor. 44 | */ 45 | LowPassFilter(){; 46 | } 47 | 48 | 49 | /** Set the cut off frequency, 50 | @param cutoff use the range 0-255 to represent 0-8192 Hz (AUDIO_RATE/2). 51 | Be careful of distortion at the lower end, especially with high resonance. 52 | */ 53 | void setCutoffFreq(uint8_t cutoff) 54 | { 55 | f = cutoff; 56 | fb = q+ucfxmul(q, SHIFTED_1 - cutoff); 57 | } 58 | 59 | 60 | /** Set the resonance. If you hear unwanted distortion, back off the resonance. 61 | @param resonance in the range 0-255, with 255 being most resonant. 62 | */ 63 | void setResonance(uint8_t resonance) 64 | { 65 | q = resonance; 66 | } 67 | 68 | /** Calculate the next sample, given an input signal. 69 | @param in the signal input. 70 | @return the signal output. 71 | @note Timing: about 11us. 72 | */ 73 | // 10.5 to 12.5 us, mostly 10.5 us (was 14us) 74 | inline 75 | int next(int in) 76 | { 77 | //setPin13High(); 78 | buf0+=fxmul(((in - buf0) + fxmul(fb, buf0-buf1)), f); 79 | buf1+=ifxmul(buf0-buf1, f); // could overflow if input changes fast 80 | //setPin13Low(); 81 | return buf1; 82 | } 83 | 84 | 85 | private: 86 | uint8_t q; 87 | uint8_t f; 88 | unsigned int fb; 89 | int buf0,buf1; 90 | 91 | 92 | // // multiply two fixed point numbers (returns fixed point) 93 | // inline 94 | // long fxmul(long a, long b) 95 | // { 96 | // return (a*b)>>FX_SHIFT; 97 | // } 98 | 99 | // multiply two fixed point numbers (returns fixed point) 100 | inline 101 | unsigned int ucfxmul(uint8_t a, uint8_t b) 102 | { 103 | return (((unsigned int)a*b)>>FX_SHIFT); 104 | } 105 | 106 | // multiply two fixed point numbers (returns fixed point) 107 | inline 108 | int ifxmul(int a, uint8_t b) 109 | { 110 | return ((a*b)>>FX_SHIFT); 111 | } 112 | 113 | // multiply two fixed point numbers (returns fixed point) 114 | inline 115 | long fxmul(long a, int b) 116 | { 117 | return ((a*b)>>FX_SHIFT); 118 | } 119 | 120 | }; 121 | 122 | /** 123 | @example 10.Audio_Filters/LowPassFilter/LowPassFilter.ino 124 | This example demonstrates the LowPassFilter class. 125 | */ 126 | 127 | #endif /* LOWPASS_H_ */ 128 | -------------------------------------------------------------------------------- /files_tools.ino: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////// 2 | 3 | void load_pattern(byte pat){ 4 | 5 | // Leer pattren 6 | String nombreArchivoP = "/PAT" + String(pat)+"_"+String(selected_memory); 7 | File archivoP = SPIFFS.open(nombreArchivoP, FILE_READ); 8 | if (!archivoP) { 9 | Serial.println("Error al abrir el archivo para leer"); 10 | return; 11 | } 12 | int fila = 0; 13 | while (archivoP.available()) { 14 | pattern[fila] = (archivoP.readStringUntil('\n')).toInt(); 15 | //Serial.println(pattern[fila]); 16 | fila++; 17 | } 18 | archivoP.close(); 19 | 20 | // Leer melodic 21 | String nombreArchivoM = "/MED" + String(pat)+"_"+String(selected_memory); 22 | File archivoM = SPIFFS.open(nombreArchivoM, FILE_READ); 23 | if (!archivoM) { 24 | Serial.println("Error al abrir el archivo para leer"); 25 | return; 26 | } 27 | fila = 0; 28 | int columna = 0; 29 | while (archivoM.available()) { 30 | melodic[fila][columna] = (archivoM.readStringUntil('\n')).toInt(); 31 | columna++; 32 | if (columna == 16) { 33 | fila++; 34 | columna = 0; 35 | } 36 | } 37 | archivoM.close(); 38 | } 39 | 40 | void load_sound(byte pat){ 41 | 42 | // Leer sound 43 | String nombreArchivoS = "/SND" + String(pat)+"_"+String(selected_memory); 44 | File archivoS = SPIFFS.open(nombreArchivoS, FILE_READ); 45 | if (!archivoS) { 46 | Serial.println("Error al abrir el archivo para leer"); 47 | return; 48 | } 49 | int fila = 0; 50 | int columna = 0; 51 | while (archivoS.available()) { 52 | ROTvalue[fila][columna] = (archivoS.readStringUntil('\n')).toInt(); 53 | columna++; 54 | if (columna == 8) { 55 | // Set voices 56 | setSound(fila); 57 | fila++; 58 | columna = 0; 59 | } 60 | } 61 | archivoS.close(); 62 | flag_ss=true; 63 | } 64 | 65 | void save_pattern(byte pat){ 66 | 67 | // Guardar pattern 68 | String nombreArchivoP = "/PAT" + String(pat)+"_"+String(selected_memory); 69 | File archivoP = SPIFFS.open(nombreArchivoP, FILE_WRITE); 70 | if (!archivoP) { 71 | Serial.println("Error al abrir el archivo para escribir"); 72 | return; 73 | } 74 | for (int i = 0; i < 16; i++) { 75 | archivoP.println(pattern[i]); 76 | //Serial.println(pattern[i]); 77 | } 78 | archivoP.close(); 79 | //Serial.println("-"); 80 | 81 | // Guardar melodic 82 | String nombreArchivoM = "/MED" + String(pat)+"_"+String(selected_memory); 83 | File archivoM = SPIFFS.open(nombreArchivoM, FILE_WRITE); 84 | if (!archivoM) { 85 | Serial.println("Error al abrir el archivo para escribir"); 86 | return; 87 | } 88 | for (int i = 0; i < 16; i++) { 89 | for (int j = 0; j < 16; j++) { 90 | archivoM.println(melodic[i][j]); 91 | } 92 | } 93 | archivoM.close(); 94 | } 95 | 96 | void save_sound(byte pat){ 97 | 98 | // Guardar sound 99 | String nombreArchivoS = "/SND" + String(pat)+"_"+String(selected_memory); 100 | File archivoS = SPIFFS.open(nombreArchivoS, FILE_WRITE); 101 | if (!archivoS) { 102 | Serial.println("Error al abrir el archivo para escribir"); 103 | return; 104 | } 105 | for (int i = 0; i < 16; i++) { 106 | for (int j = 0; j < 8; j++) { 107 | archivoS.println(ROTvalue[i][j]); 108 | } 109 | } 110 | archivoS.close(); 111 | } 112 | 113 | -------------------------------------------------------------------------------- /reverb.ino: -------------------------------------------------------------------------------- 1 | 2 | #define REVERB_DELAY_SAMPLES 20000//4410 3 | #define MIN_DELAY_SAMPLES 10 // 441 4 | #define MAX_DELAY_SAMPLES REVERB_DELAY_SAMPLES // Máximo delay 5 | 6 | // Feedback (0.0 a 1.0) 7 | #define REVERB_FEEDBACK 0.5f 8 | 9 | // Buffers circulares para cada canal 10 | int16_t reverbBufferL[REVERB_DELAY_SAMPLES] = {0}; 11 | int16_t reverbBufferR[REVERB_DELAY_SAMPLES] = {0}; 12 | 13 | // Índices para recorrer cada buffer de retardo 14 | uint16_t reverbIndexL = 0; 15 | uint16_t reverbIndexR = 0; 16 | 17 | uint16_t delayOffsetSamples = 0; 18 | 19 | volatile float reverbMix = 1;//0.5f; 20 | 21 | int16_t applyReverbChannel(int16_t input, int16_t *buffer, uint16_t &index, uint16_t delayOffset) { 22 | // Calcula el índice de lectura en el buffer para obtener la muestra retrasada. 23 | // Se toma la posición actual 'index' y se retrocede 'delayOffset' muestras (usando aritmética modular). 24 | uint16_t readIndex = (index + REVERB_DELAY_SAMPLES - delayOffset) % REVERB_DELAY_SAMPLES; 25 | int16_t delayedSample = buffer[readIndex]; 26 | 27 | // Mezcla la señal original y la retardada según reverbMix: 28 | // Con reverbMix = 0 se escucha solo la original, 29 | // con reverbMix = 1 se escucha solo la señal retrasada. 30 | //int32_t output = (int32_t)input * (1.0f - reverbMix) + (int32_t)delayedSample * reverbMix; 31 | int32_t output = (int32_t)input + (int32_t)delayedSample * reverbMix; 32 | // Calcula el feedback y actualiza el buffer: 33 | int32_t newBufferValue = input + (int32_t)delayedSample * REVERB_FEEDBACK; 34 | if(newBufferValue > INT16_MAX) newBufferValue = INT16_MAX; 35 | if(newBufferValue < INT16_MIN) newBufferValue = INT16_MIN; 36 | buffer[index] = (int16_t)newBufferValue; 37 | 38 | // Avanza el índice del buffer de forma circular. 39 | index = (index + 1) % REVERB_DELAY_SAMPLES; 40 | 41 | return (int16_t)output; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /rots.ino: -------------------------------------------------------------------------------- 1 | 2 | void select_rot(){ 3 | if (selected_rot==11){ 4 | counter1=master_filter; 5 | } else if (selected_rot==12){ 6 | counter1=octave; 7 | } else if (selected_rot==8){ 8 | counter1=bpm; 9 | } else if (selected_rot==9){ 10 | counter1=master_vol; 11 | } else if (selected_rot==10){ 12 | ztranspose=0; 13 | counter1=ztranspose; 14 | } else if (selected_rot==13){ 15 | zmpitch=0; 16 | counter1=zmpitch; 17 | } else if (selected_rot==14){ 18 | counter1=sync_state; 19 | } else if (selected_rot==15){ 20 | counter1=selected_scale; 21 | } else { 22 | counter1=ROTvalue[selected_sound][selected_rot]; 23 | } 24 | } 25 | 26 | ////////////////////////////////////////////////////////////////////////////// 27 | void do_rot(){ 28 | 29 | if (counter1>max_values[selected_rot]) counter1=max_values[selected_rot]; 30 | if (counter1 ROTvalue[selected_sound][2]) counter1=ROTvalue[selected_sound][2]; 74 | } 75 | if (selected_rot==2) { 76 | if (counter1 < ROTvalue[selected_sound][1]) counter1=ROTvalue[selected_sound][1]; 77 | } 78 | ROTvalue[selected_sound][selected_rot]=counter1; 79 | setSound(selected_sound); 80 | 81 | // play sound if 82 | if (selected_rot<8 && !playing){ 83 | synthESP32_TRIGGER(selected_sound); 84 | } 85 | } 86 | 87 | drawBar(selected_rot); 88 | 89 | } 90 | } 91 | 92 | ////////////////////////////////////////////////////////////////////////////////////////////// 93 | void READ_ENCODERS(){ 94 | 95 | bitWrite(ENC_PORT1,0,!digitalRead(DT)); 96 | bitWrite(ENC_PORT1,1,!digitalRead(CLK)); 97 | old_counter1=counter1; 98 | counter1=counter1+read_encoder1(); 99 | do_rot(); 100 | } 101 | 102 | ////////////////////////////////////////////////////////////////////////////////////////////// 103 | int16_t read_encoder1() { 104 | 105 | // Select rotary reading mode 106 | //static int8_t enc_states[] = {0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,-1,0}; // Si dejo esto cuenta 4 pasos cada click 107 | static int8_t enc_states[] = {0,-1,0,0,1,0,0, 0, 0,0,0,0,0,0, 0,0}; // Si dejo esto cuenta 1 paso cada click 108 | 109 | static uint8_t old_AB1; 110 | old_AB1 <<= 2; //remember previous state 111 | old_AB1 |= ( ENC_PORT1 & 0x03 ); //add current state 112 | int8_t result=enc_states[( old_AB1 & 0x0f )]; 113 | if (result>0) return (result +(9*shiftR1) ); 114 | if (result<0) return (result -(9*shiftR1) ); 115 | return 0; 116 | } 117 | 118 | 119 | 120 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 121 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 122 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 123 | 124 | // Función para iniciar la lectura ADC sin bloquear 125 | void startADC() { 126 | ads.startADCReading(ADS1X15_REG_CONFIG_MUX_SINGLE_0, false); // Canal 0, no bloqueante 127 | ads.startADCReading(ADS1X15_REG_CONFIG_MUX_SINGLE_1, false); // Canal 1, no bloqueante 128 | ads.startADCReading(ADS1X15_REG_CONFIG_MUX_SINGLE_2, false); // Canal 2, no bloqueante 129 | ads.startADCReading(ADS1X15_REG_CONFIG_MUX_SINGLE_3, false); // Canal 3, no bloqueante 130 | } 131 | 132 | // Función para leer el resultado si está listo 133 | void checkADC() { 134 | if (ads.conversionComplete()) { 135 | adcValue0 = ads.getLastConversionResults(); 136 | startADC(); // Iniciar nueva lectura inmediatamente 137 | } 138 | } 139 | 140 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 141 | void READ_POTS(){ 142 | // Leer del ADS1015 143 | // adc0 = map(ads.readADC_SingleEnded(0),0,1090,127,0); // MVOL 144 | // tmp_adc1 = map(ads.readADC_SingleEnded(1),0,1090,12,0); // FX1 145 | 146 | adc0 = map(ads.readADC_SingleEnded(0),0,1090,127,0); // 147 | adc1 = map(ads.readADC_SingleEnded(1),0,1090,12,0); // FX1 148 | adc2 = map(ads.readADC_SingleEnded(2), 0, 1090, 127, 0); // mvol 149 | adc3 = map(ads.readADC_SingleEnded(3), 0, 1090, 127, 0); // mfil 150 | 151 | if (adc0!=old_adc0){ 152 | old_adc0=adc0; 153 | //Serial.print("0 "); 154 | //Serial.println(adc0); 155 | 156 | } 157 | if (adc1!=old_adc1){ 158 | old_adc1=adc1; 159 | //Serial.print("1 "); 160 | //Serial.println(adc1); 161 | if (adc1>6) { 162 | fx1=3; 163 | } else if (adc1>3) { 164 | fx1=2; 165 | } else if (adc1>1) { 166 | fx1=1; 167 | } else { 168 | fx1=0; 169 | } 170 | } 171 | 172 | if (adc2!=old_adc2){ 173 | old_adc2=adc2; 174 | //Serial.print("2 "); 175 | //Serial.println(adc2); 176 | master_vol=adc2; 177 | synthESP32_setMVol(master_vol); 178 | drawBar(9); 179 | } 180 | 181 | if (adc3!=old_adc3){ 182 | old_adc3=adc3; 183 | //Serial.print("3 "); 184 | //Serial.println(adc3); 185 | master_filter=adc3; 186 | synthESP32_setMFilter(master_filter); 187 | drawBar(11); 188 | } 189 | 190 | } -------------------------------------------------------------------------------- /SOUNDS/zSAMPLE48.h: -------------------------------------------------------------------------------- 1 | const int16_t SAMPLE48[] PROGMEM = { 2 | 27, 37, 1915, 7894, 14556, 19885, 23681, 26344, // 0-7 3 | 28199, 29487, 30341, 30859, 31045, 30973, 30633, 30147, // 8-15 4 | 29450, 28619, 27482, 26081, 24175, 18913, 426, -16974, // 16-23 5 | -24437, -27369, -28086, -28225, -27890, -27540, -27034, -26598, // 24-31 6 | -26094, -25637, -25124, -24620, -24050, -23506, -22908, -22325, // 32-39 7 | -21658, -21028, -20271, -19554, -18485, -16912, -8721, 8306, // 40-47 8 | 21225, 27358, 29901, 30802, 31045, 30916, 30581, 30020, // 48-55 9 | 29356, 28495, 27567, 26376, 25056, 23158, 19798, 8301, // 56-63 10 | -8451, -18839, -23305, -24878, -25402, -25417, -25283, -24997, // 64-71 11 | -24665, -24273, -23866, -23434, -22988, -22509, -22018, -21511, // 72-79 12 | -20980, -20445, -19881, -19286, -18643, -17919, -17093, -15864, // 80-87 13 | -10833, 3416, 18012, 25870, 29442, 30879, 31425, 31489, // 88-95 14 | 31358, 31035, 30613, 30073, 29455, 28753, 27984, 27125, // 96-103 15 | 26200, 25180, 24036, 22744, 21146, 18913, 13214, 27, // 104-111 16 | -13830, -21611, -24868, -26005, -26315, -26238, -26015, -25687, // 112-119 17 | -25307, -24896, -24454, -23975, -23501, -23000, -22484, -21943, // 120-127 18 | -21387, -20824, -20251, -19643, -19006, -18328, -17586, -16718, // 128-135 19 | -15574, -13500, -9486, -3829, 2294, 7927, 12333, 15089, // 136-143 20 | 16094, 15385, 12980, 9085, 4086, -1514, -7022, -11366, // 144-151 21 | -13934, -15209, -15805, -16036, -16078, -16006, -15879, -15708, // 152-159 22 | -15495, -15242, -14951, -14649, -14319, -13979, -13609, -13205, // 160-167 23 | -12743, -12212, -11595, -10758, -9042, -4367, 4637, 15849, // 168-175 24 | 24366, 28897, 31045, 31983, 32335, 32392, 32258, 31993, // 176-183 25 | 31633, 31189, 30688, 30152, 29576, 28949, 28289, 27606, // 184-191 26 | 26892, 26160, 25396, 24609, 23793, 22930, 22046, 21126, // 192-199 27 | 20163, 19134, 18052, 16863, 15551, 13995, 12048, 9346, // 200-207 28 | 5619, 1391, -2484, -5553, -7677, -8917, -9347, -9034, // 208-215 29 | -8062, -6508, -4429, -1938, 831, 3580, 5989, 7842, // 216-223 30 | 9135, 9966, 10470, 10730, 10802, 10713, 10467, 10073, // 224-231 31 | 9527, 8770, 7708, 6138, 3729, 250, -4017, -8585, // 232-239 32 | -13071, -17197, -20851, -23720, -25618, -26615, -27007, -27027, // 240-247 33 | -26866, -26583, -26218, -25806, -25350, -24858, -24335, -23782, // 248-255 34 | -23199, -22581, -21906, -21149, -20263, -19095, -17346, -14765, // 256-263 35 | -11421, -7523, -3241, 1265, 5808, 9956, 13186, 15365, // 264-271 36 | 16657, 17350, 17647, 17680, 17516, 17178, 16705, 16099, // 272-279 37 | 15310, 14298, 12923, 10981, 8224, 4624, 540, -3625, // 280-287 38 | -7607, -11302, -14552, -17271, -19306, -20556, -21211, -21479, // 288-295 39 | -21494, -21372, -21159, -20894, -20583, -20249, -19891, -19514, // 296-303 40 | -19132, -18735, -18323, -17919, -17514, -17103, -16683, -16271, // 304-311 41 | -15882, -15480, -15085, -14713, -14351, -14001, -13664, -13351, // 312-319 42 | -13053, -12768, -12505, -12267, -12039, -11828, -11622, -11404, // 320-327 43 | -11217, -11024, -10823, -10622, -10419, -10208, -9997, -9783, // 328-335 44 | -9555, -9334, -9091, -8853, -8590, -8312, -8014, -7672, // 336-343 45 | -7307, -6903, -6414, -5776, -4893, -3576, -1752, 553, // 344-351 46 | 3217, 6138, 9266, 12551, 15918, 19181, 22039, 24178, // 352-359 47 | 25574, 26378, 26795, 26927, 26867, 26678, 26391, 26028, // 360-367 48 | 25614, 25153, 24639, 24108, 23545, 22962, 22347, 21714, // 368-375 49 | 21066, 20399, 19717, 19024, 18322, 17615, 16893, 16164, // 376-383 50 | 15439, 14725, 14030, 13343, 12673, 12055, 11467, 10916, // 384-391 51 | 10425, 9968, 9562, 9202, 8867, 8577, 8296, 8011, // 392-399 52 | 7735, 7445, 7125, 6785, 6403, 5969, 5490, 4954, // 400-407 53 | 4336, 3642, 2863, 2002, 1089, 114, -896, -1931, // 408-415 54 | -2943, -3940, -4898, -5814, -6655, -7419, -8109, -8687, // 416-423 55 | -9171, -9553, -9813, -9957, -9992, -9935, -9771, -9515, // 424-431 56 | -9148, -8672, -8131, -7513, -6809, -6030, -5206, -4355, // 432-439 57 | -3479, -2568, -1693, -837, -5, 769, 1476, 2084, // 440-447 58 | 2592, 2994, 3275, 3436, 3471, 3376, 3168, 2833, // 448-455 59 | 2374, 1793, 1111, 327, -544, -1489, -2484, -3504, // 456-463 60 | -4561, -5625, -6680, -7717, -8717, -9652, -10553, -11401, // 464-471 61 | -12180, -12887, -13527, -14091, -14582, -15004, -15373, -15666, // 472-479 62 | -15889, -16043, -16147, -16194, -16194, -16150, -16070, -15959, // 480-487 63 | -15820, -15659, -15482, -15294, -15093, -14887, -14674, -14463, // 488-495 64 | -14232, -14019, -13785, -13545, -13324, -13096, -12872, -12639, // 496-503 65 | -12396, -12158, -11917, -11681, -11436, -11188, -10949, -10694, // 504-511 66 | -10436, -10183, -9925, -9659, -9399, -9111, -8826, -8525, // 512-519 67 | -8208, -7875, -7513, -7126, -6697, -6226, -5690, -5092, // 520-527 68 | -4422, -3697, -2931, -2124, -1271, -407, 456, 1319, // 528-535 69 | 2168, 3002, 3813, 4592, 5329, 6029, 6686, 7294, // 536-543 70 | 7840, 8338, 8768, 9152, 9480, 9748, 9971, 10130, // 544-551 71 | 10251, 10331, 10373, 10370, 10338, 10266, 10169, 10065, // 552-559 72 | 9944, 9810, 9656, 9500, 9338, 9182, 9026, 8854, // 560-567 73 | 8681, 8522, 8353, 8194, 8028, 7862, 7698, 7532, // 568-575 74 | 7358, 7172, 6991, 6795, 6607, 6401, 6187, 5974, // 576-583 75 | 5758, 5532, 5304, 5066, 4830, 4585, 4359, 4123, // 584-591 76 | 3887, 3659, 3458, 3267, 3069, 2905, 2746, 2617, // 592-599 77 | 2505, 2416, 2339, 2285, 2270, 2255, 2260, 2309, // 600-607 78 | 2359, 2436, 2548, 2667, 2783, 2915, 3059, 3200, // 608-615 79 | 3342, 3483, 3617, 3748, 3870, 3972, 4054, 4130, // 616-623 80 | 4165, 4178, 4163, 4121, 4046, 3942, 3798, 3619, // 624-631 81 | 3426, 3193, 2920, 2615, 2292, 1942, 1563, 1153, // 632-639 82 | 731, 292, -157, -606, -1067, -1551, -2025, -2489, // 640-647 83 | -2960, -3432, -3888, -4335, -4767, -5183, -5590, -5982, // 648-655 84 | -6367, -6729, -7072, -7392, -7684, -7967, -8250, -8501, // 656-663 85 | -8749, -8970, -9166, -9357, -9523, -9674, -9811, -9930, // 664-671 86 | -10036, -10131, -10198, -10245, -10280, -10304, -10312, -10299, // 672-679 87 | -10285, -10245, -10188, -10121, -10022, -9915, -9803, -9677, // 680-687 88 | -9528, -9369, -9185, -9014, -8816, -8617, -8419, -8188, // 688-695 89 | -7945, -7714, -7469, -7208, -6935, -6657, -6362, -6057, // 696-703 90 | -5747, -5444, -5129, -4809, -4486, -4161, -3831, -3489, // 704-711 91 | -3154, -2834, -2514, -2189, -1879, -1574, -1283, -988, // 712-719 92 | -693, -412, -157, 96, 347, 583, 806, 1004, // 720-727 93 | 1208, 1394, 1565, 1736, 1888, 2036, 2165, 2292, // 728-735 94 | 2409, 2520, 2605, 2694, 2783, 2860, 2935, 2997, // 736-743 95 | 3061, 3121, 3175, 3212, 3257, 3299, 3342, 3371, // 744-751 96 | 3389, 3413, 3436, 3448, 3478, 3503, 3505, 3513, // 752-759 97 | 3513, 3523, 3533, 3533, 3538, 3545, 3557, 3562, // 760-767 98 | 3560, 3575, 3600, 3617, 3632, 3649, 3669, 3684, // 768-775 99 | 3721, 3768, 3803, 3843, 3895, 3942, 3974, 4019, // 776-783 100 | 4078, 4135, 4195, 4267, 4331, 4386, 4453, 4505, // 784-791 101 | 4572, 4634, 4696, 4746, 4781, 4818, 4843, 4875, // 792-799 102 | 4890, 4890, 4880, 4867, 4845, 4808, 4756, 4694, // 800-807 103 | 4612, 4527, 4428, 4309, 4183, 4039, 3895, 3731, // 808-815 104 | 3557, 3379, 3183, 2982, 2776, 2553, 2322, 2094, // 816-823 105 | 1863, 1622, 1372, 1116, 863, 607, 354, 104, // 824-831 106 | -159, -415, -665, -923, -1179, -1412, -1650, -1891, // 832-839 107 | -2127, -2343, -2568, -2774, -2978, -3184, -3362, -3551, // 840-847 108 | -3727, -3898, -4067, -4206, -4350, -4486, -4610, -4707, // 848-855 109 | -4811, -4916, -4997, -5067, -5131, -5188, -5236, -5273, // 856-863 110 | -5303, -5315, -5315, -5305, -5285, -5260, -5228, -5203, // 864-871 111 | -5161, -5119, -5049, -4980, -4916, -4836, -4742, -4648, // 872-879 112 | -4553, -4444, -4335, -4226, -4119, -3993, -3871, -3754, // 880-887 113 | -3625, -3496, -3380, -3253, -3132, -2998, -2879, -2757, // 888-895 114 | -2643, -2519, -2395, -2281, -2162, -2045, -1923, -1807, // 896-903 115 | -1700, -1598, -1487, -1377, -1276, -1179, -1087, -995, // 904-911 116 | -904, -819, -725, -643, -561, -474, -405, -328, // 912-919 117 | -251, -189, -122, -58, 7, 69, 136, 198, // 920-927 118 | 267, 329, 404, 456, 521, 578, 625, 679, // 928-935 119 | 746, 813, 853, 913, 972, 1032, 1086, 1141, // 936-943 120 | 1203, 1267, 1327, 1394, 1448, 1513, 1575, 1647, // 944-951 121 | 1731, 1801, 1863, 1937, 2002, 2074, 2146, 2203, // 952-959 122 | 2272, 2349, 2414, 2481, 2540, 2607, 2682, 2744, // 960-967 123 | 2820, 2885, 2947, 3004, 3059, 3111, 3168, 3217, // 968-975 124 | 3277, 3314, 3344, 3371, 3406, 3436, 3453, 3471, // 976-983 125 | 3483, 3485, 3468, 3466, 3453, 3428, 3399, 3371, // 984-991 126 | 3337, 3292, 3232, 3183, 3118, 3064, 2984, 2892, // 992-999 127 | 2806, 2714, 2607, 2508, 2411, 2307, 2193, 2079, // 1000-1007 128 | 1972, 1855, 1739, 1605, 1476, 1347, 1223, 1099, // 1008-1015 129 | 965, 828, 697, 570, 449, 312, 183, 57, // 1016-1023 130 | -65, -189, -306, -432, -554, -663, -770, -879, // 1024-1031 131 | -995, -1100, -1196, -1283, -1365, -1454, -1536, -1616, // 1032-1039 132 | -1690, -1752, -1824, -1894, -1943, -2008, -2067, -2099, // 1040-1047 133 | -2139, -2176, -2199, -2221, -2243, -2263, -2286, -2305, // 1048-1055 134 | -2305, -2313, -2313, -2305, -2310, -2305, -2298, -2278, // 1056-1063 135 | -2263, -2248, -2226, -2204, -2171, -2152, -2127, -2109, // 1064-1071 136 | -2085, -2050, -2020, -1990, -1958, -1933, -1899, -1861, // 1072-1079 137 | -1827, -1799, -1760, -1730, -1693, -1658, -1621, -1581, // 1080-1087 138 | -1551, -1507, -1462, -1415, -1385, -1358, -1318, -1283, // 1088-1095 139 | -1244, -1204, -1179, -1134, -1100, -1060, -1020, -978, // 1096-1103 140 | -936, -894, -849, -812, -777, -740, -693, -658, // 1104-1111 141 | -616, -576, -522, -484, -440, -393, -350, -308, // 1112-1119 142 | -271, -224, -174, -115, -58, -5, 44, 101, // 1120-1127 143 | 146, 205, 258, 317, 367, 416, 476, 533, // 1128-1135 144 | 597, 650, 697, 756, 823, 890, 947, 999, // 1136-1143 145 | 1051, 1118, 1173, 1218, 1287, 1357, 1414, 1463, // 1144-1151 146 | 1506, 1553, 1607, 1649, 1684, 1719, 1761, 1801, // 1152-1159 147 | 1838, 1868, 1902, 1930, 1950, 1984, 2002, 2014, // 1160-1167 148 | 2032, 2046, 2056, 2061, 2069, 2071, 2071, 2074, // 1168-1175 149 | 2071, 2064, 2039, 2012, 1997, 1984, 1957, 1925, // 1176-1183 150 | 1898, 1863, 1826, 1783, 1746, 1706, 1664, 1620, // 1184-1191 151 | 1568, 1520, 1471, 1424, 1364, 1307, 1252, 1190, // 1192-1199 152 | 1128, 1071, 1017, 970, 908, 851, 788, 731, // 1200-1207 153 | 679, 620, 540, 486, 434, 377, 325, 270, // 1208-1215 154 | 218, 153, 96, 49, -5, -50, -102, -149, // 1216-1223 155 | -189, -234, -278, -321, -363, -390, -425, -472, // 1224-1231 156 | -517, -556, -581, -611, -633, -663, -685, -708, // 1232-1239 157 | -732, -757, -777, -794, -817, -837, -854, -871, // 1240-1247 158 | -884, -906, -921, -936, -943, -948, -961, -971, // 1248-1255 159 | -981, -985, -985, -993, -993, -993, -998, -1000, // 1256-1263 160 | -1015, -1020, -1010, -1013, -1015, -1010, -1013, -1015, // 1264-1271 161 | -1008, -1003, -995, -993, -973, -963, -956, -946, // 1272-1279 162 | -933, -926, -916, -906, -889, -869, -859, -844, // 1280-1287 163 | -824, -807, -794, -777, -762, -742, -725, -698, // 1288-1295 164 | -675, -653, -628, -603, -571, -554, -529, -497, // 1296-1303 165 | -474, -447, -420, -383, -350, -313, -278, -246, // 1304-1311 166 | -214, -174, -137, -117};// 1312-1315 167 | 168 | -------------------------------------------------------------------------------- /keys.ino: -------------------------------------------------------------------------------- 1 | 2 | void DO_KEYPAD(){ 3 | 4 | for (int f=0;f<48;f++) { 5 | if (trigger_on[f]==1){ 6 | trigger_on[f]=0; 7 | 8 | nkey=f; 9 | 10 | show_last_touched=true; 11 | start_showlt=start_debounce; 12 | 13 | if (nkey<16){ 14 | 15 | switch (modeZ) { 16 | 17 | case tPiano: // 16 keys=16 notes 18 | synthESP32_TRIGGER_P(selected_sound,nkey+(12*octave)); 19 | if (recording){ 20 | bitWrite(pattern[selected_sound],sstep,1); 21 | melodic[selected_sound][sstep]=nkey+(12*octave); 22 | } 23 | refreshPATTERN=true; 24 | break; 25 | case tPad: // play pads 26 | 27 | synthESP32_TRIGGER(nkey); 28 | 29 | 30 | if (recording){ 31 | bitWrite(pattern[nkey],sstep,1); //!bitRead(pattern[nkey],sstep)); 32 | melodic[selected_sound][nkey]=ROTvalue[selected_sound][3]; 33 | } else { 34 | 35 | synthESP32_TRIGGER(nkey); 36 | 37 | } 38 | //if (!shiftR1 && !shifting){ 39 | selected_sound=nkey; 40 | if (selected_sound!=oldselected_sound){ 41 | oldselected_sound=selected_sound; 42 | setSound(nkey); 43 | select_rot(); 44 | draw8aBar(); 45 | } 46 | //} 47 | refreshPATTERN=true; 48 | break; 49 | case tSel: // Select sound 50 | selected_sound=nkey; 51 | if (selected_sound!=oldselected_sound){ 52 | oldselected_sound=selected_sound; 53 | setSound(nkey); 54 | select_rot(); 55 | } 56 | modeZ=tWrite; 57 | refreshPATTERN=true; 58 | draw8aBar(); 59 | refreshMODES=true; 60 | break; 61 | case tWrite: 62 | bitWrite(pattern[selected_sound],nkey,!bitRead(pattern[selected_sound],nkey)); 63 | melodic[selected_sound][nkey]=ROTvalue[selected_sound][3]; 64 | refreshPATTERN=true; 65 | break; 66 | case tMelod: 67 | bitWrite(isMelodic,nkey,!bitRead(isMelodic,nkey)); 68 | refreshPATTERN=true; 69 | //selected_sound=nkey; 70 | break; 71 | 72 | case tMute: 73 | bitWrite(mutes,nkey,!bitRead(mutes,nkey)); 74 | refreshPATTERN=true; 75 | break; 76 | case tSolo: 77 | bitWrite(solos,nkey,!bitRead(solos,nkey)); 78 | refreshPATTERN=true; 79 | break; 80 | case tClear: // clear 81 | pattern[nkey]=0; 82 | break; 83 | case tLoadP: 84 | load_pattern(nkey); 85 | pattern_song_counter=nkey; 86 | selected_pattern=nkey; 87 | // select_rot(); 88 | // draw8aBar(); 89 | break; 90 | case tSaveP: 91 | save_pattern(nkey); 92 | selected_pattern=nkey; 93 | modeZ=tPad; // pongo el modeZ en 0 para que no se quede en grabar 94 | refreshMODES=true; 95 | break; 96 | case tLoadS: 97 | load_sound(nkey); 98 | selected_sndSet=pattern_song_counter; 99 | selected_sndSet=nkey; 100 | select_rot(); 101 | draw8aBar(); 102 | break; 103 | case tSaveS: 104 | save_sound(nkey); 105 | selected_sndSet=nkey; 106 | modeZ=tPad; // pongo el modeZ en 0 para que no se quede en grabar 107 | refreshMODES=true; 108 | break; 109 | case tLoaPS: 110 | load_pattern(nkey); 111 | pattern_song_counter=nkey; 112 | selected_pattern=nkey; 113 | load_sound(nkey); 114 | selected_sndSet=pattern_song_counter; 115 | selected_sndSet=nkey; 116 | select_rot(); 117 | draw8aBar(); 118 | break; 119 | case tSavPS: 120 | save_pattern(nkey); 121 | selected_pattern=nkey; 122 | save_sound(nkey); 123 | selected_sndSet=nkey; 124 | modeZ=tPad; // pongo el modeZ en 0 para que no se quede en grabar 125 | refreshMODES=true; 126 | break; 127 | case tRndS: 128 | selected_sound=nkey; 129 | setRandomVoice(nkey); 130 | setSound(nkey); 131 | select_rot(); 132 | draw8aBar(); 133 | break; 134 | case tRndS2: 135 | selected_sound=nkey; 136 | setRandomVoice2(nkey); 137 | setSound(nkey); 138 | select_rot(); 139 | draw8aBar(); 140 | break; 141 | case tRndP: 142 | selected_sound=nkey; 143 | setRandomPattern(nkey); 144 | setSound(nkey); 145 | // select_rot(); 146 | // draw8aBar(); 147 | break; 148 | case tRndNo: 149 | selected_sound=nkey; 150 | setRandomNotes(nkey); 151 | setSound(nkey); 152 | // select_rot(); 153 | // draw8aBar(); 154 | break; 155 | case tFirst: 156 | refreshPATTERN=true; 157 | firstStep=nkey; 158 | break; 159 | case tLast: 160 | refreshPATTERN=true; 161 | newLastStep=nkey; 162 | break; 163 | case tMemo: // memory 164 | selected_memory=nkey; 165 | break; 166 | case tMfirs: 167 | refreshPATTERN=true; 168 | firstMemory=nkey; 169 | break; 170 | case tMlast: 171 | refreshPATTERN=true; 172 | newLastMemory=nkey; 173 | break; 174 | 175 | } 176 | //refreshPADTOUCHED=true; 177 | 178 | //// 8 keys 179 | } else if (nkey<24){ 180 | 181 | refreshMODES=true; 182 | 183 | if (!shiftR1 && !shifting){ 184 | switch (nkey) { 185 | 186 | // playpad/select/write 187 | case 16: 188 | // 0 - play pad sound 189 | // 1 - select sound 190 | // 2 - edit track, write 191 | if (modeZ>tWrite){ 192 | modeZ=tPad; 193 | } else { 194 | modeZ++; 195 | } 196 | 197 | if (modeZ>tWrite) modeZ=tPad; 198 | 199 | if (modeZ==tWrite) { 200 | refreshPATTERN=true; 201 | } else { 202 | clearPATTERNPADS=true; 203 | } 204 | break; 205 | // random sound/pattern/Notes 206 | case 17: 207 | if (modeZ==tRndP){ 208 | modeZ=tRndS; 209 | } else if (modeZ==tRndS){ 210 | modeZ=tRndNo; 211 | } else { 212 | modeZ=tRndP; 213 | } 214 | clearPATTERNPADS=true; 215 | break; 216 | // load 217 | case 18: 218 | if (modeZ==tLoaPS) { 219 | modeZ=tLoadP; 220 | } else if (modeZ==tLoadP ) { 221 | modeZ=tLoadS; 222 | } else { 223 | modeZ=tLoaPS; 224 | } 225 | clearPATTERNPADS=true; 226 | break; 227 | // save 228 | case 19: 229 | if (modeZ==tSavPS) { 230 | modeZ=tSaveP; 231 | } else if (modeZ==tSaveP ) { 232 | modeZ=tSaveS; 233 | } else { 234 | modeZ=tSavPS; 235 | } 236 | clearPATTERNPADS=true; 237 | break; 238 | // solos/mutes/melodic 239 | case 20: 240 | if (modeZ==tMute) { 241 | modeZ=tSolo; 242 | } else if (modeZ==tSolo){ 243 | modeZ=tMelod; 244 | } else if (modeZ==tMelod){ 245 | modeZ=tClear; 246 | } else if (modeZ==tClear){ 247 | modeZ=tFirst; 248 | } else if (modeZ==tFirst){ 249 | modeZ=tLast; 250 | } else { 251 | modeZ=tMute; 252 | } 253 | refreshPATTERN=true; 254 | break; 255 | // piano 256 | case 21: 257 | modeZ=tPiano; 258 | clearPATTERNPADS=true; 259 | break; 260 | // Play 261 | case 22: 262 | if (playing){ 263 | uClock.stop(); 264 | //stopTimer(); 265 | sstep=firstStep; 266 | recording=false; 267 | clearPADSTEP=true; 268 | pattern_song_counter=0; 269 | } else { 270 | if (sync_state==2){ // if this machine is slave dont start playing now 271 | pre_playing=true; 272 | } else { 273 | if (songing) pattern_song_counter=selected_pattern; 274 | uClock.start(); 275 | //startTimer(); 276 | sstep=firstStep; 277 | refreshPADSTEP=true; 278 | } 279 | } 280 | playing=!playing; 281 | break; 282 | // Song 283 | case 23: 284 | if (modeZ==tMemo) { 285 | modeZ=tMfirs; 286 | } else if (modeZ==tMfirs) { 287 | modeZ=tMlast; 288 | } else if (modeZ==tMlast) { 289 | modeZ=tMemo; 290 | } else { 291 | songing=!songing; 292 | if (recording) songing=false; // if recording I cant set song mode 293 | } 294 | break; 295 | } 296 | 297 | // shift 298 | 299 | } else { 300 | switch (nkey){ 301 | case 16: 302 | modeZ=tSel; 303 | break; 304 | case 17: 305 | modeZ=tRndS2; 306 | break; 307 | // reset mutes & solos and firstStep=0 and lastStep=15 308 | case 20: 309 | mutes=0; 310 | solos=0; 311 | firstStep=0; 312 | lastStep=15; 313 | clearPATTERNPADS=true; 314 | break; 315 | // Play 316 | case 22: 317 | if (playing){ 318 | recording=!recording; 319 | } else { 320 | uClock.start(); 321 | //startTimer(); 322 | recording=true; 323 | playing=true; 324 | sstep=firstStep; 325 | refreshPADSTEP=true; 326 | } 327 | if (songing) recording=false; // in song mode cant save modified patterns. I would need a new flag. so much cpu time? 328 | //refreshMODES=true; 329 | break; 330 | case 23: 331 | modeZ=tMemo; 332 | break; 333 | } 334 | } 335 | } else if (nkey<32){ 336 | switch (nkey){ 337 | case 24: 338 | shifting=!shifting; 339 | refresh_shift_key(); 340 | break; 341 | case 25: 342 | old_counter1=counter1; 343 | if (shifting || shiftR1) { 344 | counter1=counter1-1; 345 | } else { 346 | counter1=counter1-1; 347 | } 348 | do_rot(); 349 | break; 350 | case 26: 351 | old_counter1=counter1; 352 | if (shifting || shiftR1) { 353 | counter1=counter1-100; 354 | } else { 355 | counter1=counter1-10; 356 | } 357 | do_rot(); 358 | break; 359 | case 27: 360 | old_counter1=counter1; 361 | if (shifting || shiftR1) { 362 | counter1=counter1+100; 363 | } else { 364 | counter1=counter1+10; 365 | } 366 | do_rot(); 367 | break; 368 | case 28: 369 | old_counter1=counter1; 370 | if (shifting || shiftR1) { 371 | counter1=counter1+1; 372 | } else { 373 | counter1=counter1+1; 374 | } 375 | do_rot(); 376 | break; 377 | case 31: 378 | shifting=!shifting; 379 | refresh_shift_key(); 380 | break; 381 | } 382 | //refreshPADTOUCHED=true; 383 | } else { // bars 384 | selected_rot=nkey-32; 385 | 386 | if (shifting || shiftR1) { 387 | if (selected_rot==1){ 388 | ROTvalue[selected_sound][1]=min_values[1]; 389 | } 390 | if (selected_rot==2){ 391 | ROTvalue[selected_sound][2]=max_values[2]; 392 | } 393 | } 394 | select_rot(); 395 | drawBar(selected_rot); 396 | 397 | } 398 | } 399 | } 400 | } 401 | -------------------------------------------------------------------------------- /SOUNDS/zSAMPLE40.h: -------------------------------------------------------------------------------- 1 | const int16_t SAMPLE40[1734] PROGMEM = { 2 | -2, -4, 27, -1074, -6014, -6080, -5343, -2625, // 0-7 3 | 11084, 9018, -1668, -5693, -543, 7616, 8698, 13752, // 8-15 4 | 3823, -16070, -27484, -15204, 7496, 16845, 5400, -7584, // 16-23 5 | -497, 8066, 10833, 4663, -6895, -6954, 5975, 8652, // 24-31 6 | 2719, -7435, -7083, -8302, -2761, 12044, 12989, -810, // 32-39 7 | -19516, -13572, 2597, 12791, 10024, -3876, -18677, -18595, // 40-47 8 | -8666, 4359, 9332, 18706, 17383, 3586, -19114, -21256, // 48-55 9 | -2081, 1920, -4362, -10085, 4369, 12362, 10311, -2146, // 56-63 10 | -8632, -7000, 2865, -12573, -11667, 10521, 22260, 10077, // 64-71 11 | -11204, -7265, 4292, 12920, 6085, 9255, 8877, 1003, // 72-79 12 | -22683, -27233, -6164, 8427, 14995, 10598, -2421, -12323, // 80-87 13 | -16090, -15721, -9613, 467, 9820, 10363, 5414, 960, // 88-95 14 | -883, 5022, 6530, -10719, -26517, -24755, -548, 12254, // 96-103 15 | 8403, -6287, -7139, -6095, -6865, 5414, 3411, -7644, // 104-111 16 | -9651, 2732, 11970, 279, -5066, -5439, -2022, -2929, // 112-119 17 | -4272, -4065, 8300, 4679, -6428, -327, 2459, -93, // 120-127 18 | -5629, -7390, -3319, 4601, 7666, 2092, -7930, -1818, // 128-135 19 | -1242, -2364, 6513, 12858, 10517, 853, -4790, 3931, // 136-143 20 | 23015, 25228, 18355, 4612, -21912, -32393, -20581, -2318, // 144-151 21 | 14044, 19283, 14446, 4579, -145, 2940, 7132, 5723, // 152-159 22 | -3108, -16118, -19019, -10853, -4985, 4567, 8346, 4206, // 160-167 23 | -7196, -5367, 13173, 18700, 14677, 4940, -5429, -9051, // 168-175 24 | -3261, 9213, 14904, 16481, 17826, 12783, 2593, -8498, // 176-183 25 | -19267, -17760, -5873, 5628, 2050, -8534, -8457, -13, // 184-191 26 | 6671, 1602, -6481, -9183, -1057, 1068, 5843, 9918, // 192-199 27 | 10631, -2376, -17186, -15735, -1625, 11836, 12225, 10357, // 200-207 28 | 4586, -3323, -16501, -24032, -19830, 527, 12668, 10438, // 208-215 29 | -3795, -3537, 4715, 7762, -3792, -13212, -9039, -11157, // 216-223 30 | -4896, 5854, 5002, 2676, 3468, 8581, 6468, -1078, // 224-231 31 | -8653, -4480, 716, -1023, 1348, -660, -4992, -8507, // 232-239 32 | -1363, 6908, 4170, -2416, -8831, -13806, -794, 6573, // 240-247 33 | -1589, -17667, -19385, -5946, 3399, -4489, -13299, 5994, // 248-255 34 | 13805, 4380, -19052, -17648, -1735, 13202, 18481, 13554, // 256-263 35 | 4953, 2513, 6348, 11239, 10533, 7465, 2186, -3828, // 264-271 36 | 1770, 6329, 2739, -1438, -1342, 1374, -9431, -8472, // 272-279 37 | 89, 4495, -1416, -10693, -15652, -8508, -4056, -9405, // 280-287 38 | -10719, -9534, -4893, 5343, 5290, -1179, -1337, -2778, // 288-295 39 | -7382, -16118, -14809, -9063, -2958, 4373, 9529, 9832, // 296-303 40 | 4526, -4047, -8514, 468, 2327, -1079, -5721, 6848, // 304-311 41 | 15349, 10486, -944, -4116, 2691, 10742, 5598, -3668, // 312-319 42 | 369, 9629, 8092, -13701, -8460, 6570, 16471, 15576, // 320-327 43 | 9974, 3906, 3033, -2039, -8285, -9953, -1174, 8013, // 328-335 44 | 8193, 7236, 3296, -1390, 499, 1494, -1071, -5087, // 336-343 45 | -7095, -3939, 5750, 7422, 4912, 2664, 5263, 850, // 344-351 46 | -10997, -8771, -2307, 1614, -1151, -6287, -9022, -5372, // 352-359 47 | -1292, 3239, 7911, 980, -4384, -2134, 570, 3191, // 360-367 48 | 2786, -6694, -6849, -646, 2573, 606, -468, 2736, // 368-375 49 | 2571, -6045, -19878, -20957, -10932, 3117, 8440, 9734, // 376-383 50 | 5677, -2994, -6080, -3448, 1, 750, -1485, -3992, // 384-391 51 | -7522, -5441, 733, 7894, 2379, -5222, 731, -1684, // 392-399 52 | -9142, -14356, -10539, 1557, 12920, 11326, -1005, -11736, // 400-407 53 | -2096, 6199, 6139, -1241, -9544, -8555, 4031, 517, // 408-415 54 | -7766, -10504, 3346, 12560, 11129, 5266, -3469, -8812, // 416-423 55 | -4922, -7263, -7315, 1674, 8810, 11896, 9481, 3260, // 424-431 56 | -2443, -3812, -1287, 1970, 3964, 6542, 802, -3506, // 432-439 57 | -54, 8763, 9531, 534, -423, -160, -1971, -12281, // 440-447 58 | -11535, -3469, 1475, 1461, 3093, 11079, 3090, -1078, // 448-455 59 | 3911, 9236, 3964, -6854, -6468, -1603, 4217, 6146, // 456-463 60 | 7812, 7319, 5146, 803, 84, 2231, -3809, -6634, // 464-471 61 | -3141, 4881, 7240, 3907, -1978, -4192, -5267, -7801, // 472-479 62 | -14950, -16570, -8843, -724, 4826, 4484, -1658, -5856, // 480-487 63 | -4278, 1540, 2657, 317, -1187, -3790, -1988, 2301, // 488-495 64 | 1693, -3982, -7703, 1372, 9499, 9050, -4056, -6033, // 496-503 65 | -4530, -6705, -9457, -9529, -5824, 202, 2111, -67, // 504-511 66 | -885, 2300, 4534, -2697, 987, 1824, -6796, -8402, // 512-519 67 | -2074, 7604, 11594, 9706, 2092, -11573, -14728, -7770, // 520-527 68 | 1875, 4071, 3507, 5003, 9875, 7980, -629, -1347, // 528-535 69 | 3229, 7769, 2997, -1717, -2824, 3543, -2185, -4252, // 536-543 70 | 5421, 8463, 6623, 1774, -2819, -4965, -4278, -4013, // 544-551 71 | -1668, 669, 2078, 1661, 2243, 4320, 5787, 2782, // 552-559 72 | -3151, -2898, -2053, -827, 2092, 2657, -270, -5332, // 560-567 73 | -5118, -267, 5261, 3993, 1432, 462, -1677, -875, // 568-575 74 | 1764, 3600, 450, -2599, 705, -4023, -6286, -904, // 576-583 75 | -719, -384, 333, -3474, -5533, -6244, -11076, -6761, // 584-591 76 | 1667, 6029, 5562, 597, -5909, -3043, -811, -2057, // 592-599 77 | -1818, -287, 656, -301, -5777, -7696, 623, 6171, // 600-607 78 | 5202, -2314, -4834, -6985, -8936, -9161, -3778, 4598, // 608-615 79 | 9868, 11604, 6163, -7036, -6853, 900, 7214, 3261, // 616-623 80 | -488, 992, 5254, 5251, 2109, 3583, -713, -4953, // 624-631 81 | -3005, -499, 1985, 3471, 3531, 1557, -19, 3146, // 632-639 82 | 5032, 2033, -6591, -11088, -7571, 1999, 4268, -519, // 640-647 83 | -7742, -4960, -1157, -1186, -4235, -7443, -7445, -1636, // 648-655 84 | 3212, 4148, -670, 3006, 2705, -5779, -8555, -3700, // 656-663 85 | 4230, 5089, 281, -4960, -2794, 827, 4189, 5577, // 664-671 86 | 479, -5047, -5654, -4041, 525, 5740, 7755, 7910, // 672-679 87 | 5862, 1875, -4717, -8603, -5530, -165, 3655, 3507, // 680-687 88 | 2056, -2120, -5241, 2217, 3906, -1053, -5296, -5480, // 688-695 89 | -1873, 1487, 5137, 4256, -122, 1729, 4620, 4792, // 696-703 90 | 3715, -2964, -8665, -3575, 3176, 7279, 5848, 2576, // 704-711 91 | -2948, -7952, -6837, -1682, 3535, 6458, 3445, -3290, // 712-719 92 | -9080, -6055, 1089, 3605, 7594, 5424, -2388, -7737, // 720-727 93 | -5590, 1382, 5732, 5936, 4136, 2336, 4802, 4306, // 728-735 94 | -3453, -10188, -8493, 1070, 5574, 2303, -4601, -4559, // 736-743 95 | -346, 2768, -495, -4796, -5856, -1926, 4108, 3466, // 744-751 96 | -5629, -10274, -8498, -1029, 4928, 8930, 7092, -1917, // 752-759 97 | -7768, -6258, 1284, 3531, 1439, -1536, 3423, 5458, // 760-767 98 | 1573, -4453, -6188, -2201, 4174, 5227, 1085, -4010, // 768-775 99 | -1878, 3426, 6293, 5627, 766, -3688, 704, 4163, // 776-783 100 | 3177, -3237, -1308, 2853, 1573, -585, -3960, -6445, // 784-791 101 | -3288, 1056, 2593, -2209, -3548, -3299, -8304, -7007, // 792-799 102 | -1825, 2966, 6599, 7583, 6042, 4069, 912, -2611, // 800-807 103 | -3204, -4681, -3975, 2870, 5300, 3268, -353, -727, // 808-815 104 | 2229, 5575, 2717, -1421, -3084, 444, 2609, 1377, // 816-823 105 | -2879, -3027, -681, 1078, 2830, 3650, 3382, 1916, // 824-831 106 | 58, -1160, -236, 860, 566, -2697, -696, 2330, // 832-839 107 | 1853, -3108, -6165, -3597, -2642, 931, 3722, 1504, // 840-847 108 | -5063, -9630, -6481, -289, 4393, 4838, -1277, -5028, // 848-855 109 | -2311, -665, 1925, 3552, 905, -353, 331, 1995, // 856-863 110 | -3307, -8623, -7248, -2780, 582, 846, 3859, 4189, // 864-871 111 | 1437, -3621, -4231, -2702, -4597, 262, 4488, 2253, // 872-879 112 | 1259, -880, -3769, -4735, -2263, 1724, 2609, 3516, // 880-887 113 | 4038, 3870, 451, -2847, -3489, -2313, -1670, -2005, // 888-895 114 | -435, 1001, 1709, 3023, -71, -3838, -2472, -543, // 896-903 115 | -282, -2783, 798, 3791, 2847, -3481, -5540, -1698, // 904-911 116 | 2389, 4677, 4368, 3212, 906, -602, -892, -806, // 912-919 117 | -325, 228, -3798, -3469, 1411, 5247, 4486, -524, // 920-927 118 | -6768, -5286, 711, 4677, 3553, -1126, -5681, -6715, // 928-935 119 | -5492, -2933, 1935, 3208, 1564, -670, -2287, -2826, // 936-943 120 | -1838, -2031, -88, 3550, 6180, 3708, -1893, -6131, // 944-951 121 | -3829, 1379, 3521, -645, -4491, -1914, 328, 3779, // 952-959 122 | 7058, 6134, 5438, 4273, -804, -6330, -7361, -280, // 960-967 123 | 4024, 4630, 2516, 2495, 1700, -521, -2431, -2301, // 968-975 124 | -954, -1849, 250, 2957, 2956, 1315, -377, -557, // 976-983 125 | 1135, 1573, 304, 4474, 2315, -3041, 546, 1169, // 984-991 126 | -478, -1969, 278, 2726, 2908, -447, -2282, -1026, // 992-999 127 | 984, 407, -2823, -6935, -4936, 235, 2545, 1688, // 1000-1007 128 | -418, -974, 766, 676, -1969, 1549, 2078, -268, // 1008-1015 129 | -3864, 158, 2609, -6463, -5137, 1054, 4941, 5032, // 1016-1023 130 | 831, -4506, -3859, -1766, -1151, -3326, -4863, -3706, // 1024-1031 131 | 388, 2277, 1387, -1358, -2795, -3037, -2027, -2, // 1032-1039 132 | 2667, 4442, 3919, 917, -899, 2293, -2447, -6600, // 1040-1047 133 | -3901, 1549, 5548, 5426, 2835, -786, -2390, -719, // 1048-1055 134 | 1983, 3651, 4113, 1011, -2256, -3445, 1162, 2866, // 1056-1063 135 | -277, -4130, -2843, 1839, 3249, 221, -2960, -134, // 1064-1071 136 | -1601, -2222, 34, 582, -212, -1529, -3804, -3247, // 1072-1079 137 | -325, 1959, 2775, 2071, 759, 839, 1496, 1667, // 1080-1087 138 | 1819, 1654, 1319, 924, 987, 924, -737, 709, // 1088-1095 139 | 2959, 2634, 642, -1804, -3027, -4937, -2783, 1968, // 1096-1103 140 | 300, -798, 230, 3481, 1523, -2144, -2840, -1734, // 1104-1111 141 | -1533, -3446, -2879, -547, 2129, 1307, 2231, 3042, // 1112-1119 142 | -1612, -621, 2846, 3249, 1525, 278, 1339, -2974, // 1120-1127 143 | -4424, -1424, 3210, 2207, -2503, -4408, -1758, 2732, // 1128-1135 144 | 4239, 3112, -456, -4092, -5767, -3943, -220, 2136, // 1136-1143 145 | 1736, -499, -1512, -3221, -3159, -152, 2255, 2904, // 1144-1151 146 | 1954, -2201, -2192, 1570, -1998, -2720, -1266, -2412, // 1152-1159 147 | -1806, 451, 2626, 2653, -171, -4388, -2976, -1723, // 1160-1167 148 | -1837, 2724, 2770, -866, -2795, -2848, -1225, 444, // 1168-1175 149 | 1930, 3048, 4271, 1348, 609, 2425, 4012, -627, // 1176-1183 150 | -7120, -5430, -2070, 675, 563, 3114, 5359, 5694, // 1184-1191 151 | -1323, -4133, -322, 2708, 3358, 1444, -1029, -1615, // 1192-1199 152 | -165, 1638, 1277, 1052, 2557, 1734, 1381, 1621, // 1200-1207 153 | 1923, -147, -2349, -598, -1631, -3754, -3714, -3044, // 1208-1215 154 | -818, 1707, 2008, -846, -4503, -4630, -2182, 1200, // 1216-1223 155 | 4373, 2653, -33, 448, 2480, 1578, -3395, -1636, // 1224-1231 156 | -432, -598, 2246, 3287, 2009, 400, -2258, -3652, // 1232-1239 157 | -2251, 144, 1722, 1540, 1348, 252, -981, -959, // 1240-1247 158 | -320, -52, -605, -396, 1083, 3016, 2997, 1810, // 1248-1255 159 | 742, -2412, -2252, 781, 2592, 1161, -1060, -476, // 1256-1263 160 | 1430, 2456, 1274, -4145, -7258, -4424, 613, 3918, // 1264-1271 161 | 3296, -1299, -2711, -323, 2245, 1812, 104, 156, // 1272-1279 162 | 1650, 2013, -80, 1515, -495, -4717, -2586, -959, // 1280-1287 163 | -361, 510, 1803, 1394, -1972, -2416, -2206, -2398, // 1288-1295 164 | -1813, 616, 2779, -763, -2953, -3151, -2496, -1897, // 1296-1303 165 | -160, 2653, 4083, 2075, -2520, -4528, -2182, 1855, // 1304-1311 166 | -1122, -971, 1604, 4146, 718, -1644, 2124, 4055, // 1312-1319 167 | 2446, -1869, -3317, -1540, 1721, 2035, 2126, 1676, // 1320-1327 168 | 252, 1291, 2722, 2044, 2300, 1812, 673, 422, // 1328-1335 169 | 867, 1095, 391, -1397, -2649, -1342, 496, 2129, // 1336-1343 170 | 2464, 1930, 75, -2014, -4266, -2787, 766, 1937, // 1344-1351 171 | -341, -3584, -4006, -1663, 468, -253, 894, 1594, // 1352-1359 172 | 1204, 731, 262, -143, -401, 200, 865, 249, // 1360-1367 173 | -1124, -2050, -1060, -2479, -1866, 1228, 2421, 1061, // 1368-1375 174 | -1428, -2500, -1588, -347, -669, -2100, -2072, 774, // 1376-1383 175 | 2708, 2107, -639, -909, -626, -25, 1391, 1767, // 1384-1391 176 | 1159, 434, 386, 489, 252, 463, 867, 1271, // 1392-1399 177 | 1980, 1886, 360, -3908, -4077, -956, 1638, 1312, // 1400-1407 178 | 80, 372, 525, 1039, 1501, 1985, 1649, 645, // 1408-1415 179 | -899, -1031, -390, -536, -739, -2457, -5578, -2766, // 1416-1423 180 | 1322, 2935, 889, -911, -1122, -1351, -1253, -459, // 1424-1431 181 | 2176, -612, -2836, -26, 546, 1681, 2916, -1461, // 1432-1439 182 | -3381, -1474, -686, 781, 1604, 1796, -530, -727, // 1440-1447 183 | 2622, 2236, -825, -4058, -3288, 79, 3035, 2062, // 1448-1455 184 | 419, -585, 34, -282, -741, -722, 477, 1082, // 1456-1463 185 | 688, 879, 819, 572, 573, 903, 1176, 867, // 1464-1471 186 | 1846, 2057, 376, 341, -128, -1096, 158, 864, // 1472-1479 187 | 523, 310, -586, -1120, -169, 72, 599, 1679, // 1480-1487 188 | 384, -1452, -2294, -590, -23, -603, 657, -133, // 1488-1495 189 | -1588, -1687, 166, 1769, 1492, 1195, 462, -444, // 1496-1503 190 | -1856, -1735, -409, 750, 886, 292, -387, 77, // 1504-1511 191 | 544, 209, -150, -57, 510, 939, 1377, 1401, // 1512-1519 192 | -275, 541, 1386, -698, -1196, -607, 27, 1307, // 1520-1527 193 | 352, -2362, -1897, -287, 1142, 1207, -35, -1528, // 1528-1535 194 | -1352, -1263, 278, 2691, 2408, -595, -4207, -3178, // 1536-1543 195 | -432, 1429, -509, 68, 1628, 1595, -284, -2088, // 1544-1551 196 | -2139, 199, 2253, 2446, 51, -420, 448, -1423, // 1552-1559 197 | -2010, -1067, 633, 2174, 2506, 1365, -554, -1720, // 1560-1567 198 | -1356, 444, 1080, 314, -469, 312, 1674, 1573, // 1568-1575 199 | 381, -1509, -2689, -3213, -1615, 888, 2157, 743, // 1576-1583 200 | -1311, -449, 1353, 2097, 431, -504, -337, 766, // 1584-1591 201 | 893, 405, -327, 286, -280, -1557, -1701, -1050, // 1592-1599 202 | 194, 1513, 1398, 1058, 1528, 906, 687, 972, // 1600-1607 203 | 1743, 908, -421, -102, 623, 1094, 1346, -603, // 1608-1615 204 | -1060, 1101, 438, -1663, -3232, -1679, 671, 1685, // 1616-1623 205 | 609, -2510, -3936, -531, 1631, 2379, 1896, -305, // 1624-1631 206 | -1832, -1146, 1276, 2650, 1722, -956, -3046, -2648, // 1632-1639 207 | 424, 2160, 2478, 1714, 941, -993, -3034, -1945, // 1640-1647 208 | 319, 1908, 1776, 261, -1727, -3123, -1170, 707, // 1648-1655 209 | 1, -107, -1165, -2280, -1079, 730, 1497, 451, // 1656-1663 210 | -174, 190, 1023, 1580, 1308, 523, -457, 386, // 1664-1671 211 | 1889, -710, -2718, -2447, 230, 1241, 673, -317, // 1672-1679 212 | -449, 25, 549, 405, 573, 1262, 1582, 1271, // 1680-1687 213 | 389, -176, -770, -713, -49, 1425, 1511, -174, // 1688-1695 214 | -1589, -1232, 467, 943, 1121, 1267, 1394, 1734, // 1696-1703 215 | 822, -2151, -2531, -1014, 809, 1454, 1448, 1308, // 1704-1711 216 | 561, 458, 644, 1233, -1316, -3262, -1261, 910, // 1712-1719 217 | 628, -2376, -3113, -1292, 1382, -50, -25, 1157, // 1720-1727 218 | 1446, 815, 5, -128, 359, 1178};// 1728-1733 219 | 220 | 221 | -------------------------------------------------------------------------------- /synthESP32.ino: -------------------------------------------------------------------------------- 1 | // Tabla de frecuencias MIDI (0-127) 2 | const float midiFrequencies[128] = { 3 | 8.18, 8.66, 9.18, 9.72, 10.3, 10.91, 11.56, 12.25, 12.98, 13.75, 14.57, 15.43, 4 | 16.35, 17.32, 18.35, 19.45, 20.6, 21.83, 23.12, 24.5, 25.96, 27.5, 29.14, 30.87, 5 | 32.7, 34.65, 36.71, 38.89, 41.2, 43.65, 46.25, 49.0, 51.91, 55.0, 58.27, 61.74, 6 | 65.41, 69.3, 73.42, 77.78, 82.41, 87.31, 92.5, 98.0, 103.83, 110.0, 116.54, 123.47, 7 | 130.81, 138.59, 146.83, 155.56, 164.81, 174.61, 185.0, 196.0, 207.65, 220.0, 233.08, 246.94, 8 | 261.63, 277.18, 293.66, 311.13, 329.63, 349.23, 369.99, 392.0, 415.3, 440.0, 466.16, 493.88, 9 | 523.25, 554.37, 587.33, 622.25, 659.25, 698.46, 739.99, 783.99, 830.61, 880.0, 932.33, 987.77, 10 | 1046.5, 1108.73, 1174.66, 1244.51, 1318.51, 1396.91, 1479.98, 1567.98, 1661.22, 1760.0, 1864.66, 1975.53, 11 | 2093.0, 2217.46, 2349.32, 2489.02, 2637.02, 2793.83, 2959.96, 3135.96, 3322.44, 3520.0, 3729.31, 3951.07 12 | }; 13 | 14 | void synthESP32_begin(){ 15 | 16 | // 16 filters + master L & R (18) 17 | for (int fi=0; fi < 18; fi++) { 18 | FILTROS[fi].setResonance(reso); 19 | FILTROS[fi].setCutoffFreq(cutoff); 20 | } 21 | 22 | // I2S 23 | i2s_config_t i2s_config = { 24 | .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX ), 25 | .sample_rate = SAMPLE_RATE, 26 | .bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT, 27 | .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, 28 | .communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB), 29 | //.communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_LSB), 30 | .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2, 31 | .dma_buf_count = DMA_NUM_BUF, 32 | .dma_buf_len = DMA_BUF_LEN, 33 | .use_apll = true, 34 | }; 35 | 36 | i2s_pin_config_t i2s_pin_config = { 37 | .bck_io_num = I2S_BCK_PIN, 38 | .ws_io_num = I2S_WS_PIN, 39 | .data_out_num = I2S_DATA_OUT_PIN 40 | }; 41 | 42 | i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL); 43 | 44 | i2s_set_pin(I2S_NUM_0, &i2s_pin_config); 45 | 46 | // Highest possible priority for realtime audio task 47 | xTaskCreatePinnedToCore( 48 | audio_task, //Function to implement the task 49 | "audio", //Name of the task 50 | 8000, //Stack size in words 51 | NULL, //Task input parameter 52 | configMAX_PRIORITIES - 1, //Priority of the task 53 | NULL, //Task handle. 54 | 0); //Core where the task should run 55 | 56 | // Iniciar NEWENDS 57 | int msize = sizeof(ENDS); 58 | memcpy(NEWENDS, ENDS, msize); 59 | 60 | } 61 | 62 | // Función de soft clipping en enteros 63 | inline int16_t soft_clip(int32_t sample) { 64 | if (sample > 32767) return 32767 - ((sample - 32767) >> 3); 65 | if (sample < -32768) return -32768 + ((-32768 - sample) >> 3); 66 | return sample; 67 | } 68 | 69 | //////////////////////////////////////////////////////////////////////////////////////////////////////// 70 | static void write_buffer() { 71 | 72 | size_t bytes_written; 73 | 74 | memset(out_buf, 0, sizeof(out_buf)); 75 | 76 | for (int i = 0; i < DMA_BUF_LEN; i++) { 77 | 78 | int32_t DRUMTOTAL_R = 0; 79 | int32_t DRUMTOTAL_L = 0; 80 | 81 | // sum all samples sounding 82 | for (byte f = 0; f < 16; f++) { 83 | if (latch[f]) { 84 | int16_t sample; 85 | uint64_t index = samplePos[f] >> 16; // convertir a entero 86 | if (ROTvalue[f][4]==1){ // reverse 87 | if (index <= NEWINIS[ROTvalue[f][0]] || index <= 0) { 88 | latch[f] = 0; 89 | samplePos[f] = NEWINIS[ROTvalue[f][0]]; 90 | stepSize[f] = 0; 91 | continue; 92 | } else { 93 | // Extraigo la muestra 94 | sample = SAMPLES[ROTvalue[f][0]][index]; 95 | samplePos[f] -= stepSize[f]; 96 | } 97 | } else { 98 | if (index >= NEWENDS[ROTvalue[f][0]] || index >= ENDS[ROTvalue[f][0]]) { 99 | latch[f] = 0; 100 | samplePos[f] = 0; 101 | stepSize[f] = 0; 102 | continue; 103 | } else { 104 | // Extraigo la muestra 105 | sample = SAMPLES[ROTvalue[f][0]][index]; 106 | samplePos[f] += stepSize[f]; 107 | } 108 | } 109 | 110 | int32_t sss = FILTROS[f].next(sample); 111 | int32_t sampleL = ((sss * VOL_L[f])) >> 8; 112 | int32_t sampleR = ((sss * VOL_R[f])) >> 8; 113 | 114 | DRUMTOTAL_L += sampleL; 115 | DRUMTOTAL_R += sampleR; 116 | } // endif latch 117 | } // endfor 118 | 119 | // Aplicar soft clipping 120 | DRUMTOTAL_L = soft_clip(DRUMTOTAL_L); 121 | DRUMTOTAL_R = soft_clip(DRUMTOTAL_R); 122 | // if (DRUMTOTAL_L > INT16_MAX) DRUMTOTAL_L = INT16_MAX; 123 | // if (DRUMTOTAL_L < INT16_MIN) DRUMTOTAL_L = INT16_MIN; 124 | // if (DRUMTOTAL_R > INT16_MAX) DRUMTOTAL_R = INT16_MAX; 125 | // if (DRUMTOTAL_R < INT16_MIN) DRUMTOTAL_R = INT16_MIN; 126 | 127 | // Filtro master 128 | int16_t DRUMTOTAL_L_OUT = FILTROS[16].next(DRUMTOTAL_L); 129 | int16_t DRUMTOTAL_R_OUT = FILTROS[17].next(DRUMTOTAL_R); 130 | 131 | // // Asegurar que no se sobrepase el rango permitido. 132 | // if (DRUMTOTAL_L_OUT > INT16_MAX) DRUMTOTAL_L_OUT = INT16_MAX; 133 | // if (DRUMTOTAL_L_OUT < INT16_MIN) DRUMTOTAL_L_OUT = INT16_MIN; 134 | // if (DRUMTOTAL_R_OUT > INT16_MAX) DRUMTOTAL_R_OUT = INT16_MAX; 135 | // if (DRUMTOTAL_R_OUT < INT16_MIN) DRUMTOTAL_R_OUT = INT16_MIN; 136 | 137 | // Ajuste de volumen master 138 | DRUMTOTAL_L_OUT = (DRUMTOTAL_L_OUT * mvol) >> 8; 139 | DRUMTOTAL_R_OUT = (DRUMTOTAL_R_OUT * mvol) >> 8; 140 | 141 | DRUMTOTAL_L_OUT = soft_clip(DRUMTOTAL_L_OUT); 142 | DRUMTOTAL_R_OUT = soft_clip(DRUMTOTAL_R_OUT); 143 | 144 | // // Asegurar que no se sobrepase el rango permitido. 145 | // if (DRUMTOTAL_L_OUT > INT16_MAX) DRUMTOTAL_L_OUT = INT16_MAX; 146 | // if (DRUMTOTAL_L_OUT < INT16_MIN) DRUMTOTAL_L_OUT = INT16_MIN; 147 | // if (DRUMTOTAL_R_OUT > INT16_MAX) DRUMTOTAL_R_OUT = INT16_MAX; 148 | // if (DRUMTOTAL_R_OUT < INT16_MIN) DRUMTOTAL_R_OUT = INT16_MIN; 149 | 150 | // Almacenar en el buffer de salida 151 | out_buf[i * 2] = (uint16_t)DRUMTOTAL_L_OUT; 152 | out_buf[i * 2 + 1] = (uint16_t)DRUMTOTAL_R_OUT; 153 | } // fin bucle del buffer de audio 154 | 155 | // Escribir buffer de audio 156 | i2s_write(I2S_NUM_0, out_buf, sizeof(out_buf), &bytes_written, portMAX_DELAY); 157 | 158 | } 159 | //////////////////////////////////////////////////////////////////////////////// 160 | 161 | static void audio_task(void *userData){ 162 | while(1) { 163 | write_buffer(); 164 | } 165 | } 166 | 167 | //********************************************************************* 168 | // Setup initial 169 | //********************************************************************* 170 | 171 | void synthESP32_setIni(unsigned char voice, int ini) { 172 | NEWINIS[ROTvalue[voice][0]]=(ini * ENDS[ROTvalue[voice][0]]) >>11; // map de 0-2048 a los valores del sample 173 | } 174 | 175 | //********************************************************************* 176 | // Setup end 177 | //******************************************************************* 178 | 179 | void synthESP32_setEnd(unsigned char voice, int end) { 180 | NEWENDS[ROTvalue[voice][0]]=(end * ENDS[ROTvalue[voice][0]]) >>11; // map de 0-2048 a los valores del sample 181 | } 182 | 183 | //********************************************************************* 184 | // Setup master vol [0-127] 185 | //********************************************************************* 186 | 187 | void synthESP32_setMVol(unsigned char vol) { 188 | mvol=vol; 189 | } 190 | 191 | //********************************************************************* 192 | // Setup master filter [0-255] parameter 0-127 193 | //********************************************************************* 194 | 195 | void synthESP32_setMFilter(unsigned char freq) { 196 | // ya que 0 es no filter hago un map y cambio el rango 197 | freq=map(freq,0,127,255,0); 198 | FILTROS[16].setCutoffFreq(freq); 199 | FILTROS[17].setCutoffFreq(freq); 200 | } 201 | 202 | //********************************************************************* 203 | // Setup voice filter [0-255] parameter 0-127 204 | //********************************************************************* 205 | 206 | void synthESP32_setFilter(unsigned char voice, unsigned char freq) { 207 | // ya que 0 es no filter hago un map y cambio el rango 208 | freq=map(freq,0,127,255,0); 209 | FILTROS[voice].setCutoffFreq(freq); 210 | } 211 | 212 | //********************************************************************* 213 | // Setup vol [0-127] 214 | //********************************************************************* 215 | 216 | void synthESP32_setVol(unsigned char voice,unsigned char vol) { 217 | synthESP32_updateVolPan(voice); 218 | // VOL_L[voice]=vol; 219 | // VOL_R[voice]=vol; 220 | // if (PAN[voice]>0){ 221 | // VOL_L[voice]=VOL_R[voice]-((VOL_R[voice]*PAN[voice])>>7); 222 | // } 223 | // if (PAN[voice]<0){ 224 | // VOL_R[voice]=VOL_L[voice]+((VOL_L[voice]*PAN[voice])>>7); 225 | // } 226 | } 227 | 228 | //********************************************************************* 229 | // Setup pan [-127 - 127%] 230 | //********************************************************************* 231 | 232 | void synthESP32_setPan(unsigned char voice,signed char pan) { 233 | synthESP32_updateVolPan(voice); 234 | // PAN[voice]=pan; 235 | // if (PAN[voice]>0){ 236 | // VOL_L[voice]=VOL_R[voice]-((VOL_R[voice]*PAN[voice])>>7); 237 | // } 238 | // if (PAN[voice]<0){ 239 | // VOL_R[voice]=VOL_L[voice]+((VOL_L[voice]*PAN[voice])>>7); 240 | // } 241 | } 242 | //********************************************************************* 243 | // Update vol and pan 244 | //********************************************************************* 245 | 246 | void synthESP32_updateVolPan(unsigned char voice) { 247 | int vol = ROTvalue[voice][5]; 248 | int pan = ROTvalue[voice][6]; 249 | 250 | // PAN va de -127 (izquierda) a +127 (derecha) 251 | int panL = 128 - pan; // más PAN a la derecha, menos volumen a la izquierda 252 | int panR = 128 + pan; // más PAN a la izquierda, menos volumen a la derecha 253 | 254 | // Normalizamos el volumen de cada canal 255 | VOL_L[voice] = (vol * constrain(panL, 0, 128)) >> 7; 256 | VOL_R[voice] = (vol * constrain(panR, 0, 128)) >> 7; 257 | } 258 | 259 | //////////////////////////////////////////////////////////////////////////////////////////////////////// 260 | 261 | void synthESP32_TRIGGER(int nkey){ 262 | 263 | if (nkey < 0) return; 264 | 265 | if (ROTvalue[nkey][4]==1) { 266 | samplePos[nkey] = ((uint64_t)NEWENDS[ROTvalue[nkey][0]]) << 16; // reinicia desde newinis 267 | } else { 268 | samplePos[nkey] = ((uint64_t)NEWINIS[ROTvalue[nkey][0]]) << 16; // reinicia desde newinis 269 | } 270 | 271 | float targetFreq = midiFrequencies[ROTvalue[nkey][3]]; 272 | stepSize[nkey] = (uint64_t)((targetFreq / 261.63) * (1 << 16)); // * 65536 273 | latch[nkey] = 1; 274 | } 275 | 276 | void synthESP32_TRIGGER_P(int nkey, int ppitch){ 277 | 278 | if (nkey < 0) return; 279 | 280 | if (ROTvalue[nkey][4]==1) { 281 | samplePos[nkey] = ((uint64_t)NEWENDS[ROTvalue[nkey][0]]) << 16; // reinicia desde newinis 282 | } else { 283 | samplePos[nkey] = ((uint64_t)NEWINIS[ROTvalue[nkey][0]]) << 16; // reinicia desde newinis 284 | } 285 | 286 | float targetFreq = midiFrequencies[ppitch]; 287 | stepSize[nkey] = (uint64_t)((targetFreq / 261.63) * (1 << 16)); // * 65536 288 | latch[nkey] = 1; 289 | } 290 | 291 | //////////////////////////////////////////////////////////////////////////////////////////// 292 | 293 | void setSound(byte f){ 294 | synthESP32_setIni(f,ROTvalue[f][1]); 295 | synthESP32_setEnd(f,ROTvalue[f][2]); 296 | synthESP32_updateVolPan(f); 297 | // synthESP32_setVol(f,ROTvalue[f][5]); 298 | // synthESP32_setPan(f,ROTvalue[f][6]); 299 | synthESP32_setFilter(f,ROTvalue[f][7]); 300 | } 301 | 302 | void setRandomVoice2(byte f){ 303 | ROTvalue[f][0]=random(min_values[0], max_values[0]); 304 | ROTvalue[f][3]=random(min_values[3], max_values[3]); 305 | ROTvalue[f][6]=random(min_values[6], max_values[6]); 306 | } 307 | 308 | void setRandomVoice(byte f){ 309 | ROTvalue[f][0]=random(min_values[0], max_values[0]); 310 | ROTvalue[f][6]=random(min_values[6], max_values[6]); 311 | } 312 | 313 | void setRandomPattern(byte f){ 314 | byte veces=random(0,2); 315 | for (byte b = 0; b < 16; b++) { 316 | byte mybit=random(0,2); 317 | if (veces) { 318 | if (mybit) mybit=random(0,2); // Si es 1 hago otro random para que haya menos unos 319 | } 320 | bitWrite(pattern[f],b,mybit); 321 | } 322 | setRandomPitch(f); 323 | } 324 | 325 | bool find_scale(uint8_t note){ 326 | 327 | uint8_t candidate=note % 12; 328 | // buscar en array de escalas 329 | bool in_scale=false; 330 | for (byte s = 0; s < 8; s++) { 331 | if (note==escalas[selected_scale][s]){ 332 | in_scale=true; 333 | break; 334 | } 335 | } 336 | if (in_scale){ 337 | return true; 338 | } 339 | return false; 340 | } 341 | 342 | void setRandomPitch(byte f){ 343 | // Tomo como referencia para el rango el valor del pot pitch actual 344 | uint8_t actual=ROTvalue[selected_sound][3]; 345 | uint8_t limite; 346 | uint8_t prelimite=24; 347 | for (byte b = 0; b < 16; b++) { 348 | limite=actual+random(0,prelimite); 349 | uint8_t candidate1=random(actual-(prelimite>>1),limite); 350 | if (selected_scale==0) { 351 | melodic[f][b]=candidate1; 352 | } else { // scale 353 | if (find_scale(candidate1)){ 354 | melodic[f][b]=candidate1; 355 | } else { 356 | limite=actual+random(0,prelimite); 357 | uint8_t candidate2=random(actual-(prelimite>>1),limite); 358 | if (find_scale(candidate1)){ 359 | melodic[f][b]=candidate2; 360 | } else { 361 | limite=actual+random(0,prelimite); 362 | uint8_t candidate3=random(actual-(prelimite>>1),limite); 363 | if (find_scale(candidate1)){ 364 | melodic[f][b]=candidate3; 365 | } 366 | } 367 | } 368 | } 369 | 370 | } 371 | } 372 | 373 | 374 | 375 | void setRandomNotes(byte f){ 376 | setRandomPitch(f); 377 | } -------------------------------------------------------------------------------- /SOUNDS/zSAMPLE06.h: -------------------------------------------------------------------------------- 1 | const int16_t SAMPLE06[4708] = {-1953,-1178,-115,30,-226,-293,-321,-585,-626,-349,-288,-324,-197,-111,-555,-1045,-668,-246,136,1076,445,-3042,-4658,1137,6443,793,-4836,-2983,-2811,516,7514,2567,-7488,-6714,326,4851,5869,1831,-9325,-13076,4315,16011,2897,-8720,-8985,-3900,6244,6159,-533,532,133,-10494,-13928,10377,27535,132,-30182,-14614,16913,17994,2271,-7009,-17483,-13127,16396,21779,-6960,-15135,-3366,-1822,4460,11181,1370,-10489,-9513,-1188,10312,12456,-3154,-18549,-14124,14492,25888,-2113,-27127,-15157,17938,23370,-6699,-19842,-5605,10043,13359,-4510,-17563,-2643,15495,6280,-8255,-8234, 2 | -4249,8000,9115,-6064,-10200,-469,7628,5679,-3120,-10170,-6528,8315,13587,-2878,-15751,-6805,8375,11285,4954,-7854,-20215,-4708,23232,14851,-13809,-16490,-3666,6418,11384,7190,-4234,-19473,-13268,17469,23549,-4712,-19238,-11738,3796,16664,6462,-8131,-10647,-5403,7441,9530,-2100,-8641,-3692,5949,5612,-6118,-6702,2307,4407,4131,-872,-9412,-6808,6217,11316,-720,-9885,-4000,2641,2244,1438,1647,-1330,-3424,-4737,-1744,8764,7481,-8488,-12262,748,11931,9418,-7184,-19383,-2695,18541,8694,-7026,-7957,-7795,2236,9438,906,-1961,2110,-4309,-12530,181,17062,8914,-10227,-16251,-4746, 3 | 12332,11715,1650,-5214,-16635,-11488,16923,24160,-4095,-21797,-14371,5754,22947,7925,-11465,-15146,-10276,12030,19772,-1089,-13477,-9704,-3430,10412,18325,-1005,-25056,-14164,19098,20585,-4119,-12968,-12242,-1573,16305,8840,-8228,-7242,-930,1402,441,342,3201,4699,-2521,-13429,-5977,14973,11973,-6014,-7804,-7290,-3882,10887,13399,-4654,-15812,-3766,9995,7476,-3115,-7224,-888,6529,3157,-9565,-7571,11353,12034,-8803,-13794,748,11959,8309,-8259,-14128,2987,11913,-1505,-2845,4603,-1986,-10590,-3564,12201,9611,-4041,-8075,-8445,170,10798,7404,-1277,-7672,-10382,-467,12374,8668,-3345,-8732, 4 | -7618,799,9322,5536,-679,-2677,-8547,-5996,9434,10204,-2643,-4970,-4333,-4532,5632,10633,-2985,-12224,287,12521,4518,-13213,-11510,10450,14134,-143,-7930,-11846,-1397,14889,6397,-7371,-4837,875,494,-3017,568,8762,6262,-8479,-16399,-57,18818,9769,-5433,-11689,-13552,5372,20806,4213,-9364,-7738,-9765,2772,19047,7002,-10454,-12201,-7115,8530,18505,2567,-14736,-13298,2571,15746,9288,-6346,-14755,-5845,12591,12002,-3201,-9009,-7036,3222,13743,1632,-13747,-3530,7697,3935,2654,-1080,-9445,-4453,11489,8487,-9509,-6031,5341,4296,382,-4465,-5565,3876,11987,1543,-15053,-10181, 5 | 12656,16863,-2175,-13574,-10979,4858,16198,5054,-7541,-9757,-3981,6971,7807,995,-62,-2850,-9051,-2597,11292,8105,-2997,-3778,-6634,-4644,8344,10439,-732,-7918,-4831,1722,3900,1657,2700,3268,-4060,-11018,-1089,15587,6074,-9291,-3835,108,-348,3134,3391,1239,645,-3366,-9225,973,14762,5412,-8094,-7607,-5506,4245,15888,5995,-12399,-17277,1469,21576,9481,-10508,-13171,-5376,10190,13367,-308,-7581,-8082,-219,9013,3776,-3719,531,2708,-4565,-7242,4065,14709,2408,-14495,-9903,7803,14952,3269,-9644,-13791,35,19136,8692,-12014,-12482,443,11658,7438,-2618,-6711,-6916, 6 | 2492,10284,4158,-4598,-6277,-2353,3220,6249,5141,-1550,-11052,-5793,10212,11583,-281,-9512,-9540,3050,12639,5282,-4061,-8446,-7189,5886,13482,2386,-9022,-8386,638,10938,5265,-7009,-4960,2314,4592,1757,-2640,-3784,1175,7138,557,-7584,-573,4771,1313,1894,2201,-4481,-8299,2182,12930,4372,-6869,-9019,-4155,9503,13235,-1496,-13744,-7141,8804,9982,-848,-3043,-2058,-3619,-731,5059,5546,1047,-1617,-7412,-7717,8246,14745,702,-10069,-10067,-287,12936,7401,-4337,-4190,-4882,-3693,6080,11532,2095,-9713,-10857,1729,14341,5172,-6744,-4534,-2049,-9,4877,7005,-888, 7 | -7872,-3984,2417,8078,6805,-3942,-13628,-4761,14814,10633,-4797,-7710,-6324,1652,9215,3415,-1726,-1308,-4329,-5430,4447,10516,2218,-5842,-7829,-2890,7888,8934,665,-6276,-9633,-562,12907,7853,-7445,-8790,-1098,6141,7252,-310,-5483,-5176,1436,7480,2602,-4181,-2972,1068,1439,369,1882,2338,-3009,-5724,2333,7994,-288,-6366,557,5177,-286,-4894,-179,4184,2253,607,-1409,-4576,-3750,5852,11209,-1420,-13240,-5345,9596,9146,-1364,-4147,-5181,-3755,6782,9273,-3303,-8257,918,3894,678,-76,-626,413,2303,-996,-5766,1140,9026,305,-8359,-1979,6875,5823, 8 | -4894,-8813,2127,8385,2226,-1478,-3932,-6254,1829,9239,4021,-5016,-7036,-2096,4923,7441,1970,-5929,-7764,1257,7456,2688,-1207,-1372,-2329,-3405,-370,7583,7397,-5254,-11581,-1991,10122,7166,-1035,-4365,-8346,-3161,10041,10099,-2046,-9710,-8109,3236,11826,3538,-3719,-5109,-7685,1775,11394,3751,-4670,-4382,-4732,627,7791,3180,-2668,-784,-3101,-6087,3622,10172,1649,-6260,-6069,-925,5353,4068,-412,-248,-720,-5558,-5074,8189,11164,-2828,-10435,-6521,4584,10748,1745,-4668,-4778,-4694,3579,8942,598,-6754,-3269,2290,4486,1001,-5373,-2358,5981,3287,-5181,-3675, 9 | 1956,5179,2712,-5727,-6238,2928,6625,2020,-1986,-5441,-4819,4474,9447,-278,-9135,-3448,4523,4813,595,-2585,-2715,-1510,1211,4646,2279,-4610,-5112,588,5575,5576,-1423,-10531,-6505,10531,11351,-3454,-8815,-5973,1808,8521,3944,-1572,-4691,-7372,-357,10020,5175,-4441,-3798,-4143,-2372,6509,7996,-719,-8442,-7649,3452,10604,1233,-5664,-1893,-967,-1439,1669,4894,1502,-3047,-4604,-3105,4555,6521,-1413,-5108,-1322,1370,809,440,930,726,-1040,-3460,-1389,4664,2760,-4073,-2521,2622,2989,-1649,-5294,-312,5288,2918,-940,-4437,-4425,2606,4685,441,-256, 10 | -858,-4468,-2970,4593,5251,-1063,-2403,-3009,-2822,3145,4087,-851,-1517,461,-1284,-3736,-122,6557,3446,-5097,-6211,-316,5965,3641,-2405,-3816,-2169,1504,2943,988,-847,-2094,-2138,-250,3004,3606,-1671,-5404,-709,3181,65,314,2967,-623,-5983,-4192,5166,7032,-341,-3638,-5442,-4394,5727,9021,-373,-6291,-6983,-1608,9321,6038,-4448,-4493,-3410,-1467,5703,7586,-2391,-10365,-3378,7003,5574,-1047,-2450,-3396,-3664,1657,6651,3170,-4089,-6743,-3739,5505,9021,-339,-8162,-6130,2821,7329,1403,-3156,-2556,-1594,-415,1239,4067,1558,-4340,-5219,-836,6833, 11 | 5578,-4330,-8008,-1073,6373,2696,-2649,-488,-45,-2191,-2587,2244,5473,-608,-4931,-2563,1720,2671,72,-374,-44,-1461,-2580,283,4250,822,-3657,-1901,1026,2575,937,-3438,-3221,3356,4325,-3354,-4103,1488,2569,980,-1457,-3339,-568,3510,2560,-2072,-4793,-1090,4885,3217,-2372,-4370,-2160,2558,4537,1845,-3743,-6928,-347,7053,3183,-2069,-2568,-4684,-1848,6281,5894,-2821,-6478,-3606,2671,7462,1036,-6207,-3943,958,4062,3410,-1543,-5752,-2052,4256,1931,-1283,1001,-87,-3743,-2940,3085,4799,-470,-1885,-2176,-3856,358,6423,3820,-4021,-6903,-2364, 12 | 6149,5577,-2607,-3580,-1844,-1091,2310,4644,-66,-6277,-3249,4047,6135,147,-7708,-5172,5331,6547,-525,-2625,-4529,-3278,4371,4977,52,-1887,-3759,-4098,2416,6589,1072,-3108,-2989,-3966,94,7764,5058,-6060,-8751,67,7282,4796,-2045,-5509,-4070,2759,5385,-73,-2611,-1050,-78,-510,-256,1137,1506,637,-1720,-4169,-266,4902,1698,-2370,-1189,-225,-1320,-788,2414,2861,-26,-2714,-5927,-819,9347,5180,-6874,-7990,-203,6630,5129,-1565,-4670,-4586,481,5411,3522,-987,-4814,-4224,1902,5013,1597,-874,-3183,-3916,1533,4296,652,-1738,-221,-258, 13 | -2787,-1132,4032,2791,-947,-1683,-4661,-2296,6729,5290,-3220,-4765,-3203,1085,6557,2847,-4734,-5842,-104,6702,4124,-5123,-6067,1098,5342,2942,-2304,-5115,-1299,3874,2099,-718,-90,-700,-2404,-2007,2801,5136,-189,-5049,-4180,1792,5819,2068,-2743,-4713,-2433,4233,5519,-513,-5614,-3643,3165,4297,345,-1438,-2040,-2322,398,3653,1996,-1128,-2199,-3145,-81,4266,2731,-378,-3522,-4901,1304,6418,1527,-2445,-2347,-2912,493,5129,1839,-3963,-2295,1883,1880,-1240,-2311,1961,2834,-1705,-2981,-143,2768,2409,-1682,-3743,-112,3117,1634,-767,-1937,-1680, 14 | 1453,2259,-92,-1257,-1155,334,1176,142,-525,-52,482,-196,-1219,130,2449,1215,-3255,-3117,2585,3762,-274,-2063,-1467,-358,804,1395,1942,-37,-3513,-2311,2228,2823,763,334,-1689,-4412,-1064,5892,4647,-2275,-4958,-3802,2347,6160,1173,-1959,-2890,-3848,1258,6117,1764,-3113,-2143,-1716,-184,3812,3345,-1198,-3924,-3429,1186,6655,3162,-5410,-5968,1413,5235,1652,-564,-1212,-3605,-1532,4180,3465,-1793,-1400,337,-2094,-1783,3529,4577,-1092,-4385,-3214,2154,5066,164,-1858,-1136,-1678,279,3054,860,-2569,51,2030,-696,-2102,562,2325, 15 | -390,-898,1059,497,-1841,-1541,2195,1806,-172,354,-1645,-2981,977,4477,1668,-2373,-3739,-1542,4222,4715,-2140,-5283,-398,3726,2362,-171,-2496,-2805,1421,4280,355,-3452,-1644,1549,2871,1010,-2639,-3132,1243,3988,1072,-2258,-2351,-330,1899,2299,1010,-1744,-3626,-727,4038,3606,-865,-3789,-3621,1757,6280,2061,-4594,-5294,548,6373,3399,-3470,-4659,-561,3232,2617,764,-1052,-3434,-1726,2822,3431,558,-1365,-3132,-1614,2857,2630,177,-438,-1203,-2640,-570,4048,2924,-1318,-2287,-2876,-343,4694,3350,-1614,-3942,-2902,1957,5461,1409,-3489, 16 | -3138,-40,2487,2077,804,-554,-2829,-2860,2141,5158,943,-3028,-3550,-614,3635,2457,-363,-759,-1923,-2163,1131,4235,1572,-2453,-3037,-790,2773,2237,-376,-620,-910,-1299,163,2500,1173,-2011,-1040,1047,1353,15,-2019,-471,2674,1186,-2022,-1509,1245,2554,-763,-3642,981,4760,-261,-4421,-737,2480,1943,865,-1391,-2861,-479,2683,1633,-40,-147,-1750,-1991,1285,2947,825,-984,-1647,-1377,961,1743,727,442,-327,-2177,-2055,2024,4342,438,-3526,-2601,918,2712,1285,272,-949,-2851,-1120,2948,3253,-210,-2128,-2707,-1017,3677,4100, 17 | -1218,-4550,-1982,2697,3475,-65,-1197,-988,-2003,-159,3780,2824,-2600,-3874,-224,3102,2442,-179,-2104,-2742,622,3488,1837,-1691,-3144,-531,2510,2179,72,-1909,-2477,589,3504,1499,-2343,-2589,469,2056,1273,68,-1405,-1685,574,1557,737,373,-692,-1755,-326,1536,1296,495,-680,-1963,-571,1867,1259,-294,-329,-229,-668,-610,847,1536,396,-415,-1469,-1649,1197,2924,766,-1789,-2250,-183,2394,1222,-860,-610,34,-275,-657,851,1766,-227,-1720,-697,939,1338,303,-859,-1099,-193,1298,1562,-376,-2085,-775,1564,1289,87, 18 | -475,-1175,-637,1192,1265,-318,-830,-312,458,921,-459,-1286,578,1829,-98,-1839,-663,1186,1778,308,-2039,-1923,1185,2723,679,-1749,-2269,108,2463,1319,-705,-1610,-1403,789,2605,1052,-2064,-2430,530,2371,1132,-398,-1566,-1660,791,1995,778,-426,-1286,-1380,415,1959,1104,-652,-1712,-922,1099,1281,260,-71,-635,-1144,-363,1372,1644,-246,-1386,-1426,76,2084,1229,-783,-1589,-956,1004,1595,287,-920,-1037,4,860,526,-31,-385,-319,28,69,180,411,314,-395,-970,-110,1099,667,-223,-793,-766,507,1034, 19 | 169,-510,-693,-64,768,601,-480,-927,171,881,164,-391,-314,-42,330,287,-66,-321,-253,168,447,321,-173,-809,-474,925,953,-346,-894,-470,650,849,-374,-739,72,828,326,-1006,-748,708,933,212,-543,-997,-162,846,660,143,-429,-1001,-377,1029,860,-203,-459,-644,-259,788,525,-358,-240,158,64,-445,-476,755,1152,-527,-1497,-261,1134,1041,-152,-1244,-873,666,1120,382,-419,-1061,-655,786,1179,201,-696,-1068,-320,995,808,-3,-470,-943,-403,925,1020,-101,-857,-819,171,1010, 20 | 315,-452,-357,-59,-31,-38,398,397,-396,-622,-34,408,432,105,-511,-589,154,554,284,-96,-504,-429,298,523,80,-302,-307,3,207,-7,-106,131,208,-133,-570,-221,680,610,-404,-765,-194,490,493,71,-363,-644,-94,637,442,-220,-485,-220,209,205,-4,33,1,-211,-296,120,363,-47,-164,20,-69,-206,15,297,88,-231,-189,8,143,-2,-90,-6,56,56,-204,-241,180,249,-108,-148,-20,-11,-19,-98,5,210,132,-243,-434,-3,447,217,-215,-330,-142,182, 21 | 120,-62,56,46,-197,-319,57,401,128,-287,-298,-33,214,159,-67,-203,-78,123,-14,-139,58,102,-121,-154,62,163,-31,-263,-85,161,118,-7,-150,-217,-7,235,161,-147,-346,-92,290,201,-126,-269,-128,126,170,59,-153,-248,-14,190,74,-98,-106,-35,10,-29,-37,53,84,-93,-206,-32,88,99,83,-109,-281,-100,216,171,-59,-68,-160,-220,68,289,103,-146,-277,-183,176,227,3,-89,-151,-202,2,271,118,-142,-211,-144,92,157,23,-55,-114,-142, 22 | 7,126,52,-71,-89,-51,-18,7,41,16,-63,-67,-50,-5,63,25,-80,-98,-27,58,80,-42,-199,-81,175,96,-121,-133,-29,81,54,-77,-99,-4,46,17,-42,-74,-31,42,11,-38,-56,-30,15,23,-2,-71,-80,23,71,-18,-93,-41,29,27,-40,-54,-18,11,15,-33,-48,-14,-8,-21,6,21,-21,-83,-69,51,76,-14,-72,-95,-29,87,65,-59,-109,-52,47,56,-11,-60,-68,-10,48,5,-39,-39,-14,4,-5,-14,-21,-16,-13,-8, 23 | -8,-17,-17,-14,-7,-9,-13,-18,-15,-7,-5,-9,-20,-25,-4,8,-6,-29,-30,6,8,-12,-22,-19,-10,1,1,-11,-27,-21,3,9,-6,-23,-24,-9,9,-5,-12,-18,-11,-6,-6,-2,-13,-14,-6,-7,-5,-9,-12,-5,-8,-8,-8,-7,-7,-5,-10,-10,-4,-2,-10,-7,-9,-3,-7,-7,-3,-7,-7,-6,-7,-2,-6,-4,-10,-7,-4,0,-6,-5,-7,-4,-5,-4,-4,-6,-4,-5,-7,-1,-7,-5,-3,-6,-4,-3,-6,0, 24 | -6,-3,-5,-2,-4,-2,-4,-3,-2,-6,2,-5,0,-5,-1,-2,-2,-3,-3,-2,-2,-3,-2,-2,-2,0,-3,-1,-1,2,-1,-2,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,-2,2,-2,1,3,-3,2,2,-2,1,-1,-1,4,-3,1,3,-2,3,2,1,2,-3,3,2,3,-1,4,-2,4,-3,6,0,2,1,-1,3,1,3,1,1,2,3,1,3,0,4,3,3,0,5,1,3,3,3,1, 25 | 5,-2,5,2,2,2,2,3,3,4,2,4,3,1,3,1,5,3,2,4,1,3,4,3,3,4,1,6,0,5,3,4,5,2,4,3,3,5,4,3,4,2,5,4,3,5,2,4,3,2,5,3,4,5,2,6,2,4,4,2,5,2,4,4,3,5,3,4,6,0,6,3,3,5,4,3,6,2,5,4,2,5,1,6,4,3,4,4,2,6,2,5,4,3,5,2,5,4,3,3, 26 | 3,3,6,2,5,2,5,2,6,1,6,2,5,4,5,2,4,4,3,2,4,2,5,2,2,6,1,4,2,3,3,3,3,3,3,5,1,6,1,5,3,2,5,3,0,5,-2,6,1,1,5,1,5,0,2,3,1,5,2,2,3,0,4,2,5,1,1,-1,2,6,4,-6,-2,1,3,1,-1,2,-3,3,1,3,2,-3,2,-3,2,2,0,1,0,-2,1,-1,2,-2,3,-2,1,2, 27 | -3,2,-2,1,-2,1,0,0,2,-1,-1,2,-1,1,-1,1,-1,0,1,1,0,1,-1,0,-1,-1,2,-3,0,2,-4,4,-3,0,1,-1,-1,3,-3,2,1,-4,3,-2,1,1,-2,2,-3,0,-1,1,-1,0,0,-3,3,-2,1,0,-2,2,-3,3,-2,3,-2,3,-3,1,-1,1,-2,3,-2,2,0,-2,2,-2,-1,1,0,1,-1,1,-2,2,-2,2,-1,2,-2,2,-2,-2,3,-3,2,-2, 28 | -1,2,-3,3,-4,3,-3,3,-2,1,0,-1,1,-2,0,2,-1,1,0,1,-1,0,1,-1,1,1,-2,3,-2,2,-1,0,1,-1,1,-2,0,0,1,-2,3,-4,3,-2,1,0,0,-2,0,-1,-1,-1,-1,2,-2,1,-2,1,0,-1,2,-3,3,-3,2,-1,0,0,1,-3,2,-3,2,-1,1,1,-1,2,-1,-1,-1,2,-3,4,-4,4,-1,1,0,-1,1,0,1,0,-1,1,-1,-1,2,-3, 29 | 2,-1,-1,2,-2,1,-2,2,-1,0,-1,2,-2,3,-2,1,0,-2,2,1,-1,3,-3,3,-1,1,-1,2,-1,4,-3,2,0,-1,1,-1,1,0,-1,1,-2,1,-2,1,0,-2,1,0,1,-1,2,-1,2,-2,2,0,1,-1,0,1,-1,1,0,-1,0,-1,-1,0,0,-1,2,0,0,1,-3,2,-1,-1,2,-3,1,1,0,1,-1,2,-2,-1,1,1,0,1,-1,1,2,-2,2,1,-1,2, 30 | -3,2,-1,1,0,-1,1,-1,1,1,-2,2,-1,-1,1,-1,-1,0,0,0,-1,1,1,-2,2,-2,2,0,-2,1,0,0,1,-1,1,-1,2,-3,4,-2,2,1,-2,1,1,-3,4,-2,1,1,-3,2,-1,-1,3,-2,2,-1,-2,3,-2,1,-1,1,0,0,0,-1,1,-1,0,1,-2,2,-1,1,0,1,-1,1,-2,2,-1,0,1,-1,2,-1,-1,2,-3,1,1,-1,0,0,0,-1,2,-3, 31 | 3,-1,-1,3,-3,2,0,-1,1,1,-2,2,-1,0,-1,1,1,-2,4,-4,3,-1,-1,1,-1,2,-4,4,-4,2,-1,1,-1,2,-2,2,-3,1,1,-2,5,-3,2,0,0,-1,2,-2,-1,2,-3,2,-1,2,1,0,1,-2,3,-2,1,-3,4,-3,2,-1,1,-1,-1,-2,2,-3,2,0,-1,2,-1,-1,1,-1,0,2,-2,-1,1,1,1,0,-1,1,-1,-1,2,-3,1,1,-2,-1,1,-1, 32 | 0,1,-1,1,1,1,1,-1,-1,2,-2,3,-5,4,-2,1,-1,-1,0,-1,-1,0,1,-2,2,-2,2,-1,1,0,-1,1,1,-1,1,-1,1,-1,4,-2,1,-1,-1,0,-2,1,-2,2,-2,2,0,0,2,-2,-1,1,-2,2,-3,2,-1,0,2,-2,1,-1,-1,2,-1,1,1,-1,1,-1,1,1,-2,1,-1,-1,0,2,-3,3,-1,0,1,-2,2,1,-1,2,-2,1,-2,0,-1,-1,0,0, 33 | 1,1,-1,1,-1,1,-1,0,-1,2,-3,4,-4,2,0,1,-1,0,0,0,0,-1,1,0,-1,-2,1,-1,1,-1,1,-1,-1,2,-3,2,-1,-1,2,-2,1,-1,1,-2,1,-3,1,-1,-2,2,-2,0,1,-1,-1,2,-3,2,0,-2,5,-4,2,-1,0,-1,2,-2,3,-2,1,0,2,-1,1,-2,2,-1,1,-1,1,-2,2,-2,2,0,-1,2,-3,4,-3,2,1,0,-1,2,-2,1,1,-2, 34 | 4,-4,1,1,-1,2,-1,-1,2,-3,1,-1,1,1,1,-1,1,-3,1,-1,-1,1,-1,1,-1,-1,0,1,-1,1,-1,-1,2,-2,1,-1,-2,2,-1,1,1,-3,2,-3,2,-1,-1,0,-1,1,-1,0,1,-2,2,-2,1,1,-1,1,1,-4,4,-2,1,2,-2,3,-2,1,1,-1,1,1,-1,1,-3,3,-1,1,0,-2,-1,1,-1,1,0,-1,2,-2,1,1,-1,-1,-1,-2,2,-2,2,-1, 35 | 1,0,-1,0,-1,1,1,-2,2,-2,1,1,-2,3,-3,1,2,-3,5,-4,2,1,-1,1,1,-2,2,-1,-1,3,-1,1,-1,1,-2,3,-1,0,1,-2,3,-2,2,1,-2,3,-1,0,0,0,-1,2,-1,0,2,-3,2,-3,3,-3,3,-3,2,0,-2,3,-1,1,-1,1,0,-1,0,0,-1,3,-2,1,1,-1,1,0,-2,3,-3,3,-2,2,-1,2,-2,3,-2,0,2,-2,1,1,-2,3, 36 | -1,1,2,-1,-1,2,-2,2,-1,-2,3,-3,2,0,-1,2,0,1,1,0,-1,0,0,-1,1,-1,-2,1,-2,1,-1,-1,-1,0,2,-2,1,-1,-2,3,-3,2,0,0,0,1,-1,1,1,1,1,-1,0,1,-2,2,-1,1,2,-2,1,-1,0,-1,1,-1,1,-2,1,-1,2,0,0,2,-3,3,-3,3,1,-1,1,-1,0,2,1,0,-1,-1,2,-1,1,0,0,0,2,1,1,-1,1,-1, 37 | -1,1,-1,1,-1,1,-2,3,-3,3,-2,-1,2,-2,-1,2,-2,2,-1,-4,4,-3,2,1,0,2,-1,1,-1,1,-4,4,-4,3,-3,2,-2,2,-2,2,-2,1,0,0,1,-1,-1,1,-2,1,-1,0,3,-2,2,-2,1,-1,1,-2,1,-1,-1,1,-1,0,-2,-1,-1,0,1,-2,3,-1,-1,2,-3,1,1,-3,2,-1,1,-1,1,0,1,0,-1,-1,1,0,-1,2,-2,-1,2,-4,3,-2, 38 | 2,1,-2,2,0,0,0,3,-2,3,-2,-1,3,-4,4,-3,2,0,-1,1,1,-2,2,-1,2,-2,2,-2,2,-2,1,1,-2,2,-2,3,-2,2,-2,0,0,-2,1,-1,1,1,-2,1,-2,1,-1,1,-1,2,0,1,-2,1,-2,1,-1,0,-1,-1,1,1,1,1,-1,1,-1,0,1,1,0,0,0,-1,1,-3,2,-2,0,2,-3,3,-2,1,0,1,-1,1,-1,1,0,-1,3,-3,1,1, 39 | -3,1,0,-2,2,-1,0,1,-2,2,-1,0,1,1,-1,2,-3,0,2,-5,3,-2,-1,2,-2,2,0,0,0,0,-1,1,-2,2,-2,1,-1,0,-1,2,-2,1,1,-1,-1,-1,1,1,-1,0,0,-1,2,-1,0,-2,-1,-2,3,-1,-1,1,1,0,1,-1,0,1,-2,2,-3,1,1,-1,2,-1,2,-1,-1,1,1,0,1,-1,2,-2,1,1,-1,2,-1,2,-2,1,-1,1,-1,1,1,-1, 40 | 1,0,0,0,1,-1,0,2,-2,2,-1,1,-1,-1,0,-1,0,1,-2,1,-2,1,-1,1,0,-1,2,-1,1,0,-1,0,-1,1,-1,-1,2,-3,2,-1,-1,0,2,-3,3,-4,4,-2,1,2,-3,2,-1,-1,1,-1,0,0,1,-1,1,-2,1,-1,1,1,-1,2,-2,2,-1,1,0,0,-2,2,-3,2,-2,1,-1,0,-1,2,-1,1,0,-1,1,-1,-1,3,-3,3,-2,2,-1,1,-3,0, 41 | -1,0,-1,-1,2,-3,3,-2,1,1,-3,2,-1,0,1,-2,0,1,-2,1,-2,2,-2,2,-1,-1,2,-2,1,-2,1,-3,2,-1,1,-1,0,0,0,-2,1,-1,1,-1,1,0,-1,1,-1,2,-1,1,-1,0,0,-2,1,-1,0,1,-1,1,-1,1,-1,1,-2,1,-1,0,-1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,1,-2,1,-1,3,-1,1,-1,-1,1,-2,-1,2,-3,2,-4,1,1, 42 | -1,1,1,-2,1,-2,2,-1,-1,2,-3,1,-1,-2,3,-3,1,1,-2,2,-1,0,0,0,1,-1,0,2,-1,4,-3,2,-1,0,0,1,-2,1,-2,2,-2,2,-1,0,-1,1,-1,-1,1,-2,3,-2,1,0,-2,3,-3,2,-2,2,-1,1,-1,1,-1,1,-1,0,1,-1,2,-2,3,-2,3,-2,2,-1,1,-1,3,-2,3,-1,-1,3,-4,3,-3,1,1,-2,3,-2,1,1,-2,1,-1,1, 43 | 2,-1,2,-2,2,-1,1,-1,0,0,0,1,-2,2,-3,2,-2,0,-1,0,-2,3,-4,3,-2,1,-2,0,0,1,-1,1,-1,2,-2,2,-1,0,0,-1,1,1,-2,1,-1,-1,2,-2,1,1,-2,3,-2,1,-1,1,-1,2,-2,3,-1,1,2,-2,2,-2,1,-1,1,-1,1,-1,0,-1,0,1,0,-2,2,-2,1,1,-2,3,-3,2,1,-2,1,-1,1,1,-2,1,-1,-1,2,-2,1,2, 44 | -2,1,1,-1,2,-2,1,0,-1,1,-1,0,1,-2,1,-1,0,-1,1,0,-1,2,-2,1,-1,-1,1,-1,1,1,1,-1,1,0,0,1,-1,1,-1,1,-1,0,0,1,-3,3,-2,3,-2,1,-1,1,-1,1,-2,2,-1,2,-1,1,-1,1,-1,-1,2,-1,2,-2,2,1,1,1,-1,1,-1,1,0,1,-1,-2,-1,2,-2,2,-1,-2,2,-2,1,1,-1,2,-2,3,-4,2,-1,0,0,-1, 45 | -2,2,-2,-1,1,-2,1,1,-3,3,-2,2,1,-1,1,1,-1,0,1,-1,-1,1,-2,0,1,-1,-1,1,1,-2,3,-5,3,-2,0,2,-2,2,-2,0,0,-1,0,-2,1,-2,1,0,0,-1,1,-2,2,-1,0,-1,2,-4,3,-2,1,0,-1,1,-1,1,1,-1,0,2,-2,1,-2,0,1,-1,1,0,-2,2,-1,2,1,-2,0,0,-1,0,0,-1,2,-1,1,1,2,-1,1,-3,1,-2, 46 | 1,0,-1,4,-5,5,-5,3,-3,3,-3,1,0,-1,1,-2,0,0,0,-1,2,-3,4,-3,2,0,-2,2,-2,2,-1,2,1,-1,1,-2,2,-2,1,-1,3,-3,3,-2,3,-1,1,-1,1,-1,2,-1,-1,0,-1,-1,1,-1,2,-2,1,0,-1,3,-2,2,0,-2,2,-1,1,-1,2,-1,-1,1,-2,3,-2,2,-2,-1,0,-1,2,-1,0,0,-1,2,-2,2,-2,-1,2,-3,3,-3,2,-1, 47 | -2,4,-4,3,-2,1,0,-2,2,-1,1,2,-3,3,-4,4,-4,3,-4,1,-1,-1,2,-3,3,-2,1,2,-1,0,0,-1,1,-1,1,-3,4,-2,2,1,1,-2,1,-1,0,1,-2,0,1,-1,0,2,-2,2,-1,0,1,-1,-2,3,-4,4,-4,2,-1,1,1,-2,1,-1,0,-1,1,-2,1,-1,-2,2,-2,-1,1,-3,4,-5,4,-1,-2,3,-3,1,1,0,-1,-1,1,-2,2,-2,-1,2, 48 | -4,3,-3,0,1,-1,1,1}; 49 | -------------------------------------------------------------------------------- /SOUNDS/zSAMPLE47.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Written by WAVToCode 3 | * Date: Thu Nov 28 10:28:52 PM 4 | * FileName: ZSAMPLE47.h 5 | * Interleaved: N/A 6 | * Signed: Yes 7 | * No. of channels: 1 8 | * No. of samples: 2784 9 | * Bits/Sample: 16 10 | **********************************************************************/ 11 | 12 | #define NUM_ELEMENTS 2784 13 | 14 | const int16_t SAMPLE47[NUM_ELEMENTS] = { 15 | 61, 94, 1019, 1149, 174, -911, -1107, 340, /* 0-7 */ 16 | 2903, 2087, -56, -962, 443, -205, -1886, -1922, /* 8-15 */ 17 | -1315, -920, -701, 398, 1542, 1904, 1524, 1117, /* 16-23 */ 18 | -834, -2166, -1082, 315, 196, -1280, -2017, -3429, /* 24-31 */ 19 | -1958, 3437, 8141, 6450, -323, -4742, -2782, 1223, /* 32-39 */ 20 | -1270, -3552, -4675, -2046, 2948, 2593, -1936, -2357, /* 40-47 */ 21 | 290, 3852, 3842, 4249, -445, -6291, -4335, 3555, /* 48-55 */ 22 | 8421, 2112, -4081, -6608, -2059, 6029, 9695, 9062, /* 56-63 */ 23 | 7171, -2678, -20277, -22550, -5114, 13923, 15557, 8238, /* 64-71 */ 24 | 2243, -1316, -3034, -2080, 4117, 2217, -10080, -13860, /* 72-79 */ 25 | -2209, 9681, 18563, 2049, -8522, -11586, -550, 2829, /* 80-87 */ 26 | -1729, -6607, -3860, -235, -4507, -5484, 1979, 17617, /* 88-95 */ 27 | 19339, 12313, -7742, -23980, -16481, 5732, 22129, 24697, /* 96-103 */ 28 | 10637, -10715, -20107, -11282, -1360, 756, -326, -4832, /* 104-111 */ 29 | -3415, 11027, 31148, 26355, -6127, -29463, -16291, 6334, /* 112-119 */ 30 | 10245, 13072, 4395, -9081, -8490, 277, 5512, -3258, /* 120-127 */ 31 | 778, -533, -1233, 203, 1979, 3161, 7806, 990, /* 128-135 */ 32 | -7928, -4296, -844, 2377, 2105, 10323, 15440, -780, /* 136-143 */ 33 | -21328, -17071, 4219, 13327, 8091, 3643, -6655, -14960, /* 144-151 */ 34 | -8580, 3967, 6041, -5721, -20330, -16866, -6929, -5114, /* 152-159 */ 35 | 6410, 23710, 28438, 16305, -3463, -15464, -17960, -8745, /* 160-167 */ 36 | 6222, 5981, -13424, -22657, -2650, 23713, 25423, 16061, /* 168-175 */ 37 | 10051, -4417, -14754, -9933, 3852, 1139, -14217, -20595, /* 176-183 */ 38 | -14645, 723, 9084, 6082, -1623, -7254, -7061, -4360, /* 184-191 */ 39 | -5604, -11851, -7508, 12949, 26924, 22576, 7121, -5597, /* 192-199 */ 40 | -8014, -525, 537, -4288, 2240, 13726, 1520, -17661, /* 200-207 */ 41 | -11333, -2640, -5409, -3653, 15997, 14988, -2982, -12338, /* 208-215 */ 42 | -7029, -2395, 601, 957, -2280, 7048, 21769, 15570, /* 216-223 */ 43 | -4478, -9054, -3063, -4105, -11032, -7683, 4236, 14187, /* 224-231 */ 44 | 10301, 3043, -4328, -6975, -4486, -71, 2831, -4075, /* 232-239 */ 45 | -14293, -10423, 4601, 8423, 5337, 2489, 5027, 6434, /* 240-247 */ 46 | 2025, -2838, -6678, -3328, 3938, 10459, 10406, -6734, /* 248-255 */ 47 | -17360, 316, 20157, 24191, 3825, -10314, -5762, 8695, /* 256-263 */ 48 | -5664, -12185, 2284, 19210, 5226, -15011, -16194, -10139, /* 264-271 */ 49 | -7931, -3474, 3306, -598, -13928, -16927, -5355, 7093, /* 272-279 */ 50 | 9317, 8596, 7009, -3117, -10301, -3653, 14424, 16316, /* 280-287 */ 51 | 2491, -7775, -5659, 5631, 16085, 12586, 2454, -305, /* 288-295 */ 52 | -586, 3981, 3194, -6360, -5843, 257, -1105, -2078, /* 296-303 */ 53 | 2436, 12992, 13111, 5290, -635, 773, -3708, -19198, /* 304-311 */ 54 | -21713, -2470, 10388, 7412, 7355, 6801, -6466, -18550, /* 312-319 */ 55 | -9063, 8246, 10123, -4477, -16610, -8076, 5514, 5501, /* 320-327 */ 56 | -3897, -718, 12328, 5857, -4780, -11752, -11923, -7961, /* 328-335 */ 57 | -2527, -1113, 4508, 8792, 8462, 2379, 4621, 257, /* 336-343 */ 58 | -16054, -17741, -1292, 8553, 4972, 1088, 4424, 5503, /* 344-351 */ 59 | -449, -4881, -3000, -1217, -2499, -3867, 868, 4073, /* 352-359 */ 60 | 7395, 8493, 2228, -5092, -3192, 3609, 5653, -416, /* 360-367 */ 61 | -5323, -4391, -3112, -587, 248, -3708, 944, 10078, /* 368-375 */ 62 | 6040, -5513, -10633, -591, 6745, 2428, -6275, 3512, /* 376-383 */ 63 | 17716, 19118, 3326, -10443, -14059, -9521, -1836, 2153, /* 384-391 */ 64 | 6311, 7190, -1319, -9233, -4561, 6347, 10082, 5172, /* 392-399 */ 65 | -3611, -8121, -6471, -1191, 7253, 11404, 11500, 4503, /* 400-407 */ 66 | -6900, -12301, -5793, 4584, 3058, -4488, -6935, -2144, /* 408-415 */ 67 | 10228, 15921, -643, -12583, -5019, 9872, 3762, -5968, /* 416-423 */ 68 | -4458, -2747, -3696, -1816, 2255, 13146, 14490, 835, /* 424-431 */ 69 | -13959, -17492, -9074, -216, 6075, 10031, 3941, -8235, /* 432-439 */ 70 | -10935, -1726, 5840, 4237, -422, -4663, -4721, -2734, /* 440-447 */ 71 | -656, 5088, 16435, 14134, -3842, -12343, -2903, 947, /* 448-455 */ 72 | -3820, 2114, 543, -11749, -15484, -389, 10479, 7371, /* 456-463 */ 73 | 2561, -700, -3260, -6905, -6317, -2619, 1660, -967, /* 464-471 */ 74 | -855, 3710, 5101, 6558, 3455, -6660, -14304, -5648, /* 472-479 */ 75 | 7270, 11473, 10890, 13063, 11038, 3543, -6509, -10176, /* 480-487 */ 76 | -4220, 1739, -501, -5405, -4298, -438, 2500, 4216, /* 488-495 */ 77 | 1154, -2211, -257, 5146, 1194, -8494, -11823, -1614, /* 496-503 */ 78 | 8897, 7774, 5014, 2863, 5174, 6406, 2609, -3139, /* 504-511 */ 79 | -2731, -1628, -2898, -7182, -2662, -119, -147, 5053, /* 512-519 */ 80 | 6640, 4951, -3047, -11174, -11585, -2281, 9494, 13693, /* 520-527 */ 81 | 8802, -790, -8431, -7512, -1140, 1154, -4177, -10019, /* 528-535 */ 82 | -6632, -79, 1396, 2762, 8855, 4977, -4005, -4915, /* 536-543 */ 83 | -2174, -332, -3241, -1762, 3248, 3449, 1201, 6077, /* 544-551 */ 84 | 8279, -1049, -11641, -8157, 674, -86, -3760, 1652, /* 552-559 */ 85 | 6940, -472, -5007, -1334, 1373, 2532, 6262, 5217, /* 560-567 */ 86 | -4614, -9201, -3771, 2245, 3795, 3462, -2167, -8169, /* 568-575 */ 87 | -4814, 2488, 3122, 852, 7003, 8300, -2089, -7304, /* 576-583 */ 88 | -3489, 1817, 6155, 5327, 2744, 3351, 1886, -1480, /* 584-591 */ 89 | -4345, -3727, -62, 347, -3424, -285, 2042, 1963, /* 592-599 */ 90 | 2244, 1564, -658, 1454, 1688, -2181, -5453, -2173, /* 600-607 */ 91 | 5772, 8217, 4383, 64, 709, -975, -6260, -8245, /* 608-615 */ 92 | -1199, 5393, 108, -7722, -5712, 3038, 6249, 543, /* 616-623 */ 93 | -6699, -6086, -2044, 1689, 6199, 4512, -1191, -3062, /* 624-631 */ 94 | -461, -250, -1786, 2504, 4211, -4388, -11216, -2599, /* 632-639 */ 95 | 9987, 10970, 3448, -1307, -1633, 622, 1483, 1568, /* 640-647 */ 96 | 4885, 4993, -111, -4860, -3208, 496, 1861, 438, /* 648-655 */ 97 | -4730, -5377, 1744, 5619, 1619, -2244, 1814, 5567, /* 656-663 */ 98 | 22, -6729, -5130, -1784, -433, 1935, 4165, 4841, /* 664-671 */ 99 | 2653, -2410, -6656, -4970, 188, -1029, -5219, -1025, /* 672-679 */ 100 | 6157, 6617, 338, -1798, 703, 4557, 3033, -6141, /* 680-687 */ 101 | -6747, 967, 7027, 5390, -860, -4585, -4573, -1587, /* 688-695 */ 102 | 483, -965, -2819, -4131, -1297, 4693, 5644, 1276, /* 696-703 */ 103 | -2721, -4341, -3939, -124, 6538, 8283, 2250, -5027, /* 704-711 */ 104 | -6611, -2045, 4032, 7654, 3092, -3536, -5416, -5161, /* 712-719 */ 105 | -1301, 2787, 4191, 1891, -1772, -4121, -4836, -1243, /* 720-727 */ 106 | 2223, -1482, -4251, 829, 7893, 5947, -1103, -2957, /* 728-735 */ 107 | 577, 2869, 751, -1662, -1057, 1840, 2731, 392, /* 736-743 */ 108 | -3330, -2544, 4096, 9005, 5645, -3117, -8023, -7357, /* 744-751 */ 109 | -2475, 3117, 4819, 709, -2629, -569, 2899, 1102, /* 752-759 */ 110 | -4503, -4882, -890, 4193, 4010, 89, -2745, -1331, /* 760-767 */ 111 | 906, 1447, -1172, -3110, -4553, -2336, 1721, 1706, /* 768-775 */ 112 | 424, 929, 1688, -622, -3051, -1567, -496, 2718, /* 776-783 */ 113 | 6913, 5897, -1428, -5524, -1832, 1800, 4241, 7235, /* 784-791 */ 114 | 5426, -2507, -8999, -7130, -3405, -3296, -1072, 4593, /* 792-799 */ 115 | 2963, -2250, -502, 4077, 3656, -2619, -5875, -2622, /* 800-807 */ 116 | 693, -1008, -1952, 1791, 6441, 1898, -6031, -5885, /* 808-815 */ 117 | 1642, 4818, 4133, 1747, -4023, -7546, -3692, 1501, /* 816-823 */ 118 | 1886, 669, 602, 436, 724, 1192, 210, -480, /* 824-831 */ 119 | 281, 1179, 1116, 1821, 499, -1825, -109, 4304, /* 832-839 */ 120 | 4144, -1577, -3963, -2234, -1048, 768, 3148, 3320, /* 840-847 */ 121 | 574, -5010, -5202, -520, 2683, 1878, -1301, 488, /* 848-855 */ 122 | 3427, 4605, 1589, -1350, -2342, -2251, -686, 388, /* 856-863 */ 123 | 228, -395, 3400, 4832, -831, -5982, -5476, -236, /* 864-871 */ 124 | 3106, 3084, 3703, 3400, -2084, -7677, -5789, -611, /* 872-879 */ 125 | 1763, 2981, 4188, 2036, -1294, -1497, 960, 3235, /* 880-887 */ 126 | 841, -4346, -3938, 106, 2402, 1488, 4004, 3523, /* 888-895 */ 127 | -3896, -7442, -1480, 5207, 2943, -75, -1417, -2338, /* 896-903 */ 128 | -3538, -1925, 536, 1281, 1095, 881, 577, 1889, /* 904-911 */ 129 | 3099, 1360, -3436, -6411, -1825, 4564, 3834, -863, /* 912-919 */ 130 | -1349, 1937, 2465, -440, -775, 2615, 2954, -192, /* 920-927 */ 131 | -2645, -2345, -70, 1845, 1729, 833, -879, -2698, /* 928-935 */ 132 | -3572, -2414, 1494, 5244, 3895, -2128, -4928, -885, /* 936-943 */ 133 | 4870, 4468, -50, -5971, -6739, -3575, -1908, 540, /* 944-951 */ 134 | 4828, 4685, -131, -2533, -404, 266, -1004, -1376, /* 952-959 */ 135 | -96, 1135, 1736, 1735, 1773, -148, -2808, -2904, /* 960-967 */ 136 | -868, 606, 445, -578, -935, -660, -2461, -125, /* 968-975 */ 137 | 2090, 1999, 2168, -1363, -3329, -524, 2400, -381, /* 976-983 */ 138 | -2739, -872, 1559, 836, 1008, 3939, 4507, -253, /* 984-991 */ 139 | -3569, -2339, 1234, 2735, -427, -4402, -3327, -474, /* 992-999 */ 140 | 1192, 2340, 2644, -939, -2570, 1616, 2561, -219, /* 1000-1007 */ 141 | -1261, 89, 417, -1369, -1592, 732, 2625, 4353, /* 1008-1015 */ 142 | 4523, 197, -4634, -3618, -76, 1644, 2594, 3032, /* 1016-1023 */ 143 | -546, -4148, -3798, -1464, 315, 2250, 62, -1623, /* 1024-1031 */ 144 | 575, 2157, 1620, -505, -1513, -2218, -1820, -242, /* 1032-1039 */ 145 | 546, -133, -1031, -846, 689, 2360, 1269, -1645, /* 1040-1047 */ 146 | -1646, 947, 1942, 1279, 1441, 168, -2343, -3585, /* 1048-1055 */ 147 | -114, 2903, 2257, 995, -998, -1735, 777, 2529, /* 1056-1063 */ 148 | 2035, 1302, -1617, -4899, -3811, -300, 733, 311, /* 1064-1071 */ 149 | 165, -423, -1624, -1131, 1136, 2971, 1322, -3412, /* 1072-1079 */ 150 | -4288, -614, 1614, 1804, 3894, 4949, 40, -4035, /* 1080-1087 */ 151 | -2148, 551, -520, -974, 1594, 2337, -346, -1731, /* 1088-1095 */ 152 | 539, 2628, 2455, 49, -2474, -4674, -2471, 3033, /* 1096-1103 */ 153 | 2115, -1977, -3897, -1413, 188, 464, 3567, 4102, /* 1104-1111 */ 154 | 685, -3496, -2122, 1392, 2218, -264, -1564, -33, /* 1112-1119 */ 155 | 1024, -321, -956, 935, 1778, 218, -768, 50, /* 1120-1127 */ 156 | 791, 1234, 1144, -151, -1416, -1756, -960, 786, /* 1128-1135 */ 157 | 408, -639, 188, 1479, 3929, 2619, -2916, -4959, /* 1136-1143 */ 158 | -1795, 618, 2096, 3561, 1994, -162, -2826, -2488, /* 1144-1151 */ 159 | 513, 1312, 1530, 1209, 241, -1116, -959, -265, /* 1152-1159 */ 160 | -640, -3173, -4236, -1597, 1692, 4088, 4704, 3738, /* 1160-1167 */ 161 | -84, -3316, -3278, -2123, -1197, 637, 1442, 562, /* 1168-1175 */ 162 | -682, -1601, -832, 2006, 3469, -133, -4385, -3041, /* 1176-1183 */ 163 | -50, 776, 608, 1106, -353, -2086, -563, 711, /* 1184-1191 */ 164 | 2093, 3867, 3257, 362, -2217, -1896, -538, 702, /* 1192-1199 */ 165 | 2472, 2105, -443, -1731, -762, -520, -2451, -2946, /* 1200-1207 */ 166 | -862, 1269, 2289, 2093, 1500, -1245, -3196, -1946, /* 1208-1215 */ 167 | 419, 2503, 2829, 322, -2024, -1256, 999, 885, /* 1216-1223 */ 168 | -1010, -1596, -121, 1160, 854, 432, 502, 113, /* 1224-1231 */ 169 | -1401, -2291, -1952, 498, 3104, 848, -2724, -2412, /* 1232-1239 */ 170 | 438, 2135, 1757, 159, -2314, -1706, 2028, 3573, /* 1240-1247 */ 171 | 2388, 748, -1723, -3008, -1285, 378, 11, 197, /* 1248-1255 */ 172 | 1368, -166, -3029, -2369, 302, 562, 1708, 3368, /* 1256-1263 */ 173 | 1415, -1282, -1443, -94, -320, -160, 1548, 1929, /* 1264-1271 */ 174 | 539, -832, 148, 99, -674, -648, 151, 1351, /* 1272-1279 */ 175 | 1239, 781, -226, -1157, -1931, -1044, 1149, 2844, /* 1280-1287 */ 176 | 1127, -966, -1907, -1773, -557, 1201, 1665, -1516, /* 1288-1295 */ 177 | -3492, -1512, 2381, 3252, 516, -2006, -1289, 481, /* 1296-1303 */ 178 | 673, -867, -1880, -867, -218, -832, -971, 217, /* 1304-1311 */ 179 | 1547, 998, -835, -954, 986, 1601, 567, -556, /* 1312-1319 */ 180 | -832, -1072, -641, 1307, 3351, 1413, -2429, -2543, /* 1320-1327 */ 181 | 93, 2007, 2379, 1991, -57, -1984, -2259, -711, /* 1328-1335 */ 182 | -13, -152, 9, 264, 42, -285, -133, 438, /* 1336-1343 */ 183 | 945, 666, 648, 905, 641, -322, -1565, -1656, /* 1344-1351 */ 184 | -176, 948, 839, 425, 1042, 1961, 1092, -1688, /* 1352-1359 */ 185 | -3294, -1418, 454, 1258, 1010, -40, -1659, -1678, /* 1360-1367 */ 186 | 691, 1898, -50, -1858, -1288, 107, 88, -442, /* 1368-1375 */ 187 | -24, 1535, 2278, 754, -724, -808, -69, 424, /* 1376-1383 */ 188 | 507, -531, -2135, -2169, -615, 703, 932, 640, /* 1384-1391 */ 189 | 273, 210, 331, 1629, 2244, 833, 129, 29, /* 1392-1399 */ 190 | -852, -2343, -1148, 611, 1029, 269, 669, 1359, /* 1400-1407 */ 191 | -1162, -1768, -260, -600, 572, 2554, 903, -1273, /* 1408-1415 */ 192 | -1340, -218, -41, 527, 1219, -590, -2331, -1150, /* 1416-1423 */ 193 | 1652, 2763, 1296, -1012, -2152, -1182, 287, 491, /* 1424-1431 */ 194 | 438, 1226, 1087, -787, -1883, -1093, 404, 1377, /* 1432-1439 */ 195 | 695, -1349, -2214, -597, 296, -301, 723, 1380, /* 1440-1447 */ 196 | -180, -1351, -662, 764, 731, -40, 289, 679, /* 1448-1455 */ 197 | 176, -132, -356, -616, -25, 729, 755, -277, /* 1456-1463 */ 198 | -383, 697, 825, -256, -1020, -414, 126, 109, /* 1464-1471 */ 199 | 3, -245, -519, 9, 851, 591, -347, -444, /* 1472-1479 */ 200 | 94, 132, 176, 984, 621, -1420, -1931, -426, /* 1480-1487 */ 201 | 521, 463, 590, 293, -1723, -1643, 918, 2037, /* 1488-1495 */ 202 | 1345, -568, -1763, -397, 1261, 1254, 1018, 54, /* 1496-1503 */ 203 | -1472, -1497, 357, 1281, 295, -479, 213, 436, /* 1504-1511 */ 204 | -336, -471, 289, 1094, 1314, 9, -1939, -1999, /* 1512-1519 */ 205 | -96, 1779, 1947, 199, -1965, -1982, 83, 507, /* 1520-1527 */ 206 | 346, 1413, 1584, -162, -1917, -1170, 479, 687, /* 1528-1535 */ 207 | -484, -783, 194, 1060, 730, -420, -900, -671, /* 1536-1543 */ 208 | -324, -122, 1000, 2129, 1312, -756, -1357, -386, /* 1544-1551 */ 209 | 284, 295, 55, -254, -473, -547, -335, 648, /* 1552-1559 */ 210 | 1278, -239, -1965, -1299, 449, 1347, 1627, 1417, /* 1560-1567 */ 211 | -230, -1728, -1098, 226, 121, -138, -508, -841, /* 1568-1575 */ 212 | -853, -97, 1091, 1155, -219, -1558, -1142, 519, /* 1576-1583 */ 213 | 919, 378, 951, 901, 101, -422, -214, 134, /* 1584-1591 */ 214 | 486, 781, 322, -617, -974, -750, 308, 998, /* 1592-1599 */ 215 | 148, -1133, -1282, -302, 917, 1335, 579, -484, /* 1600-1607 */ 216 | -634, -554, -344, 284, 763, 310, -372, 45, /* 1608-1615 */ 217 | 267, -329, -687, 113, 1156, 615, -10, 520, /* 1616-1623 */ 218 | 675, 143, -614, -375, -59, -285, 265, 769, /* 1624-1631 */ 219 | -444, -1953, -1401, 219, 1223, 977, -468, -1137, /* 1632-1639 */ 220 | -7, 1255, 1372, 730, -295, -1191, -781, 281, /* 1640-1647 */ 221 | 290, -189, 185, 565, -582, -1860, -986, 1106, /* 1648-1655 */ 222 | 1583, 136, -850, -686, 32, 388, 567, 485, /* 1656-1663 */ 223 | 422, 134, -801, -1303, -889, -110, 614, 666, /* 1664-1671 */ 224 | 373, 594, 396, -505, -1161, -511, 112, -142, /* 1672-1679 */ 225 | -439, 414, 1238, 827, 2, -107, 467, 764, /* 1680-1687 */ 226 | 222, -231, -321, -606, -382, 52, -102, -628, /* 1688-1695 */ 227 | -667, -226, 303, 438, -52, -439, -1, 362, /* 1696-1703 */ 228 | 88, 183, 396, -204, -623, -13, 536, 343, /* 1704-1711 */ 229 | 388, 205, -832, -1016, 154, 1125, 757, -111, /* 1712-1719 */ 230 | -502, -513, -314, -119, -306, -395, 575, 1327, /* 1720-1727 */ 231 | 110, -1402, -505, 1011, 622, -425, -643, -127, /* 1728-1735 */ 232 | 582, 115, -350, 326, 1386, 407, -1513, -1561, /* 1736-1743 */ 233 | -302, 501, 402, -218, -327, 569, 1006, 432, /* 1744-1751 */ 234 | -380, -30, 118, -155, -257, -116, -420, -763, /* 1752-1759 */ 235 | -379, -220, -43, 363, 331, 497, 1070, 1067, /* 1760-1767 */ 236 | 105, -917, -641, 316, 349, -86, -37, 156, /* 1768-1775 */ 237 | 93, -353, -738, -91, 851, 688, -723, -1590, /* 1776-1783 */ 238 | -677, 900, 906, 197, 270, 523, 219, -535, /* 1784-1791 */ 239 | -765, -69, 805, 433, -940, -1309, -254, 546, /* 1792-1799 */ 240 | 638, 568, 171, -259, -350, -51, 479, 594, /* 1800-1807 */ 241 | 226, -417, -327, -33, -161, -330, 278, 670, /* 1808-1815 */ 242 | 208, 137, 389, -175, -1270, -1204, 144, 946, /* 1816-1823 */ 243 | 426, -54, 395, 770, 261, -587, -606, -82, /* 1824-1831 */ 244 | 135, 98, 389, 429, -241, -755, -903, -111, /* 1832-1839 */ 245 | 775, 253, -584, -560, 389, 751, 34, -544, /* 1840-1847 */ 246 | -307, 199, 399, 349, 138, -27, -197, -211, /* 1848-1855 */ 247 | 72, 775, 807, -176, -1093, -848, 23, 457, /* 1856-1863 */ 248 | 6, -914, -1109, -157, 608, 460, 399, 632, /* 1864-1871 */ 249 | 451, -312, -592, -176, 737, 629, -281, -273, /* 1872-1879 */ 250 | -302, -59, 316, 512, 166, -531, -610, -202, /* 1880-1887 */ 251 | 21, 219, 605, 275, -766, -965, 209, 859, /* 1888-1895 */ 252 | 105, -534, -102, 405, 265, 220, 356, -215, /* 1896-1903 */ 253 | -972, -546, 283, 278, 335, 483, 12, -779, /* 1904-1911 */ 254 | -259, 789, 796, 363, -280, -943, -1056, -221, /* 1912-1919 */ 255 | 662, 774, 147, -341, -285, -77, -3, 213, /* 1920-1927 */ 256 | 585, 329, -476, -688, -233, 58, 199, 264, /* 1928-1935 */ 257 | -49, -564, -547, 26, 517, 567, 42, -600, /* 1936-1943 */ 258 | -562, 160, 739, 602, 5, -276, -62, 405, /* 1944-1951 */ 259 | 424, 188, -198, -415, -66, 776, 1144, 62, /* 1952-1959 */ 260 | -1174, -1244, -380, 6, 107, 549, 892, 326, /* 1960-1967 */ 261 | -592, -662, 113, 540, 26, -495, -223, 243, /* 1968-1975 */ 262 | 219, 365, 770, 379, -670, -820, -153, 189, /* 1976-1983 */ 263 | 269, 326, -125, -805, -581, 235, 599, 469, /* 1984-1991 */ 264 | 311, 118, -158, -445, -330, -181, -161, -144, /* 1992-1999 */ 265 | -144, 53, 504, 441, 220, 446, 39, -816, /* 2000-2007 */ 266 | -743, 157, 422, 202, 338, 476, -320, -1067, /* 2008-2015 */ 267 | -604, 321, 815, 676, 56, -300, -139, 2, /* 2016-2023 */ 268 | 81, 301, 149, -435, -372, 316, 429, -113, /* 2024-2031 */ 269 | -375, -25, 368, 376, 27, -243, -423, -259, /* 2032-2039 */ 270 | 379, 296, -211, -405, -32, 337, 160, 24, /* 2040-2047 */ 271 | -152, -157, -101, 99, 166, -83, -139, 200, /* 2048-2055 */ 272 | 351, 31, -92, 39, 113, 380, 401, -300, /* 2056-2063 */ 273 | -808, -509, 5, 194, 325, 150, -284, -230, /* 2064-2071 */ 274 | 70, 124, 253, 420, -159, -560, -40, 235, /* 2072-2079 */ 275 | -4, 0, 284, 147, -212, -329, -103, -72, /* 2080-2087 */ 276 | 48, 295, 290, 106, 84, 286, 32, -573, /* 2088-2095 */ 277 | -677, -260, 24, 18, 104, 411, 678, 526, /* 2096-2103 */ 278 | -304, -792, -320, 202, 368, 373, 43, -378, /* 2104-2111 */ 279 | -349, -100, -145, -100, 156, 219, 80, 6, /* 2112-2119 */ 280 | -9, 1, -25, 5, 242, 540, 168, -472, /* 2120-2127 */ 281 | -329, 103, 464, 390, -10, -589, -670, -97, /* 2128-2135 */ 282 | 147, 217, 118, -161, -363, -30, 204, 55, /* 2136-2143 */ 283 | 161, 421, 293, -180, -314, 12, 107, -164, /* 2144-2151 */ 284 | -281, 24, 367, 405, 213, -4, -43, 46, /* 2152-2159 */ 285 | -32, -86, 67, 225, 91, -341, -471, -181, /* 2160-2167 */ 286 | 395, 470, 96, -232, -260, -145, -241, 8, /* 2168-2175 */ 287 | 433, 134, -302, -48, 418, 439, -24, -311, /* 2176-2183 */ 288 | -387, -167, 307, 433, 78, -450, -530, -155, /* 2184-2191 */ 289 | 192, 408, 426, 11, -474, -347, 126, 217, /* 2192-2199 */ 290 | 211, 319, 40, -499, -519, 161, 679, 581, /* 2200-2207 */ 291 | 27, -498, -566, -206, 281, 477, 549, 495, /* 2208-2215 */ 292 | 356, -230, -852, -609, -95, 208, 486, 399, /* 2216-2223 */ 293 | 51, -75, 50, -27, -333, -254, 210, 494, /* 2224-2231 */ 294 | 99, -489, -572, -226, 164, 618, 745, 119, /* 2232-2239 */ 295 | -531, -409, -110, -48, 110, 223, -102, -358, /* 2240-2247 */ 296 | -130, 183, 306, 387, 232, -184, -441, -169, /* 2248-2255 */ 297 | 134, 256, 387, 238, -100, -519, -358, 140, /* 2256-2263 */ 298 | 298, 68, -341, -444, 75, 320, 129, 211, /* 2264-2271 */ 299 | 67, -327, -344, 71, 468, 505, 48, -486, /* 2272-2279 */ 300 | -502, -117, 115, 48, 68, 219, 146, -63, /* 2280-2287 */ 301 | -136, -122, -52, 259, 475, 96, -513, -505, /* 2288-2295 */ 302 | -117, 216, 394, 359, -1, -257, -221, 88, /* 2296-2303 */ 303 | 146, 24, 93, 234, 225, -132, -417, -405, /* 2304-2311 */ 304 | -120, 164, 244, 50, 23, 84, 42, 30, /* 2312-2319 */ 305 | 278, 347, -154, -566, -265, 200, 153, -75, /* 2320-2327 */ 306 | -76, 115, 238, 163, 43, -44, -33, -37, /* 2328-2335 */ 307 | -15, -57, -49, 166, 304, -72, -556, -333, /* 2336-2343 */ 308 | 102, 261, 290, 558, 314, -364, -668, -355, /* 2344-2351 */ 309 | 21, 149, 301, 389, 96, -166, 81, 269, /* 2352-2359 */ 310 | -41, -363, -205, 55, 17, -6, 219, 231, /* 2360-2367 */ 311 | -148, -358, -101, 173, 192, 269, 304, 45, /* 2368-2375 */ 312 | -211, -211, -97, -129, -136, -9, 176, 243, /* 2376-2383 */ 313 | 298, 130, -167, -330, -170, 91, 235, 185, /* 2384-2391 */ 314 | 14, -81, -45, 106, 151, 18, -124, -68, /* 2392-2399 */ 315 | -44, -100, -18, 304, 379, -18, -403, -284, /* 2400-2407 */ 316 | 36, 161, 258, 238, 26, -240, -178, 147, /* 2408-2415 */ 317 | 155, -145, -259, -186, -35, 143, 226, 90, /* 2416-2423 */ 318 | -119, -124, 42, 124, 157, 161, -59, -262, /* 2424-2431 */ 319 | -91, 121, 42, -76, -94, 8, 122, 65, /* 2432-2439 */ 320 | -30, -32, -1, -27, 2, 42, -28, -54, /* 2440-2447 */ 321 | 121, 232, -19, -321, -229, 151, 331, 121, /* 2448-2455 */ 322 | -173, -311, -147, 144, 277, 153, -86, -105, /* 2456-2463 */ 323 | 113, 272, 147, -51, -174, -105, -40, 61, /* 2464-2471 */ 324 | 207, 158, -65, -341, -271, 43, 183, 280, /* 2472-2479 */ 325 | 319, -16, -301, -186, 93, 206, 176, 143, /* 2480-2487 */ 326 | 21, -177, -229, -88, 77, 77, -10, -41, /* 2488-2495 */ 327 | -27, 21, 169, 231, -40, -375, -223, 147, /* 2496-2503 */ 328 | 246, 31, -184, -141, 11, 150, 194, 183, /* 2504-2511 */ 329 | -9, -226, -221, -9, 234, 116, -138, -190, /* 2512-2519 */ 330 | -51, 172, 246, 116, -86, -152, -66, -35, /* 2520-2527 */ 331 | 5, 144, 194, 55, -59, -16, 2, -37, /* 2528-2535 */ 332 | 64, 255, 119, -164, -173, -38, 47, 128, /* 2536-2543 */ 333 | 70, -223, -321, -54, 137, 149, 168, 29, /* 2544-2551 */ 334 | -194, -136, 64, 68, 37, 217, 228, -59, /* 2552-2559 */ 335 | -260, -127, 200, 287, 83, -195, -229, -51, /* 2560-2567 */ 336 | 97, 112, 131, 150, 32, -128, -158, -49, /* 2568-2575 */ 337 | 48, 102, 118, 67, -7, -40, -66, -35, /* 2576-2583 */ 338 | 23, 104, 213, 59, -152, -164, -7, 104, /* 2584-2591 */ 339 | 138, 146, -46, -280, -265, -27, 168, 214, /* 2592-2599 */ 340 | 45, -65, -46, -89, -36, 107, 152, -7, /* 2600-2607 */ 341 | -156, -76, 59, 34, 1, 81, 129, -36, /* 2608-2615 */ 342 | -157, -59, 87, 85, 48, 24, -2, -45, /* 2616-2623 */ 343 | -68, -60, -15, 58, 40, -85, -66, 116, /* 2624-2631 */ 344 | 166, 93, 1, 11, 14, -41, -60, 70, /* 2632-2639 */ 345 | 196, -45, -366, -296, 17, 225, 236, 128, /* 2640-2647 */ 346 | 43, -125, 5, 199, 141, -84, -183, 43, /* 2648-2655 */ 347 | 219, 87, -158, -203, -94, 0, 84, 132, /* 2656-2663 */ 348 | -24, -233, -160, 129, 272, 135, -76, -102, /* 2664-2671 */ 349 | -6, 37, 35, 51, 32, -43, -33, -16, /* 2672-2679 */ 350 | -43, -1, 138, 131, -72, -206, -95, 23, /* 2680-2687 */ 351 | 96, 166, 77, -125, -178, 0, 65, 110, /* 2688-2695 */ 352 | 191, 94, -110, -116, 34, 59, 118, 124, /* 2696-2703 */ 353 | -88, -212, -68, 56, 21, 68, 191, 99, /* 2704-2711 */ 354 | -166, -211, -54, 5, 47, 150, 197, 14, /* 2712-2719 */ 355 | -105, -44, 34, -38, -92, -45, 32, 106, /* 2720-2727 */ 356 | 32, -33, -54, -4, 46, 93, 90, 11, /* 2728-2735 */ 357 | -65, -52, 15, 121, 131, -44, -186, -105, /* 2736-2743 */ 358 | 43, 80, 110, 91, -80, -224, -123, 121, /* 2744-2751 */ 359 | 71, -35, -9, 42, 64, 56, 88, 55, /* 2752-2759 */ 360 | -86, -165, -83, 72, 185, 149, 5, -72, /* 2760-2767 */ 361 | -86, 20, 115, 56, 71, 78, -22, -128, /* 2768-2775 */ 362 | -63, 109, 135, -4, -108, -65, -21, -24}; /* 2776-2783 */ 363 | -------------------------------------------------------------------------------- /LCD_tools.ino: -------------------------------------------------------------------------------- 1 | // #define BLACK RGB565_BLACK 2 | // #define NAVY RGB565_NAVY 3 | // #define DARKGREEN RGB565_DARKGREEN 4 | // #define DARKCYAN RGB565_DARKCYAN 5 | // #define MAROON RGB565_MAROON 6 | // #define PURPLE RGB565_PURPLE 7 | // #define OLIVE RGB565_OLIVE 8 | // #define LIGHTGREY RGB565_LIGHTGREY 9 | // #define DARKGREY RGB565_DARKGREY 10 | // #define BLUE RGB565_BLUE 11 | // #define GREEN RGB565_GREEN 12 | // #define CYAN RGB565_CYAN 13 | // #define RED RGB565_RED 14 | // #define MAGENTA RGB565_MAGENTA 15 | // #define YELLOW RGB565_YELLOW 16 | // #define WHITE RGB565_WHITE 17 | // #define ORANGE RGB565_ORANGE 18 | // #define GREENYELLOW RGB565_GREENYELLOW 19 | // #define PALERED RGB565_PALERED 20 | 21 | 22 | #define OSCURO RGB565(20, 25, 20) 23 | #define ZGREEN RGB565(50, 90, 50) 24 | 25 | #define ZRED RGB565(222, 43, 27) 26 | #define ZYELLOW RGB565(201, 191, 40) 27 | #define ZMAGENTA RGB565(128, 92, 156) 28 | #define ZCYAN RGB565(126, 225, 247) 29 | #define ZBLUE RGB565(80, 110, 240) 30 | #define ZGREENCLEAR RGB565(197, 240, 221) 31 | #define ZGREENALTER RGB565(90, 232, 170) 32 | 33 | #define DARKGREY RGB565(50, 50, 50) 34 | 35 | //#define PADCOLOR RGB565(45, 30, 45) 36 | #define PADCOLOR RGB565(64, 64, 75) 37 | #define ZBLACK RGB565(1, 1, 1) 38 | 39 | const uint8_t icon_on[] = { 40 | 0b00000000, 41 | 0b11111111, 42 | 0b11111111, 43 | 0b11111111, 44 | 0b11111111, 45 | 0b11111111, 46 | 0b11111111, 47 | 0b11111111, 48 | }; 49 | const uint8_t icon_off[] = { 50 | 0b00000000, 51 | 0b11111111, 52 | 0b00000000, 53 | 0b11111111, 54 | 0b00000000, 55 | 0b11111111, 56 | 0b00000000, 57 | 0b11111111, 58 | }; 59 | void showLastTouched() { 60 | if (!show_last_touched) { 61 | return; 62 | } 63 | if (last_touched>31) return; // exclude bars 64 | 65 | gfx->drawRect(BPOS[last_touched][0] + 0, BPOS[last_touched][1] + 0, BPOS[last_touched][2] - 1, BPOS[last_touched][3] - 1, BCOLOR[last_touched]); 66 | gfx->drawRect(BPOS[last_touched][0] + 1, BPOS[last_touched][1] + 1, BPOS[last_touched][2] - 3, BPOS[last_touched][3] - 3, BCOLOR[last_touched]); 67 | 68 | } 69 | 70 | void clearLastTouched() { 71 | if (!show_last_touched) { 72 | return; 73 | } 74 | if (start_showlt + (debounce_time * 2) > millis()) { 75 | return; 76 | } 77 | for (byte f = 0; f < 32; f++) { 78 | gfx->drawRect(BPOS[f][0] + 0, BPOS[f][1] + 0, BPOS[f][2] - 1, BPOS[f][3] - 1, BLACK); 79 | gfx->drawRect(BPOS[f][0] + 1, BPOS[f][1] + 1, BPOS[f][2] - 3, BPOS[f][3] - 3, BLACK); 80 | } 81 | show_last_touched = false; 82 | 83 | } 84 | 85 | void show_dark_selectors_ONLY1(){ // only once 86 | int pos_x; 87 | int pos_y; 88 | 89 | // borrar todos los marcadores de selected_sound 90 | for (int f=0;f<16;f++){ 91 | pos_x=BPOS[f][0]+9; 92 | pos_y=BPOS[f][1]+BPOS[f][3]-20; 93 | gfx->drawBitmap(pos_x, pos_y, icon_off, 8, 8, OSCURO, BLACK); 94 | } 95 | 96 | // borrar todos los marcadores de selected_pattern 97 | for (int f=0;f<16;f++){ 98 | pos_x=BPOS[f][0]+20; 99 | pos_y=BPOS[f][1]+BPOS[f][3]-20; 100 | gfx->drawBitmap(pos_x, pos_y, icon_off, 8, 8, OSCURO, BLACK); 101 | } 102 | 103 | // borrar todos los marcadores de selected_sndSet 104 | for (int f=0;f<16;f++){ 105 | pos_x=BPOS[f][0]+31; 106 | pos_y=BPOS[f][1]+BPOS[f][3]-20; 107 | gfx->drawBitmap(pos_x, pos_y, icon_off, 8, 8, OSCURO, BLACK); 108 | } 109 | 110 | // borrar todos los marcadores de selected_memory 111 | for (int f=0;f<16;f++){ 112 | pos_x=BPOS[f][0]+42; 113 | pos_y=BPOS[f][1]+BPOS[f][3]-20; 114 | gfx->drawBitmap(pos_x, pos_y, icon_off, 8, 8, OSCURO, BLACK); 115 | } 116 | 117 | } 118 | 119 | void show_all_bars_ONLY1(){ 120 | int pos_x; 121 | int pos_y; 122 | int bar_max_height; 123 | for (int f=32;f<48;f++){ 124 | gfx->drawRect(BPOS[f][0], BPOS[f][1], BPOS[f][2]-1, BPOS[f][3]-1, DARKGREY); 125 | pos_x=BPOS[f][0]+8; 126 | pos_y=BPOS[f][1]+2; 127 | bar_max_height=BPOS[f][3]-24; 128 | gfx->setCursor(pos_x-6,pos_y+bar_max_height+18); 129 | gfx->setTextColor(DARKGREY, BLACK); 130 | gfx->print(trot[f-32]); 131 | } 132 | } 133 | 134 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 135 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 136 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 137 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 138 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 139 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 140 | 141 | void drawPADsound(byte f, int color){ 142 | gfx->fillRect(BPOS[f][0] + 10, BPOS[f][1] + 9, 15, 7, color); 143 | } 144 | 145 | void drawPADstep(byte f, int color){ 146 | gfx->fillRect(BPOS[f][0] + 34, BPOS[f][1] + 9, 15, 7, color); 147 | } 148 | 149 | void drawBTPAD(byte bt, int color, String texto = "") { 150 | 151 | BCOLOR[bt] = color; 152 | //gfx->fillRect(BPOS[bt][0] + 3, BPOS[bt][1] + 3, BPOS[bt][2] - 7, BPOS[bt][3] - 7, color); 153 | gfx->drawRect(BPOS[bt][0] + 3, BPOS[bt][1] + 3, BPOS[bt][2] - 7, BPOS[bt][3] - 7, color); 154 | } 155 | 156 | void drawBT(byte bt, int color, String texto = "") { 157 | 158 | BCOLOR[bt] = color; 159 | 160 | gfx->drawRect(BPOS[bt][0] + 3, BPOS[bt][1] + 3, BPOS[bt][2] - 7, BPOS[bt][3] - 7, color); 161 | if (color!=DARKGREY) { 162 | gfx->drawRect(BPOS[bt][0] + 4, BPOS[bt][1] + 4, BPOS[bt][2] - 9, BPOS[bt][3] - 9, color); 163 | gfx->drawRect(BPOS[bt][0] + 5, BPOS[bt][1] + 5, BPOS[bt][2] - 11, BPOS[bt][3] - 11, color); 164 | } else { 165 | gfx->drawRect(BPOS[bt][0] + 4, BPOS[bt][1] + 4, BPOS[bt][2] - 9, BPOS[bt][3] - 9, BLACK); 166 | gfx->drawRect(BPOS[bt][0] + 5, BPOS[bt][1] + 5, BPOS[bt][2] - 11, BPOS[bt][3] - 11, BLACK); 167 | } 168 | 169 | 170 | /////////////////////// Button texts 171 | gfx->setTextColor(color, BLACK); 172 | gfx->setCursor(BPOS[bt][0] + 8, BPOS[bt][1] + 27); 173 | if (bt < 16) { 174 | gfx->setTextColor(LIGHTGREY, BLACK); 175 | // if write modeZ show note number else print pad number 176 | if (modeZ == tWrite) { 177 | 178 | if (bitRead(pattern[selected_sound], bt)) { // note on 179 | gfx->print(F(melodic[selected_sound][bt])); 180 | gfx->print(" "); 181 | } 182 | } else { 183 | gfx->print(F(bt)); 184 | gfx->print(" "); 185 | } 186 | } else if (bt<24){ 187 | if (texto == "") { 188 | gfx->print(F(tbuttons1[bt - 16])); 189 | } else { 190 | gfx->print(F(texto)); 191 | } 192 | } else { 193 | gfx->setCursor(BPOS[bt][0] + 8, BPOS[bt][1] + 23); 194 | if (texto == "") { 195 | gfx->print(F(tbuttons2[bt - 24])); 196 | } else { 197 | gfx->print(F(texto)); 198 | } 199 | } 200 | } 201 | 202 | void REFRESH_KEYS() { 203 | 204 | if (refreshMODES) { 205 | refreshMODES = false; 206 | 207 | // Borrar modos 208 | for (byte f = 16; f < 24; f++) { 209 | drawBT(f, DARKGREY); 210 | } 211 | switch (modeZ) { 212 | case tPad: 213 | drawBT(16, DARKGREEN); 214 | break; 215 | case tSel: 216 | drawBT(16, ZBLUE, " SELECT "); 217 | break; 218 | case tWrite: 219 | drawBT(16, ZRED, " WRITE "); 220 | break; 221 | case tMute: 222 | drawBT(20, ZBLUE); 223 | break; 224 | case tSolo: 225 | drawBT(20, ZRED, " SOLO "); 226 | break; 227 | case tMelod: 228 | drawBT(20, ZYELLOW, " MELOD "); 229 | break; 230 | case tClear: 231 | drawBT(20, ZGREENALTER, " CLEAR "); 232 | break; 233 | case tFirst: 234 | drawBT(20, ZCYAN, " FIRST "); 235 | break; 236 | case tLast: 237 | drawBT(20, GREENYELLOW, " LAST "); 238 | break; 239 | case tLoaPS: 240 | drawBT(18, ZBLUE); 241 | break; 242 | case tLoadS: 243 | drawBT(18, ZCYAN, " LOAD S "); 244 | break; 245 | case tLoadP: 246 | drawBT(18, ZGREENCLEAR, " LOAD P "); 247 | break; 248 | case tSavPS: 249 | drawBT(19, ZGREENCLEAR); 250 | break; 251 | case tSaveS: 252 | drawBT(19, ZYELLOW, " SAVE S "); 253 | break; 254 | case tSaveP: 255 | drawBT(19, ZRED, " SAVE P "); 256 | break; 257 | case tRndS: 258 | drawBT(17, MAGENTA, " RND S "); 259 | break; 260 | case tRndP: 261 | drawBT(17, ZYELLOW, " RND P "); 262 | break; 263 | case tRndNo: 264 | drawBT(17, ZCYAN, " RND N "); 265 | break; 266 | case tPiano: 267 | drawBT(21, MAGENTA); 268 | break; 269 | case tMemo: 270 | drawBT(23, ZGREENALTER," MEMORY "); 271 | break; 272 | case tMfirs: 273 | drawBT(23, ZCYAN, " FIRST "); 274 | break; 275 | case tMlast: 276 | drawBT(23, GREENYELLOW, " LAST "); 277 | break; 278 | } 279 | // play/stop 280 | if (playing) { 281 | drawBT(22, DARKGREEN); 282 | } 283 | if (recording) { 284 | drawBT(22, ZRED, " REC "); 285 | } 286 | // song 287 | if (songing) { 288 | drawBT(23, ZBLUE); 289 | } 290 | } 291 | 292 | if (clearPATTERNPADS) { 293 | clearPATTERNPADS = false; 294 | clearPATTERN(); 295 | } 296 | 297 | if (refreshPATTERN) { 298 | refreshPATTERN = false; 299 | 300 | switch (modeZ) { 301 | case tWrite: 302 | 303 | for (byte f = 0; f < 16; f++) { 304 | if bitRead (pattern[selected_sound], f) { 305 | drawBT(f, ZRED); 306 | } else { 307 | drawBT(f, PADCOLOR); 308 | } 309 | } 310 | break; 311 | case tMute: 312 | 313 | for (byte f = 0; f < 16; f++) { 314 | if bitRead (mutes, f) { 315 | drawBT(f, ZGREENALTER); 316 | } else { 317 | drawBT(f, PADCOLOR); 318 | } 319 | } 320 | break; 321 | case tSolo: 322 | 323 | for (byte f = 0; f < 16; f++) { 324 | if bitRead (solos, f) { 325 | drawBT(f, GREEN); 326 | } else { 327 | drawBT(f, PADCOLOR); 328 | } 329 | } 330 | break; 331 | case tMelod: 332 | for (byte f = 0; f < 16; f++) { 333 | if bitRead (isMelodic, f) { 334 | drawBT(f, ZRED); 335 | } else { 336 | drawBT(f, PADCOLOR); 337 | } 338 | } 339 | break; 340 | case tClear: 341 | for (byte f = 0; f < 16; f++) { 342 | drawBT(f, PADCOLOR); 343 | } 344 | break; 345 | case tFirst: 346 | for (byte f = 0; f < 16; f++) { 347 | if (firstStep == f) { 348 | drawBT(f, GREEN); 349 | } else { 350 | drawBT(f, PADCOLOR); 351 | } 352 | } 353 | break; 354 | case tLast: 355 | for (byte f = 0; f < 16; f++) { 356 | if (newLastStep == f) { 357 | drawBT(f, ZRED); 358 | } else { 359 | drawBT(f, PADCOLOR); 360 | } 361 | } 362 | break; 363 | case tMfirs: 364 | for (byte f = 0; f < 16; f++) { 365 | if (firstMemory == f) { 366 | drawBT(f, GREEN); 367 | } else { 368 | drawBT(f, PADCOLOR); 369 | } 370 | } 371 | break; 372 | case tMlast: 373 | for (byte f = 0; f < 16; f++) { 374 | if (newLastMemory == f) { 375 | drawBT(f, ZRED); 376 | } else { 377 | drawBT(f, PADCOLOR); 378 | } 379 | } 380 | break; 381 | default: 382 | clearPATTERNPADS=true; 383 | } 384 | } 385 | 386 | if (refreshPADSTEP) { 387 | refreshPADSTEP = false; 388 | // Si SEQ activo muestro los pads que suenan 389 | if (playing) { 390 | for (byte f = 0; f < 16; f++) { 391 | if bitRead (pattern[f], sstep) { 392 | drawPADsound(f, BLUE); 393 | } else { 394 | drawPADsound(f, OSCURO); 395 | } 396 | } 397 | } 398 | // Mostrar step actual 399 | if (sstep!=s_old_sstep && s_old_sstep!=-1){ 400 | drawPADstep(s_old_sstep, OSCURO); 401 | } 402 | drawPADstep(sstep, YELLOW); 403 | s_old_sstep=sstep; 404 | 405 | } 406 | 407 | 408 | if (clearPADSTEP) { 409 | clearPADSTEP = false; 410 | if (modeZ != 2) { 411 | for (byte f = 0; f < 16; f++) { 412 | drawPADsound(f, OSCURO); 413 | drawPADstep(f, OSCURO); 414 | } 415 | } 416 | 417 | // refresco lo que hay en el step en el siguiente bucle 418 | //refreshPATTERN = true; 419 | } 420 | } 421 | 422 | 423 | 424 | void drawShift() { 425 | // Actualizar texto botones 0-15 426 | for (byte f = 0; f < 16; f++) { 427 | drawBT(f, DARKGREY); 428 | } 429 | refreshPATTERN=true; 430 | } 431 | 432 | void drawScreen1_ONLY1() { 433 | for (byte f = 0; f < 32; f++) { 434 | //gfx->fillRect(BPOS[f][0], BPOS[f][1], BPOS[f][2], BPOS[f][3], BLACK); 435 | if (f < 16) { 436 | drawBTPAD(f, PADCOLOR); 437 | drawPADsound(f,OSCURO); 438 | drawPADstep(f,OSCURO); 439 | } else if (f < 24) { 440 | drawBT(f, DARKGREY); 441 | } else { 442 | drawBT(f, DARKGREY); 443 | } 444 | } 445 | show_dark_selectors_ONLY1(); 446 | show_all_bars_ONLY1(); 447 | 448 | } 449 | 450 | void clearPATTERN() { 451 | for (byte f = 0; f < 16; f++) { 452 | drawBT(f, PADCOLOR); 453 | } 454 | } 455 | 456 | 457 | void drawBar(byte bar){ 458 | 459 | // Color 460 | int qcolor=ZCYAN; 461 | if (bar>7) qcolor=ZGREENALTER; 462 | 463 | byte qbar=bar+32; 464 | int pos_x=BPOS[qbar][0]+8; 465 | int pos_y=BPOS[qbar][1]+2; 466 | int ancho=BPOS[qbar][2]; 467 | 468 | // valor 469 | int value=0; 470 | if (bar==11){ 471 | value=master_filter; 472 | } else if (bar==12){ 473 | value=octave; 474 | } else if (bar==8){ 475 | value=bpm; 476 | } else if (bar==9){ 477 | value=master_vol; 478 | } else if (bar==10){ 479 | ztranspose=0; 480 | value=ztranspose; 481 | } else if (bar==11){ 482 | value=octave; 483 | } else if (bar==13){ 484 | zmpitch=0; 485 | value=zmpitch; 486 | } else if (bar==14){ 487 | value=sync_state; 488 | } else if (bar==15){ 489 | value=selected_scale; 490 | } else { 491 | value=ROTvalue[selected_sound][bar]; 492 | } 493 | 494 | 495 | 496 | // Tamaño disponible para mostrar la barra: alto - ocupado por el borde- espacio arriba y abajo - dos filas de texto 20 497 | int bar_max_height=BPOS[qbar][3]-24; 498 | 499 | int nvalue=map(value,min_values[bar],max_values[bar],0,bar_max_height); 500 | if (nvalue==0) nvalue=1; 501 | if (bar>2){ 502 | // refresh bar 503 | gfx->fillRect(pos_x, pos_y, 5,bar_max_height-nvalue, OSCURO); 504 | gfx->fillRect(pos_x, pos_y+bar_max_height-nvalue, 5,nvalue, qcolor); 505 | } 506 | // mostrar valor 507 | if (bar==0) { 508 | pos_x=pos_x+18; 509 | gfx->fillRect(pos_x, pos_y+bar_max_height+8, ancho-30,10, BLACK); 510 | gfx->setCursor(pos_x,pos_y+bar_max_height+18); 511 | } else { 512 | pos_x=pos_x-6; 513 | gfx->fillRect(pos_x, pos_y+bar_max_height+1, ancho-4,10, BLACK); 514 | gfx->setCursor(pos_x,pos_y+bar_max_height+9); 515 | } 516 | gfx->setTextColor(qcolor, BLACK); 517 | gfx->print(F(value)); 518 | if (bar==0) { 519 | gfx->setCursor(pos_x+20,pos_y+bar_max_height+18); 520 | gfx->print(F(sound_names[ROTvalue[selected_sound][0]])); 521 | } 522 | 523 | if (bar<3) drawWaveform(); 524 | 525 | } 526 | 527 | 528 | 529 | void draw8aBar(){ 530 | for (byte f = 0; f < 8; f++) { 531 | drawBar(f); 532 | } 533 | } 534 | void draw8bBar(){ 535 | for (byte f = 8; f < 16; f++) { 536 | drawBar(f); 537 | } 538 | 539 | } 540 | 541 | 542 | void REFRESH_STATUS(){ 543 | 544 | int pos_x; 545 | int pos_y; 546 | 547 | // ticks: selected sound, pattern, soundset, memory 548 | if (selected_sound!=s_old_selected_sound) { 549 | pos_x=BPOS[s_old_selected_sound][0]+9; 550 | pos_y=BPOS[s_old_selected_sound][1]+BPOS[s_old_selected_sound][3]-20; 551 | gfx->drawBitmap(pos_x, pos_y, icon_off, 8, 8, OSCURO, BLACK); 552 | pos_x=BPOS[selected_sound][0]+9; 553 | pos_y=BPOS[selected_sound][1]+BPOS[selected_sound][3]-20; 554 | gfx->drawBitmap(pos_x, pos_y, icon_on, 8, 8, ZYELLOW, BLACK); 555 | s_old_selected_sound=selected_sound; 556 | } 557 | 558 | if (selected_pattern!=s_old_selected_pattern) { 559 | pos_x=BPOS[s_old_selected_pattern][0]+20; 560 | pos_y=BPOS[s_old_selected_pattern][1]+BPOS[s_old_selected_pattern][3]-20; 561 | gfx->drawBitmap(pos_x, pos_y, icon_off, 8, 8, OSCURO, BLACK); 562 | pos_x=BPOS[selected_pattern][0]+20; 563 | pos_y=BPOS[selected_pattern][1]+BPOS[selected_pattern][3]-20; 564 | gfx->drawBitmap(pos_x, pos_y, icon_on, 8, 8, GREEN, BLACK); 565 | s_old_selected_pattern=selected_pattern; 566 | } 567 | 568 | if (selected_sndSet!=s_old_selected_sndSet) { 569 | pos_x=BPOS[s_old_selected_sndSet][0]+31; 570 | pos_y=BPOS[s_old_selected_sndSet][1]+BPOS[s_old_selected_sndSet][3]-20; 571 | gfx->drawBitmap(pos_x, pos_y, icon_off, 8, 8, OSCURO, BLACK); 572 | pos_x=BPOS[selected_sndSet][0]+31; 573 | pos_y=BPOS[selected_sndSet][1]+BPOS[selected_sndSet][3]-20; 574 | gfx->drawBitmap(pos_x, pos_y, icon_on, 8, 8, ZBLUE, BLACK); 575 | s_old_selected_sndSet=selected_sndSet; 576 | } 577 | 578 | if (selected_memory!=s_old_selected_memory) { 579 | pos_x=BPOS[s_old_selected_memory][0]+42; 580 | pos_y=BPOS[s_old_selected_memory][1]+BPOS[s_old_selected_memory][3]-20; 581 | gfx->drawBitmap(pos_x, pos_y, icon_off, 8, 8, OSCURO, BLACK); 582 | pos_x=BPOS[selected_memory][0]+42; 583 | pos_y=BPOS[selected_memory][1]+BPOS[selected_memory][3]-20; 584 | gfx->drawBitmap(pos_x, pos_y, icon_on, 8, 8, MAGENTA, BLACK); 585 | s_old_selected_memory=selected_memory; 586 | } 587 | 588 | // selected rotary 589 | if (selected_rot!=s_old_selected_rot) { 590 | gfx->drawRect(BPOS[s_old_selected_rot+32][0], BPOS[s_old_selected_rot+32][1], BPOS[s_old_selected_rot+32][2]-1, BPOS[s_old_selected_rot+32][3]-1, DARKGREY); 591 | gfx->drawRect(BPOS[selected_rot+32][0], BPOS[selected_rot+32][1], BPOS[selected_rot+32][2]-1, BPOS[selected_rot+32][3]-1, ZYELLOW); 592 | s_old_selected_rot=selected_rot; 593 | } 594 | 595 | } 596 | 597 | 598 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 599 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 600 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 601 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 602 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 603 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 604 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 605 | 606 | 607 | void fillBPOS() { 608 | int pos_x; 609 | int pos_y; 610 | 611 | byte counter = 0; 612 | 613 | // 16 pad buttons 614 | int y_accumulated = Btop; 615 | for (byte r = 0; r < 2; r++) { 616 | int x_accumulated = Bleft; 617 | for (byte c = 0; c < 8; c++) { 618 | // x - left 619 | BPOS[counter][0] = x_accumulated; 620 | x_accumulated = x_accumulated+ BwidthPad; 621 | BPOS[counter][1] = y_accumulated; 622 | BPOS[counter][2] = BwidthPad; 623 | BPOS[counter][3] = BheightPad; 624 | counter++; 625 | } 626 | x_accumulated = 0; 627 | y_accumulated = y_accumulated + BheightPad; 628 | 629 | } 630 | 631 | // 8 func buttons 632 | pos_y=(BheightPad*2)+BheightBar; // 2 rows of pads + 1 row of bar 633 | pos_x=0; 634 | counter=16; 635 | for (int bb=0;bb<8;bb++){ 636 | pos_x=bb*BwidthFunc; 637 | BPOS[counter][0] = pos_x; 638 | BPOS[counter][1] = pos_y; 639 | BPOS[counter][2] = BwidthFunc; 640 | BPOS[counter][3] = BheightFunc; 641 | counter++; 642 | } 643 | 644 | // 8 norot buttons; 645 | pos_y=(BheightPad*2) + BheightFunc + BheightBar; // 3 rows of pads + 1 row of bar 646 | pos_x=0; 647 | counter=24; 648 | for (int bb=0;bb<8;bb++){ 649 | pos_x=bb*BwidthFunc; 650 | BPOS[counter][0] = pos_x; 651 | BPOS[counter][1] = pos_y; 652 | BPOS[counter][2] = BwidthNorot; 653 | BPOS[counter][3] = BheightNorot; 654 | counter++; 655 | } 656 | 657 | // 16 bars/columns 658 | pos_y=BheightPad*2; //two rows of pads 659 | pos_x=0; 660 | counter=32; 661 | BPOS[counter][0] = pos_x; 662 | BPOS[counter][1] = pos_y; 663 | BPOS[counter][2] = rot0_width; 664 | BPOS[counter][3] = rot0_height; 665 | counter++; 666 | BPOS[counter][0] = pos_x + rot0_width; 667 | BPOS[counter][1] = pos_y; 668 | BPOS[counter][2] = rot1_width; 669 | BPOS[counter][3] = rot1_height; 670 | counter++; 671 | BPOS[counter][0] = pos_x + rot0_width; 672 | BPOS[counter][1] = pos_y + rot1_height; 673 | BPOS[counter][2] = rot2_width; 674 | BPOS[counter][3] = rot2_height; 675 | counter++; 676 | 677 | for (int bar=3;bar<16;bar++){ 678 | pos_x=(bar*BwidthBar)+(120-BwidthBar); 679 | BPOS[counter][0] = pos_x; 680 | BPOS[counter][1] = pos_y; 681 | BPOS[counter][2] = BwidthBar; 682 | BPOS[counter][3] = BheightBar; 683 | counter++; 684 | } 685 | 686 | } 687 | 688 | void refresh_shift_key(){ 689 | int qcolor=DARKGREY; 690 | if (shifting) qcolor=ORANGE; 691 | 692 | drawBT(24, qcolor); 693 | drawBT(31, qcolor); 694 | } 695 | 696 | void drawWaveform() { 697 | 698 | gfx->fillRect(WAVE_ORIGIN_X, WAVE_ORIGIN_Y, WAVE_WIDTH, WAVE_HEIGHT, BLACK); 699 | gfx->drawRect(WAVE_ORIGIN_X, WAVE_ORIGIN_Y, WAVE_WIDTH, WAVE_HEIGHT, OSCURO); 700 | int16_t minVal = INT16_MAX; 701 | int16_t maxVal = INT16_MIN; 702 | 703 | // Encuentra el mínimo y máximo para normalizar 704 | for (size_t i = 0; i < ENDS[ROTvalue[selected_sound][0]]; i++) { 705 | if (SAMPLES[ROTvalue[selected_sound][0]][i] < minVal) minVal = SAMPLES[ROTvalue[selected_sound][0]][i]; 706 | if (SAMPLES[ROTvalue[selected_sound][0]][i] > maxVal) maxVal = SAMPLES[ROTvalue[selected_sound][0]][i]; 707 | } 708 | 709 | // Dibuja la forma de onda 710 | for (int x = 0; x < WAVE_WIDTH - 1; x++) { 711 | size_t index1 = map(x, 0, WAVE_WIDTH - 1, 0, ENDS[ROTvalue[selected_sound][0]] - 1); 712 | size_t index2 = map(x + 1, 0, WAVE_WIDTH - 1, 0, ENDS[ROTvalue[selected_sound][0]] - 1); 713 | 714 | int y1 = map(SAMPLES[ROTvalue[selected_sound][0]][index1], minVal, maxVal, WAVE_HEIGHT - 1, 0); 715 | int y2 = map(SAMPLES[ROTvalue[selected_sound][0]][index2], minVal, maxVal, WAVE_HEIGHT - 1, 0); 716 | 717 | gfx->drawLine(WAVE_ORIGIN_X + x, WAVE_ORIGIN_Y + y1, WAVE_ORIGIN_X + x + 1, WAVE_ORIGIN_Y + y2, ZCYAN); 718 | } 719 | // mostrar marca de inicio y de fin 720 | int xini = map(ROTvalue[selected_sound][1], min_values[1], max_values[1], 0, WAVE_WIDTH-1); 721 | int xfin = map(ROTvalue[selected_sound][2], min_values[2], max_values[2], 0, WAVE_WIDTH)-1; 722 | gfx->drawLine(WAVE_ORIGIN_X+xini, WAVE_ORIGIN_Y, WAVE_ORIGIN_X+xini, WAVE_ORIGIN_Y+WAVE_HEIGHT-1, ZGREEN); 723 | gfx->drawLine(WAVE_ORIGIN_X+xfin, WAVE_ORIGIN_Y, WAVE_ORIGIN_X+xfin, WAVE_ORIGIN_Y+WAVE_HEIGHT-1, ZRED); 724 | 725 | //setSound(selected_sound); 726 | 727 | } 728 | -------------------------------------------------------------------------------- /SOUNDS/zSAMPLE20.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Written by WAVToCode 3 | * Date: Sun Oct 20 12:24:39 AM 4 | * FileName: SAMPLE20.C 5 | * Interleaved: N/A 6 | * Signed: Yes 7 | * No. of channels: 1 8 | * No. of samples: 5330 9 | * Bits/Sample: 16 10 | **********************************************************************/ 11 | 12 | #define NUM_ELEMENTS 5330 13 | 14 | const int16_t SAMPLE20[] = { 15 | 0, 0, 3, 3, 4, 3, 4, 1, /* 0-7 */ 16 | 7, 4, 7, -3, 11, 7, 115, -155, /* 8-15 */ 17 | -20, 175, -125, 28, 0, -7, 44, 12, /* 16-23 */ 18 | 9, -22, 36, -3, 199, -115, -324, 226, /* 24-31 */ 19 | 49, 175, -261, 17, 353, 88, -668, -221, /* 32-39 */ 20 | 543, 310, -206, -278, 185, 225, -194, 139, /* 40-47 */ 21 | 180, -568, 372, -9, -624, 435, 591, 328, /* 48-55 */ 22 | -561, -419, -895, 581, 1328, 3, -1649, 283, /* 56-63 */ 23 | 1034, -416, -180, 177, 152, -88, -42, 36, /* 64-71 */ 24 | 31, -60, 85, 28, 556, -988, -321, 855, /* 72-79 */ 25 | 112, -234, -55, 359, 275, -1253, 261, 711, /* 80-87 */ 26 | -53, -215, 421, 101, -1161, 553, 52, 112, /* 88-95 */ 27 | 39, 45, -14, -26, 0, 74, -12, -50, /* 96-103 */ 28 | 562, 199, 244, -2204, -844, 3172, -76, -2155, /* 104-111 */ 29 | 755, 985, -188, -548, 185, 204, 163, 232, /* 112-119 */ 30 | -771, -492, 1787, 1229, -1616, -1169, -446, -1321, /* 120-127 */ 31 | 2191, 3363, -5315, 1250, 1887, -2117, 775, 692, /* 128-135 */ 32 | 580, -1378, 1935, 225, -3014, -662, 2183, 2697, /* 136-143 */ 33 | -751, -1955, -2015, 34, 3142, -732, -3765, 2413, /* 144-151 */ 34 | 2372, -790, -1039, 400, 381, -109, 2052, -3396, /* 152-159 */ 35 | -1031, 2622, 507, -968, -302, 462, 218, -337, /* 160-167 */ 36 | 638, -415, -1084, 1589, -551, 1714, 1218, -5786, /* 168-175 */ 37 | -1461, 4948, 318, -158, -442, -1370, 3583, -3933, /* 176-183 */ 38 | -870, 2505, 2014, -467, -4722, 2011, 1909, 1134, /* 184-191 */ 39 | 1291, -6198, -1085, 5247, 64, 250, -2399, 933, /* 192-199 */ 40 | 1584, -4211, 1529, 2093, -194, -1050, 239, 2472, /* 200-207 */ 41 | -3016, -1719, 2613, 678, -746, -484, 534, 20, /* 208-215 */ 42 | 296, -600, -80, 361, 177, -228, 706, -830, /* 216-223 */ 43 | -472, 652, 451, -477, 1608, -713, -3424, 2047, /* 224-231 */ 44 | 1673, 191, -2066, 155, 1269, -326, 1301, -2107, /* 232-239 */ 45 | -630, 2071, 2247, -1741, -580, -4318, -191, 5941, /* 240-247 */ 46 | 2361, -1004, -5456, -4802, 6155, 3917, -2245, -1402, /* 248-255 */ 47 | 668, 213, -664, 2364, 1090, -6445, 1383, 3261, /* 256-263 */ 48 | 131, -1586, 185, 527, -96, 115, 2423, -3134, /* 264-271 */ 49 | 568, 3196, -1212, -2767, 1464, -6488, 7423, 916, /* 272-279 */ 50 | -4299, -576, -4480, 7086, 2491, -1744, -1771, 1421, /* 280-287 */ 51 | 12, 6, -717, 895, -862, 3653, -3149, -4445, /* 288-295 */ 52 | 3930, 2087, -1584, 9, 4464, -2830, -6255, -649, /* 296-303 */ 53 | 6169, 963, -1931, -599, 1082, 139, 917, -2558, /* 304-311 */ 54 | 225, 1231, 2077, -2006, -1494, 2364, -1556, -2220, /* 312-319 */ 55 | 6772, 1494, -12382, 763, 9285, 2047, -7155, -2971, /* 320-327 */ 56 | 8315, -274, -6673, 1882, 3318, -524, -1107, 4399, /* 328-335 */ 57 | -6578, -1879, 5394, 439, -1426, -855, 1402, -641, /* 336-343 */ 58 | 1404, -1458, 2210, -1699, -3768, 7783, 1946, -11290, /* 344-351 */ 59 | -5135, 11287, 2982, -3741, -1968, 1971, 782, -811, /* 352-359 */ 60 | -183, -145, 5975, 811, -16570, 3486, 10241, -2047, /* 360-367 */ 61 | -2776, 725, 8648, -2538, -5789, -10590, 2006, 12143, /* 368-375 */ 62 | -91, -3871, -505, 2074, -72, -600, -286, 416, /* 376-383 */ 63 | 9, 20, -321, 2058, 5965, -12715, 3919, 6957, /* 384-391 */ 64 | -14861, 8455, 6125, -10978, 6290, -3987, -1263, 6133, /* 392-399 */ 65 | 1332, -3144, -1711, 3844, 288, -689, -580, -1505, /* 400-407 */ 66 | -1705, -3724, 10065, -5467, -2779, 4921, 1034, -1050, /* 408-415 */ 67 | 1351, -4054, 394, 2489, -175, -692, -148, 614, /* 416-423 */ 68 | -69, 5044, -5030, -6011, 2944, 4543, -405, -1939, /* 424-431 */ 69 | 465, 789, -294, -681, 1426, 6775, -2733, -9620, /* 432-439 */ 70 | -973, 5409, 1098, -4646, -1790, 7456, 394, -1998, /* 440-447 */ 71 | -1180, 1998, -156, -795, -267, 874, -1459, 7185, /* 448-455 */ 72 | 1106, -7434, -5843, 1313, 1616, 261, 2581, 1421, /* 456-463 */ 73 | -616, -641, 375, 95, -79, -251, 581, 5621, /* 464-471 */ 74 | -10022, -1716, 7185, 532, -2743, -213, 1353, 210, /* 472-479 */ 75 | -345, -1191, 725, 343, 1450, 6304, -9013, -9678, /* 480-487 */ 76 | 13256, 6307, -6006, -9886, -366, 5588, 5030, -2236, /* 488-495 */ 77 | -1190, 79, 2743, 6759, -9655, -11648, 9620, 7412, /* 496-503 */ 78 | -3356, -746, 7991, -3692, -19120, 5230, 14024, 527, /* 504-511 */ 79 | -5234, -5917, 12118, -6292, -6618, 5951, 3846, 4001, /* 512-519 */ 80 | 80, -9940, -5480, 2085, 1830, 7035, -1561, 131, /* 520-527 */ 81 | -2767, 1502, 263, 852, -2283, 4415, 5044, -5207, /* 528-535 */ 82 | -10347, -4337, 11891, 4440, -657, -8214, 1337, 4963, /* 536-543 */ 83 | -652, -1515, -614, 2103, -738, 6437, -3081, -16558, /* 544-551 */ 84 | 7911, 9003, -993, -5041, 6762, -5794, -5794, 7460, /* 552-559 */ 85 | 1252, 2451, 6444, -14083, -13847, 15945, 6922, 4783, /* 560-567 */ 86 | -15958, -4554, 11327, 5415, -925, -14297, 4358, 7496, /* 568-575 */ 87 | -467, -3518, -1245, 3328, -1402, 3117, -2829, -1689, /* 576-583 */ 88 | 10133, -2020, -15947, -4211, 15766, 3523, -6447, 2727, /* 584-591 */ 89 | 8900, -18582, -2871, 14065, 462, -1931, -4307, 8217, /* 592-599 */ 90 | -1935, -12474, 10187, 7022, -2092, -21806, 5854, 14807, /* 600-607 */ 91 | -326, -6691, 2125, 9301, -10209, -5707, 2206, 5114, /* 608-615 */ 92 | 1586, -2691, 256, 400, 705, -1210, 960, -1305, /* 616-623 */ 93 | 6047, 5258, -8567, -12842, 11614, 6231, -4339, -11244, /* 624-631 */ 94 | -2928, 16375, -1429, -5938, -5597, 18151, 1201, -22782, /* 632-639 */ 95 | 5055, 3998, 386, 4098, -340, -960, -64, -52, /* 640-647 */ 96 | 667, -1638, 8382, -3642, -16655, 16119, -2325, -4713, /* 648-655 */ 97 | 2218, 5391, -2672, 4680, -9064, -6366, 10612, 6450, /* 656-663 */ 98 | 3878, -15655, -12292, 14081, 9087, -5155, -3650, 2179, /* 664-671 */ 99 | 1480, -782, -790, 703, -272, 2393, 7910, -4694, /* 672-679 */ 100 | -6371, -1737, 1109, -14232, 5472, 14718, -4, -5567, /* 680-687 */ 101 | 294, 1943, 416, 3180, 7667, -20901, 91, 11571, /* 688-695 */ 102 | -5935, 2611, -1681, 5608, -3944, -2304, 2117, 1730, /* 696-703 */ 103 | -473, -1031, 1933, 5087, -6569, -9157, 8258, 4052, /* 704-711 */ 104 | -3393, -194, 8672, -7900, -10480, 10333, 2874, -2551, /* 712-719 */ 105 | -862, -1310, 2535, -20, -158, -768, 998, -679, /* 720-727 */ 106 | 795, -1462, 4304, 4802, -4173, -18191, 7024, 12298, /* 728-735 */ 107 | -3478, -4046, 4448, 521, -5621, 1256, 7995, -2762, /* 736-743 */ 108 | -11881, 8388, 11680, -15067, -6721, 12978, 8198, 1393, /* 744-751 */ 109 | -22690, -8304, 21026, 7068, -11851, -369, 3569, 4572, /* 752-759 */ 110 | -4881, 1123, -3459, -1763, 5387, 353, -1800, -277, /* 760-767 */ 111 | 1136, 9076, -13649, -5776, 11003, 1955, -2874, -1862, /* 768-775 */ 112 | 2325, -240, -20, -979, 8548, 4218, -14994, -17864, /* 776-783 */ 113 | 14682, 13823, -4806, -5811, 2318, 2138, -443, -1659, /* 784-791 */ 114 | 1242, -1053, 6011, -5082, -7268, 6643, 2890, -2031, /* 792-799 */ 115 | -546, 1041, -2012, 1897, -1576, 784, -52, 2073, /* 800-807 */ 116 | 3768, -11986, 9613, 4071, -6922, -12943, 9206, 15162, /* 808-815 */ 117 | -14192, -3340, 2363, 5813, -1120, -1214, -274, 1410, /* 816-823 */ 118 | -678, 424, -1375, 9544, 2332, -23516, -2881, 18506, /* 824-831 */ 119 | 2719, -6038, 2770, 1567, 2344, -17639, 1294, 13769, /* 832-839 */ 120 | 451, -5084, -656, 1569, 2922, 9279, -8959, -14406, /* 840-847 */ 121 | -397, 26326, -10384, -8970, 6570, 719, 1212, -7938, /* 848-855 */ 122 | -12531, 6802, 14609, 187, -5447, 4680, -1743, -7764, /* 856-863 */ 123 | 14790, 3787, -13357, -671, -10285, -6355, 18075, 3539, /* 864-871 */ 124 | -3101, -2069, 2412, 76, -698, -402, 400, -263, /* 872-879 */ 125 | 77, -61, 134, -74, -188, 137, 0, 299, /* 880-887 */ 126 | -532, 350, -204, 2336, -2756, 6252, 7463, -13473, /* 888-895 */ 127 | -7913, -1954, 3756, 5678, 8250, -7851, 8488, -1675, /* 896-903 */ 128 | -3085, -11894, -3871, 23667, -4404, -24629, 825, 24131, /* 904-911 */ 129 | 101, -7943, -603, 2550, 23, -765, 139, -271, /* 912-919 */ 130 | 851, -1516, 11073, -1111, -9929, -20711, 22408, 12084, /* 920-927 */ 131 | -24370, 6263, 4413, 4188, 621, -8418, -1827, 12935, /* 928-935 */ 132 | -1718, -13081, 4412, 6954, -1355, 5407, -12775, -2451, /* 936-943 */ 133 | 10279, 362, -2768, -1765, 3009, -1803, 5440, -839, /* 944-951 */ 134 | -13008, 6740, 4754, 2662, 8650, -11797, -3678, -8669, /* 952-959 */ 135 | -4456, 13433, 6781, -2932, -3350, -424, 3494, -2092, /* 960-967 */ 136 | 6146, -3285, -2646, -481, -736, 3976, -10013, 1619, /* 968-975 */ 137 | 6659, 6279, -7368, -5315, 5415, 3210, -3283, 3405, /* 976-983 */ 138 | 8095, -3940, -12265, -7437, 20121, -575, -16289, -8255, /* 984-991 */ 139 | 12582, 13812, -3133, -12840, 4044, 7293, 7287, -16208, /* 992-999 */ 140 | 228, 738, 5166, -909, 5169, -4749, -889, -2649, /* 1000-1007 */ 141 | 1833, 9279, -17869, 3531, 8783, 1329, -4268, -2437, /* 1008-1015 */ 142 | 2752, 1229, -916, -1137, 1185, -454, 941, -2090, /* 1016-1023 */ 143 | 7629, 2600, -23014, 6499, 12324, -1313, -5407, 981, /* 1024-1031 */ 144 | 2044, -337, -885, -57, 1364, 10463, -4906, -22068, /* 1032-1039 */ 145 | 3126, 18544, -2041, -6507, 714, 3466, -993, 88, /* 1040-1047 */ 146 | 12135, -4426, -27676, 10306, 13311, -4925, -954, 6429, /* 1048-1055 */ 147 | 2895, -19517, 10182, 5135, 7853, -7637, -9385, 12, /* 1056-1063 */ 148 | -7005, 12368, 16980, -14422, -21067, 14619, 14024, -1177, /* 1064-1071 */ 149 | -19338, 7338, 5794, -374, -3451, 1309, 494, 320, /* 1072-1079 */ 150 | -1242, 3222, -3144, -1884, 2210, 820, 5833, 6055, /* 1080-1087 */ 151 | -12802, -5824, -3261, -2729, 12604, 5477, 294, -2806, /* 1088-1095 */ 152 | -11699, -183, 11517, 153, -3599, -870, 2069, -58, /* 1096-1103 */ 153 | -923, 2540, 13011, -8764, -7315, -15107, -4494, 22678, /* 1104-1111 */ 154 | 5163, -7090, -3071, 3184, 1678, 15, -3947, -492, /* 1112-1119 */ 155 | 4642, -2453, 9702, 3157, -12503, -12333, 15505, -10767, /* 1120-1127 */ 156 | -13311, 20903, 7518, -6228, -4450, 15790, -8290, -4775, /* 1128-1135 */ 157 | 6371, -18779, -8010, 22272, 6166, -7442, -3326, 3800, /* 1136-1143 */ 158 | 657, -1012, -1061, 1279, -938, 1513, 9545, -1679, /* 1144-1151 */ 159 | -8319, -1166, -11851, -10507, 28656, 17655, -29518, -20353, /* 1152-1159 */ 160 | 25557, 11409, -10119, -5101, 4911, 1567, -1510, -1464, /* 1160-1167 */ 161 | 1299, -221, 581, -467, -1144, 120, 1752, 377, /* 1168-1175 */ 162 | 6461, -2946, -22497, 22454, 7409, -25846, 1802, 18451, /* 1176-1183 */ 163 | 1418, -14325, 1177, 12379, -540, -6150, 3814, -13611, /* 1184-1191 */ 164 | -5475, 16035, 4841, -7208, 4583, 12495, -28255, -4810, /* 1192-1199 */ 165 | 20524, 3063, -7372, -2087, 3995, -201, -467, -1408, /* 1200-1207 */ 166 | 1946, -1578, 13737, -1534, -11228, -8894, 7797, 1760, /* 1208-1215 */ 167 | -996, -20711, 17452, 11870, -13474, 3131, -5971, 16738, /* 1216-1223 */ 168 | -11515, -2117, 19736, -15493, -17074, 16484, 5637, 7445, /* 1224-1231 */ 169 | -11894, -11675, 10312, 106, -82, 990, 1286, 936, /* 1232-1239 */ 170 | -3795, -616, 3648, 6512, -13086, -2554, 10341, -1215, /* 1240-1247 */ 171 | 3149, -4634, -7439, 6829, 3938, -521, -6531, 1473, /* 1248-1255 */ 172 | 3857, -1288, 1529, 7171, -17790, 7773, 163, -2534, /* 1256-1263 */ 173 | 3599, 992, -554, -825, 624, 1977, -3146, -1291, /* 1264-1271 */ 174 | 11305, 3415, -11251, -4635, -18773, 7517, 21209, 1388, /* 1272-1279 */ 175 | -11694, 1068, 3163, 7155, -3992, 423, -7765, 8336, /* 1280-1287 */ 176 | 1951, -14535, -4401, 15991, -6266, -4749, 19975, -223, /* 1288-1295 */ 177 | -24291, -16623, 28467, 10414, -9342, -5258, 4415, 1914, /* 1296-1303 */ 178 | -2174, -264, -69, 2740, -3298, 2101, 11503, -15828, /* 1304-1311 */ 179 | 5171, 1153, -25651, 9854, 18375, 4694, -6700, -18286, /* 1312-1319 */ 180 | 11409, 7643, -2790, -4605, 2426, 532, 10927, 2695, /* 1320-1327 */ 181 | -15273, -1481, -12048, -7244, 23895, 5770, -7811, -2992, /* 1328-1335 */ 182 | 4063, 484, -1107, 34, -1413, 641, 399, 597, /* 1336-1343 */ 183 | -348, -1361, 236, 11488, 1730, -13070, -18601, 2730, /* 1344-1351 */ 184 | 23824, 9927, -19416, -11636, 22825, 1616, -32767, 8502, /* 1352-1359 */ 185 | 20525, -687, -9721, 2028, 1442, 3867, 122, -5295, /* 1360-1367 */ 186 | -1977, -3443, 7567, 1293, 6187, -14116, -3585, 13165, /* 1368-1375 */ 187 | -1397, 3150, -545, -2359, -692, -7141, -14230, 10458, /* 1376-1383 */ 188 | 14552, -1832, -6815, 5786, 13481, -12129, -10113, -12065, /* 1384-1391 */ 189 | 8075, 13019, 3146, -1542, -13985, 6694, 4531, 11786, /* 1392-1399 */ 190 | -16268, -13298, 14967, 5697, -4642, -1584, 15825, -3196, /* 1400-1407 */ 191 | -19389, -18701, 21461, 13119, -6591, -4494, 1355, 13222, /* 1408-1415 */ 192 | -977, -31960, 14666, 16546, -10319, -3033, 9629, -4921, /* 1416-1423 */ 193 | -13590, 9293, 7279, -3776, 548, 3630, -12853, 7536, /* 1424-1431 */ 194 | 3380, -5396, 976, 1985, 477, -1919, 1111, -1271, /* 1432-1439 */ 195 | 5055, 497, -1535, -9761, -3489, 11274, 3288, 2681, /* 1440-1447 */ 196 | -12555, -15, 5648, 1380, -2112, 551, -511, 5215, /* 1448-1455 */ 197 | -3209, -2144, -5575, 18498, -11669, -18834, 16471, 7781, /* 1456-1463 */ 198 | -4239, -5507, 9609, 4927, -11263, -17977, 12192, 12932, /* 1464-1471 */ 199 | -4290, -4602, 1508, 10640, -12452, -9438, 12143, 3144, /* 1472-1479 */ 200 | -2581, -3781, 5478, 242, -5429, 7133, 2654, -8033, /* 1480-1487 */ 201 | -5488, -3136, 3567, 8334, -931, -2195, -55, 1340, /* 1488-1495 */ 202 | 8041, -13162, -4520, 9981, 4193, -6047, -3756, 4851, /* 1496-1503 */ 203 | 1009, -1727, 1171, 53, -5163, 4461, -741, 4163, /* 1504-1511 */ 204 | 1505, -6244, -5730, 2949, 7420, -7407, 1771, 2285, /* 1512-1519 */ 205 | 695, -1938, 513, 112, 443, -863, 456, 123, /* 1520-1527 */ 206 | 9564, -9249, -11140, 16325, -1550, -16397, 5301, 10591, /* 1528-1535 */ 207 | -1144, -3892, 874, 9209, -1955, -8661, -9875, 630, /* 1536-1543 */ 208 | 13964, 614, -4358, -1305, 4039, 6800, -14779, -3069, /* 1544-1551 */ 209 | 13122, -1611, -7003, 7220, -1386, -2832, 10453, -11853, /* 1552-1559 */ 210 | -11767, 10228, 11970, -3458, -9726, 5764, -3079, 4212, /* 1560-1567 */ 211 | -4239, -511, 3532, 201, -375, 4551, -9699, -484, /* 1568-1575 */ 212 | 6344, 198, -2332, -326, 1180, -183, -240, -297, /* 1576-1583 */ 213 | 423, -42, 5117, 228, -5260, -2410, -3638, 6539, /* 1584-1591 */ 214 | 2833, -9018, -6626, 13490, 3318, -2377, -2066, -6112, /* 1592-1599 */ 215 | 2445, 4030, 714, -2280, 385, -82, 836, -1218, /* 1600-1607 */ 216 | 1125, 202, 3453, -911, -2405, -6737, -1713, 7163, /* 1608-1615 */ 217 | 3930, 1060, -5106, -5949, -2722, 10081, 4849, -2681, /* 1616-1623 */ 218 | -10007, 789, 6925, 1027, -3207, 210, 2481, -3060, /* 1624-1631 */ 219 | -1104, 2307, 128, -370, -263, -508, 250, 288, /* 1632-1639 */ 220 | -242, 33, -320, 2061, 2098, -4765, -4710, 3033, /* 1640-1647 */ 221 | 4678, -633, -3185, -594, 3982, 1564, -7621, 1229, /* 1648-1655 */ 222 | 4103, -259, -1732, 107, 402, 80, -229, -39, /* 1656-1663 */ 223 | 36, -50, -112, -9, 49, -47, -77, -50, /* 1664-1671 */ 224 | 120, 33, -302, 2044, -1172, -4434, 4421, 1470, /* 1672-1679 */ 225 | 218, -3976, -535, 1394, 2022, -635, -4819, 3321, /* 1680-1687 */ 226 | -627, 1939, -1814, -844, 1565, 782, -459, -513, /* 1688-1695 */ 227 | 348, -36, 643, 741, -3504, 335, 2020, 6, /* 1696-1703 */ 228 | -809, -82, 549, 1570, 47, -1559, -5063, 1597, /* 1704-1711 */ 229 | 5407, 1402, -5583, -283, 464, -172, 2168, -508, /* 1712-1719 */ 230 | -52, -687, 2538, 288, -2033, -2814, -1719, 3489, /* 1720-1727 */ 231 | 2237, 947, -2231, -3464, 145, 3407, 218, -1234, /* 1728-1735 */ 232 | -221, 499, 71, -302, -104, 20, 99, -198, /* 1736-1743 */ 233 | 123, -83, 85, 64, -879, 240, 659, 1207, /* 1744-1751 */ 234 | -467, -2589, -1453, 2767, 1007, -1039, -347, 182, /* 1752-1759 */ 235 | 784, 248, -2250, 177, 2111, -561, -1679, 692, /* 1760-1767 */ 236 | 1990, -553, -3394, 738, 2201, 251, -1992, 299, /* 1768-1775 */ 237 | 811, 82, -603, 85, 66, 122, -381, 671, /* 1776-1783 */ 238 | 738, -611, -2456, -191, 2191, 852, -1272, -1063, /* 1784-1791 */ 239 | 1066, 316, -194, -391, -44, 223, -104, 654, /* 1792-1799 */ 240 | 389, -2535, 264, 1673, 542, -1889, -91, 919, /* 1800-1807 */ 241 | 118, -427, 120, -278, 1017, -716, -1462, 1058, /* 1808-1815 */ 242 | 619, -432, -366, 259, 61, -125, -185, 137, /* 1816-1823 */ 243 | 15, -109, -122, 96, -53, 19, -22, 275, /* 1824-1831 */ 244 | -348, -448, 199, 719, -17, -1309, -194, 871, /* 1832-1839 */ 245 | 453, -543, -359, 419, 66, -355, 17, 107, /* 1840-1847 */ 246 | -17, -63, -45, 69, 110, -478, 1, 223, /* 1848-1855 */ 247 | -12, -109, -28, 6, -26, -41, -25, 58, /* 1856-1863 */ 248 | -110, 166, -348, -88, 247, -47, -91, 202, /* 1864-1871 */ 249 | -210, -244, 72, 156, -30, 329, -481, -448, /* 1872-1879 */ 250 | 426, 150, -118, -85, -1, 302, -370, -337, /* 1880-1887 */ 251 | 367, 45, -72, -106, -23, 17, 22, -60, /* 1888-1895 */ 252 | -26, -9, 44, -115, 9, -1, -114, 31, /* 1896-1903 */ 253 | 9, -12, -50, -12, -23, 61, -103, -69, /* 1904-1911 */ 254 | 28, 267, -213, -400, 163, 85, 134, -74, /* 1912-1919 */ 255 | -106, -362, -9, 573, -215, -402, 145, 188, /* 1920-1927 */ 256 | -22, -177, 161, -7, -410, 215, 126, -237, /* 1928-1935 */ 257 | -112, 69, 77, -36, -33, -34, 1, -20, /* 1936-1943 */ 258 | -23, -20, -20, -28, -12, -19, -26, -15, /* 1944-1951 */ 259 | -15, -17, -25, -12, -28, 25, -42, -91, /* 1952-1959 */ 260 | 6, 1, -9, -36, -19, -23, -12, -20, /* 1960-1967 */ 261 | -26, -31, 0, -23, -36, -23, -26, -9, /* 1968-1975 */ 262 | -20, -20, -23, -17, 17, -80, -44, 11, /* 1976-1983 */ 263 | -9, -23, -28, -14, -22, -19, -22, -9, /* 1984-1991 */ 264 | -30, 12, -9, -80, -23, -1, -11, -17, /* 1992-1999 */ 265 | -14, -17, -17, -20, -15, -17, -17, -17, /* 2000-2007 */ 266 | -15, -20, -17, -17, -14, 4, -58, -17, /* 2008-2015 */ 267 | -11, -25, -12, -15, -17, -22, -19, -19, /* 2016-2023 */ 268 | -19, -20, -20, -19, -19, -22, -17, -20, /* 2024-2031 */ 269 | -20, -22, -14, -7, -45, -28, -12, -15, /* 2032-2039 */ 270 | -20, -22, -20, -20, -20, -20, -20, -20, /* 2040-2047 */ 271 | -20, -20, -17, -17, -25, -20, -19, -17, /* 2048-2055 */ 272 | -19, -19, -20, -19, -19, -19, -17, -17, /* 2056-2063 */ 273 | -17, -17, -17, -15, -17, -17, -15, -15, /* 2064-2071 */ 274 | -17, -15, -15, -15, -15, -17, -12, -17, /* 2072-2079 */ 275 | -17, -12, -17, -15, -15, -15, -15, -12, /* 2080-2087 */ 276 | -20, -17, -15, -15, -15, -15, -15, -15, /* 2088-2095 */ 277 | -12, -19, -17, -15, -15, -17, -12, -17, /* 2096-2103 */ 278 | -20, -15, -15, -15, -15, -15, -15, -15, /* 2104-2111 */ 279 | -15, -15, -15, -15, -14, -15, -15, -15, /* 2112-2119 */ 280 | -17, -17, -17, -17, -17, -15, -17, -17, /* 2120-2127 */ 281 | -17, -17, -20, -12, -17, -23, -17, -15, /* 2128-2135 */ 282 | -15, -17, -15, -15, -15, -15, -15, -15, /* 2136-2143 */ 283 | -15, -15, -15, -15, -14, -15, -14, -14, /* 2144-2151 */ 284 | -12, -14, -14, -14, -14, -12, -12, -12, /* 2152-2159 */ 285 | -14, -12, -14, -12, -12, -12, -14, -14, /* 2160-2167 */ 286 | -14, -14, -14, -14, -14, -12, -14, -15, /* 2168-2175 */ 287 | -14, -12, -12, -12, -12, -12, -12, -12, /* 2176-2183 */ 288 | -12, -12, -12, -11, -12, -12, -12, -12, /* 2184-2191 */ 289 | -12, -12, -12, -12, -12, -11, -15, -12, /* 2192-2199 */ 290 | -11, -15, -12, -12, -12, -14, -14, -14, /* 2200-2207 */ 291 | -14, -14, -12, -12, -12, -12, -14, -14, /* 2208-2215 */ 292 | -14, -14, -14, -14, -14, -14, -14, -14, /* 2216-2223 */ 293 | -14, -14, -14, -15, -14, -15, -15, -15, /* 2224-2231 */ 294 | -15, -15, -15, -15, -15, -12, -15, -15, /* 2232-2239 */ 295 | -15, -15, -15, -14, -15, -12, -14, -14, /* 2240-2247 */ 296 | -14, -12, -12, -12, -14, -9, -12, -14, /* 2248-2255 */ 297 | -12, -12, -12, -12, -12, -12, -11, -11, /* 2256-2263 */ 298 | -12, -12, -12, -12, -11, -11, -11, -11, /* 2264-2271 */ 299 | -11, -11, -11, -11, -12, -11, -11, -11, /* 2272-2279 */ 300 | -12, -12, -12, -12, -12, -12, -12, -12, /* 2280-2287 */ 301 | -11, -12, -11, -11, -11, -9, -9, -9, /* 2288-2295 */ 302 | -9, -9, -9, -9, -9, -9, -9, -9, /* 2296-2303 */ 303 | -9, -7, -7, -7, -7, -9, -7, -7, /* 2304-2311 */ 304 | -7, -7, -7, -7, -7, -7, -9, -9, /* 2312-2319 */ 305 | -9, -9, -9, -4, -9, -12, -7, -9, /* 2320-2327 */ 306 | -7, -9, -9, -7, -9, -7, -7, -7, /* 2328-2335 */ 307 | -7, -7, -7, -7, -7, -7, -6, -6, /* 2336-2343 */ 308 | -7, -6, -4, -6, -6, -6, -6, -6, /* 2344-2351 */ 309 | -6, -6, -4, -4, -4, -4, -4, -4, /* 2352-2359 */ 310 | -4, -4, -4, -4, -4, -4, -4, -3, /* 2360-2367 */ 311 | -3, -6, -4, -4, -4, -4, -4, -4, /* 2368-2375 */ 312 | -4, -6, -6, -6, -6, -4, -4, -4, /* 2376-2383 */ 313 | -6, -6, -4, -4, -4, -4, -4, -4, /* 2384-2391 */ 314 | -4, -4, -3, -3, -1, -3, -1, -1, /* 2392-2399 */ 315 | -3, 0, -1, -1, -1, -1, -1, -1, /* 2400-2407 */ 316 | -1, -1, 0, 0, -1, -1, 0, -1, /* 2408-2415 */ 317 | 0, 0, -1, 0, -1, 0, -1, 0, /* 2416-2423 */ 318 | 0, -1, -1, -1, -1, -1, -1, -1, /* 2424-2431 */ 319 | -1, 0, 0, -3, -1, -1, -1, -1, /* 2432-2439 */ 320 | -1, -1, -1, -1, -1, -1, -1, -1, /* 2440-2447 */ 321 | -1, -1, -1, -1, -1, -1, -1, -1, /* 2448-2455 */ 322 | -1, -1, 0, -1, 0, 0, 0, 0, /* 2456-2463 */ 323 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2464-2471 */ 324 | 0, 0, 0, 0, 0, 1, 1, 1, /* 2472-2479 */ 325 | 1, 1, 1, 1, 1, 1, 1, 1, /* 2480-2487 */ 326 | 1, 0, 4, 3, 1, 1, 1, 1, /* 2488-2495 */ 327 | 0, 1, 3, 1, 0, 0, 0, 1, /* 2496-2503 */ 328 | 1, 0, 0, 0, 0, 0, 1, 0, /* 2504-2511 */ 329 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2512-2519 */ 330 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2520-2527 */ 331 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2528-2535 */ 332 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2536-2543 */ 333 | 1, 0, 0, 0, 0, 0, 0, 1, /* 2544-2551 */ 334 | 0, 0, 0, 0, 0, 0, 1, 1, /* 2552-2559 */ 335 | 3, 3, 3, 3, 3, 3, 3, 4, /* 2560-2567 */ 336 | 4, 3, 3, 3, 3, 4, 4, 6, /* 2568-2575 */ 337 | 4, 3, 4, 4, 3, 1, 3, 3, /* 2576-2583 */ 338 | 3, 3, 3, 3, 3, 3, 1, 1, /* 2584-2591 */ 339 | 1, 3, 1, 1, 1, 1, 1, 1, /* 2592-2599 */ 340 | 1, 1, 1, 1, 1, 1, 1, 1, /* 2600-2607 */ 341 | 0, 0, 1, 1, 0, 0, 1, 1, /* 2608-2615 */ 342 | 1, 1, 1, 1, 1, 1, 1, 1, /* 2616-2623 */ 343 | 1, 1, 1, 1, 3, 1, 1, 3, /* 2624-2631 */ 344 | 1, 1, 1, 1, 1, 1, 1, 3, /* 2632-2639 */ 345 | 1, 1, 1, 3, 3, 1, 3, 3, /* 2640-2647 */ 346 | 3, 3, 3, 3, 3, 1, 3, 1, /* 2648-2655 */ 347 | 3, 3, 3, 3, 3, 3, 1, 1, /* 2656-2663 */ 348 | 1, 3, 3, 3, 3, 4, 3, 3, /* 2664-2671 */ 349 | 3, 3, 3, 3, 3, 1, 1, 3, /* 2672-2679 */ 350 | 1, 1, 1, 1, 1, 1, 1, 1, /* 2680-2687 */ 351 | 1, 1, 1, 1, 1, 1, 1, 1, /* 2688-2695 */ 352 | 1, 1, 1, 1, 1, 1, 0, 0, /* 2696-2703 */ 353 | 1, 1, 1, 1, 1, 1, 1, 1, /* 2704-2711 */ 354 | 1, 1, 1, 1, 1, 1, 1, 1, /* 2712-2719 */ 355 | 1, 1, 1, 1, 4, 1, 1, 1, /* 2720-2727 */ 356 | 1, 1, 1, 1, 0, 0, 0, 0, /* 2728-2735 */ 357 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2736-2743 */ 358 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2744-2751 */ 359 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2752-2759 */ 360 | 0, 1, 1, 0, 0, 1, 1, 0, /* 2760-2767 */ 361 | 1, 1, 1, 1, 0, 0, 0, 0, /* 2768-2775 */ 362 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2776-2783 */ 363 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2784-2791 */ 364 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2792-2799 */ 365 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2800-2807 */ 366 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2808-2815 */ 367 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2816-2823 */ 368 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2824-2831 */ 369 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2832-2839 */ 370 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2840-2847 */ 371 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2848-2855 */ 372 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2856-2863 */ 373 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2864-2871 */ 374 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2872-2879 */ 375 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2880-2887 */ 376 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2888-2895 */ 377 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2896-2903 */ 378 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2904-2911 */ 379 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2912-2919 */ 380 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2920-2927 */ 381 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2928-2935 */ 382 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2936-2943 */ 383 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2944-2951 */ 384 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2952-2959 */ 385 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2960-2967 */ 386 | 1, 0, 0, 0, 0, 0, 0, 0, /* 2968-2975 */ 387 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2976-2983 */ 388 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2984-2991 */ 389 | 0, 0, 0, 0, 0, 0, 0, 0, /* 2992-2999 */ 390 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3000-3007 */ 391 | 0, 0, -1, -1, 0, -1, -1, -1, /* 3008-3015 */ 392 | -1, -1, 0, -1, -1, 0, 0, -1, /* 3016-3023 */ 393 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3024-3031 */ 394 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3032-3039 */ 395 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3040-3047 */ 396 | 0, 0, -1, 0, -1, -1, -1, -1, /* 3048-3055 */ 397 | -1, -1, -1, -1, -1, -1, 0, 0, /* 3056-3063 */ 398 | 0, 0, 0, 0, -1, 0, -1, -1, /* 3064-3071 */ 399 | -1, -1, -1, -1, -1, -1, -1, -1, /* 3072-3079 */ 400 | -1, -1, -1, -1, -1, -1, -1, -1, /* 3080-3087 */ 401 | -1, -1, -1, -1, -1, -1, -1, -1, /* 3088-3095 */ 402 | -1, -1, -1, -1, -1, -1, -3, -1, /* 3096-3103 */ 403 | -3, -3, -3, -3, -3, -3, -3, -3, /* 3104-3111 */ 404 | -3, -3, -3, -3, -3, -3, -3, -3, /* 3112-3119 */ 405 | -3, -3, -3, -3, -3, -3, -3, -3, /* 3120-3127 */ 406 | -3, -3, -3, -3, -3, -1, -1, -1, /* 3128-3135 */ 407 | -1, -1, -1, -1, -1, -1, -1, -3, /* 3136-3143 */ 408 | -1, -1, -1, -1, -1, -1, -3, -3, /* 3144-3151 */ 409 | -3, -3, -3, -3, -3, -3, -3, -3, /* 3152-3159 */ 410 | -3, -4, -4, -4, -4, -4, -4, -4, /* 3160-3167 */ 411 | -4, -4, -3, -3, -3, -3, -1, -1, /* 3168-3175 */ 412 | -1, -1, -1, -1, -1, -1, -1, -1, /* 3176-3183 */ 413 | -1, -1, -1, -1, 0, 0, 0, 0, /* 3184-3191 */ 414 | -1, 0, -1, -1, -1, -1, -1, -1, /* 3192-3199 */ 415 | -1, -1, 0, 0, -1, -1, -1, -1, /* 3200-3207 */ 416 | 0, -1, 0, 0, 0, 0, 0, 0, /* 3208-3215 */ 417 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3216-3223 */ 418 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3224-3231 */ 419 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3232-3239 */ 420 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3240-3247 */ 421 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3248-3255 */ 422 | 0, -1, 0, 0, -1, -1, -1, 0, /* 3256-3263 */ 423 | -1, -1, -1, 0, -1, -1, 0, 0, /* 3264-3271 */ 424 | 0, 0, 0, 0, 0, 0, 0, 0, /* 3272-3279 */ 425 | }; /* 5328-5329 */ 426 | -------------------------------------------------------------------------------- /DRUM_2025_VSAMPLER.ino: -------------------------------------------------------------------------------- 1 | //////////////////////////// 2 | // DRUM SAMPLER 2025 // 3 | //////////////////////////// 4 | // ZCARLOS 2025 5 | // V002 beta 6 | 7 | // Lots of bugs 8 | 9 | // includes 10 | #include 11 | 12 | //#define TESTING 1 13 | 14 | //#define mylcd_type1 15 | #define mylcd_type2 16 | // if you don't have a ADS1115 and rotary comment next line 17 | //#define ads_ok 18 | 19 | 20 | int32_t muestra; 21 | #define SAMPLE_RATE 44100 // Frecuencia de muestreo (44.1 kHz) 22 | 23 | ////////////////////////////// MIDI BLE 24 | //#include 25 | 26 | ////////////////////////////// WIRE I2C 27 | #include 28 | 29 | ////////////////////////////// SD SPI 30 | // SD 31 | #include 32 | #include 33 | // Pines SPI para la tarjeta SD 34 | #define SD_CS 10 // Chip Select (CS) 35 | #define SD_MOSI 11 // Master Out Slave In (MOSI) 36 | #define SD_MISO 13 // Master In Slave Out (MISO) 37 | #define SD_SCLK 12 // Serial Clock (SCLK) 38 | #define MAX_SOUNDS 128 // Número máximo de archivos WAV a listar 39 | SPIClass sdSPI(HSPI); // SPI BUS for SD 40 | // Array para almacenar los nombres de los archivos WAV 41 | //String soundFiles[MAX_SOUNDS]; 42 | 43 | /////////////////////////////// I2C POTS ADS1015 44 | #include 45 | #ifdef mylcd_type1 46 | #define SDA_2 15 47 | #define SCL_2 16 48 | #endif 49 | #ifdef mylcd_type2 50 | #define SDA_2 17 51 | #define SCL_2 18 52 | #endif 53 | 54 | TwoWire I2C_2 = TwoWire(1); // 2nd I2C port 55 | Adafruit_ADS1015 ads; 56 | int16_t adc0=0; 57 | int16_t adc1=0; 58 | int16_t adc2=0; 59 | int16_t adc3=0; 60 | int16_t tmp_adc1; 61 | int16_t old_adc0=0; 62 | int16_t old_adc1=0; 63 | int16_t old_adc2=0; 64 | int16_t old_adc3=0; 65 | 66 | unsigned long previousMillis = 0; 67 | const long interval = 100; 68 | 69 | int16_t adcValue0 = 0; 70 | int16_t adcValue1 = 0; 71 | int16_t adcValue2 = 0; 72 | int16_t adcValue3 = 0; 73 | 74 | ////////////////////////////// SPIFFS 75 | #include 76 | #include 77 | 78 | 79 | ////////////////////////////// SYNTH 80 | //#define SAMPLE_RATE 44100 81 | #include "driver/i2s.h" 82 | #include "synthESP32LowPassFilter_E.h" // filter 83 | #define MAX_16 32767 84 | #define MIN_16 -32767 85 | 86 | ////////////////////////////// TEXTS 87 | const String trot[16] = { "SAM", "INI", "END", "PIT", "RVS", "VOL", "PAN", "FIL", "BPM","MVO","TRP","MFI","OCT","MPI","SYN","SCA"}; 88 | const String tbuttons1[8] = {" PAD ", " RND P ", " LOAD PS ", " SAVE PS ", " MUTE ", " PIANO ", " PLAY ", " SONG "}; 89 | const String tbuttons2[8] = {" SHIFT ", " - 1 ", " - 10 ", " + 10 ", " + 1 ", " ", " ", " SHIFT "}; 90 | 91 | ////////////////////////////// LCD 92 | #include 93 | #include 94 | #define GFX_DEV_DEVICE ESP32_4827A043_QSPI 95 | #define GFX_BL 1 96 | Arduino_DataBus *bus = new Arduino_ESP32QSPI(45 /* cs */, 47 /* sck */, 21 /* d0 */, 48 /* d1 */, 40 /* d2 */, 39 /* d3 */); 97 | //Arduino_DataBus *bus = new Arduino_ESP32SPI(TFT_DC, TFT_CS, TFT_SCK /* SCK */, TFT_MOSI /* MOSI */, GFX_NOT_DEFINED /* MISO */, HSPI /* spi_num */); 98 | // 320x240 99 | //Arduino_GFX *gfx = new Arduino_ST7789(bus, TFT_RST, 1 /* rotation */); 100 | Arduino_GFX *gfx = new Arduino_NV3041A(bus, GFX_NOT_DEFINED /* RST */, 0 /* rotation */, true /* IPS */); 101 | #ifdef ESP32 102 | #undef F 103 | #define F(s) (s) 104 | #endif 105 | 106 | ///////////////////////////////// TOUCH 107 | #define GT911_ADDR 0x5D 108 | #define TOUCH_SDA 8 109 | #define TOUCH_SCL 4 110 | #define TOUCH_INT 3 // I'm not using interrupt 111 | #define TOUCH_RST 38 112 | 113 | //............................................................................ 114 | // Buttons size properties 115 | #define Bleft 0 // starting point 116 | #define Btop 0 // starting point 117 | 118 | // 16 Button pad 119 | #define BwidthPad 60 120 | #define BheightPad 50 121 | 122 | // 16 Bars 123 | #define BwidthBar 24 124 | #define BheightBar 80 125 | 126 | // 8 Func Button 127 | #define BwidthFunc 60 128 | #define BheightFunc 50 129 | 130 | // 8 norotary buttons 131 | #define BwidthNorot 60 132 | #define BheightNorot 42 133 | 134 | // wave location 135 | #define rot0_width 144 136 | #define rot0_height BheightBar 137 | 138 | #define rot1_width BwidthBar 139 | #define rot1_height BheightBar/2 140 | #define rot2_width BwidthBar 141 | #define rot2_height BheightBar/2 142 | 143 | #define WAVE_WIDTH 128 144 | #define WAVE_HEIGHT 64 145 | #define WAVE_ORIGIN_X 6 146 | #define WAVE_ORIGIN_Y (BheightPad*2)+2 147 | 148 | // 16+16+8+8 149 | int BPOS[48][4]; // filled in setup 150 | int BCOLOR[48]; // to store current button color 151 | 152 | const int debounce_time=230; // time to wait, miliseconds 153 | long start_debounce; 154 | bool touchActivo=false; 155 | int last_touched=-1; 156 | bool show_last_touched=false; 157 | long start_showlt; 158 | 159 | bool flag_ss=false; 160 | int count_loop=0; 161 | 162 | // Touchscreen coordinates: (x, y) and pressure (z) 163 | int cox, coy, coz; 164 | ////////////////////////////// TIMER SEQ 165 | #include 166 | 167 | ////////////////////////////// MIDI USB 168 | //#include 169 | //#include 170 | 171 | ////////////////////////////// SERIAL 2 (SYNC) 172 | // Hardware Serial 2 pins 173 | // #define RXD2 34 174 | // #define TXD2 21 175 | 176 | 177 | //////////////////////////////////////////////////////////////////////////////////////////// 178 | //////////////////////////////////////////////////////////////////////////////////////////// 179 | 180 | // modeZ types 181 | 182 | // 0 - play pad sound 183 | // 1 - select sound 184 | // 2 - edit track, write 185 | // 3 - mute 186 | // 4 - solo 187 | // 5 - clear 188 | 189 | // 6 - load pattern 190 | // 7 - load pattern 191 | // 8 - load pattern and sound 192 | 193 | // 9 - save pattern 194 | // 10 - save sound 195 | // 11 - save sound and pattern 196 | 197 | // 12 - random sound 198 | // 13 - random pattern 199 | // 14 - first step 200 | // 15 - last step 201 | // 16 - set melodic (read pitch from pattern melodic instead of rotary value) 202 | // 17 - random note 203 | // 18 - piano 204 | // 19 - song or pattern 205 | // 20 - select memory 206 | // 21 - first memory 207 | // 22 - last memory 208 | // 23 - random sound 2 209 | 210 | #define tPad 0 211 | #define tSel 1 212 | #define tWrite 2 213 | #define tMute 3 214 | #define tSolo 4 215 | #define tClear 5 216 | #define tLoaPS 6 217 | #define tLoadP 7 218 | #define tLoadS 8 219 | #define tSavPS 9 220 | #define tSaveP 10 221 | #define tSaveS 11 222 | #define tRndS 12 223 | #define tRndP 13 224 | #define tFirst 14 225 | #define tLast 15 226 | #define tMelod 16 227 | #define tRndNo 17 228 | #define tPiano 18 229 | #define tSong 19 230 | #define tMemo 20 231 | #define tMfirs 21 232 | #define tMlast 22 233 | #define tRndS2 23 234 | 235 | 236 | uint64_t NEWENDS[50]; 237 | uint64_t NEWINIS[50]; 238 | 239 | byte latch[16]; 240 | 241 | uint64_t samplePos[16]; 242 | uint64_t stepSize[16]; 243 | 244 | ////////////////////////////// SOUNDS 245 | 246 | #include "SOUNDS/zSAMPLE00.h" 247 | #include "SOUNDS/zSAMPLE01.h" 248 | #include "SOUNDS/zSAMPLE02.h" 249 | #include "SOUNDS/zSAMPLE03.h" 250 | #include "SOUNDS/zSAMPLE04.h" 251 | #include "SOUNDS/zSAMPLE05.h" 252 | #include "SOUNDS/zSAMPLE06.h" 253 | #include "SOUNDS/zSAMPLE07.h" 254 | #include "SOUNDS/zSAMPLE08.h" 255 | #include "SOUNDS/zSAMPLE09.h" 256 | #include "SOUNDS/zSAMPLE10.h" 257 | #include "SOUNDS/zSAMPLE11.h" 258 | #include "SOUNDS/zSAMPLE12.h" 259 | #include "SOUNDS/zSAMPLE13.h" 260 | #include "SOUNDS/zSAMPLE14.h" 261 | #include "SOUNDS/zSAMPLE15.h" 262 | #include "SOUNDS/zSAMPLE16.h" 263 | #include "SOUNDS/zSAMPLE17.h" 264 | #include "SOUNDS/zSAMPLE18.h" 265 | #include "SOUNDS/zSAMPLE19.h" 266 | #include "SOUNDS/zSAMPLE20.h" 267 | #include "SOUNDS/zSAMPLE21.h" 268 | #include "SOUNDS/zSAMPLE22.h" 269 | #include "SOUNDS/zSAMPLE23.h" 270 | #include "SOUNDS/zSAMPLE24.h" 271 | #include "SOUNDS/zSAMPLE25.h" 272 | #include "SOUNDS/zSAMPLE26.h" 273 | #include "SOUNDS/zSAMPLE27.h" 274 | #include "SOUNDS/zSAMPLE28.h" 275 | #include "SOUNDS/zSAMPLE29.h" 276 | #include "SOUNDS/zSAMPLE30.h" 277 | #include "SOUNDS/zSAMPLE31.h" 278 | #include "SOUNDS/SYNTH1.h" 279 | #include "SOUNDS/zSAMPLE33.h" 280 | #include "SOUNDS/zSAMPLE34.h" 281 | #include "SOUNDS/zSAMPLE35.h" 282 | #include "SOUNDS/zSAMPLE36.h" 283 | #include "SOUNDS/zSAMPLE37.h" 284 | #include "SOUNDS/zSAMPLE38.h" 285 | #include "SOUNDS/zSAMPLE39.h" 286 | #include "SOUNDS/SYNTH4.h" 287 | #include "SOUNDS/zSAMPLE41.h" 288 | #include "SOUNDS/zSAMPLE42.h" 289 | #include "SOUNDS/SYNTH6.h" 290 | #include "SOUNDS/zSAMPLE44.h" 291 | #include "SOUNDS/zSAMPLE45.h" 292 | #include "SOUNDS/zSAMPLE46.h" 293 | #include "SOUNDS/zSAMPLE47.h" 294 | #include "SOUNDS/zSAMPLE48.h" 295 | #include "SOUNDS/zSAMPLE49.h" 296 | 297 | const String sound_names[50] = { 298 | "0", 299 | "1", 300 | "2", 301 | "3", 302 | "4", 303 | "5", 304 | "6", 305 | "7", 306 | "8", 307 | "9", 308 | "10", 309 | "11", 310 | "12", 311 | "13", 312 | "14", 313 | "15", 314 | "16", 315 | "17", 316 | "18", 317 | "19", 318 | "20", 319 | "21", 320 | "22", 321 | "23", 322 | "24", 323 | "25", 324 | "26", 325 | "27", 326 | "28", 327 | "29", 328 | "30", 329 | "31", 330 | "SYNTH 1", 331 | "33", 332 | "34", 333 | "35", 334 | "36", 335 | "37", 336 | "38", 337 | "39", 338 | "SYNTH 4", 339 | "SAMPLE41", 340 | "42", 341 | "SYNTH 6", 342 | "44", 343 | "45", 344 | "46", 345 | "47", 346 | "48", 347 | "49" 348 | }; 349 | 350 | const uint64_t ENDS[50]={ 351 | (sizeof(SAMPLE00)/ sizeof(SAMPLE00[0]))-1, 352 | (sizeof(SAMPLE01)/ sizeof(SAMPLE01[0]))-1, 353 | (sizeof(SAMPLE02)/ sizeof(SAMPLE02[0]))-1, 354 | (sizeof(SAMPLE03)/ sizeof(SAMPLE03[0]))-1, 355 | (sizeof(SAMPLE04)/ sizeof(SAMPLE04[0]))-1, 356 | (sizeof(SAMPLE05)/ sizeof(SAMPLE05[0]))-1, 357 | (sizeof(SAMPLE06)/ sizeof(SAMPLE06[0]))-1, 358 | (sizeof(SAMPLE07)/ sizeof(SAMPLE07[0]))-1, 359 | (sizeof(SAMPLE08)/ sizeof(SAMPLE08[0]))-1, 360 | (sizeof(SAMPLE09)/ sizeof(SAMPLE09[0]))-1, 361 | (sizeof(SAMPLE10)/ sizeof(SAMPLE10[0]))-1, 362 | (sizeof(SAMPLE11)/ sizeof(SAMPLE11[0]))-1, 363 | (sizeof(SAMPLE12)/ sizeof(SAMPLE12[0]))-1, 364 | (sizeof(SAMPLE13)/ sizeof(SAMPLE13[0]))-1, 365 | (sizeof(SAMPLE14)/ sizeof(SAMPLE14[0]))-1, 366 | (sizeof(SAMPLE15)/ sizeof(SAMPLE15[0]))-1, 367 | (sizeof(SAMPLE16)/ sizeof(SAMPLE16[0]))-1, 368 | (sizeof(SAMPLE17)/ sizeof(SAMPLE17[0]))-1, 369 | (sizeof(SAMPLE18)/ sizeof(SAMPLE18[0]))-1, 370 | (sizeof(SAMPLE19)/ sizeof(SAMPLE19[0]))-1, 371 | (sizeof(SAMPLE20)/ sizeof(SAMPLE20[0]))-1, 372 | (sizeof(SAMPLE21)/ sizeof(SAMPLE21[0]))-1, 373 | (sizeof(SAMPLE22)/ sizeof(SAMPLE22[0]))-1, 374 | (sizeof(SAMPLE23)/ sizeof(SAMPLE23[0]))-1, 375 | (sizeof(SAMPLE24)/ sizeof(SAMPLE24[0]))-1, 376 | (sizeof(SAMPLE25)/ sizeof(SAMPLE25[0]))-1, 377 | (sizeof(SAMPLE26)/ sizeof(SAMPLE26[0]))-1, 378 | (sizeof(SAMPLE27)/ sizeof(SAMPLE27[0]))-1, 379 | (sizeof(SAMPLE28)/ sizeof(SAMPLE28[0]))-1, 380 | (sizeof(SAMPLE29)/ sizeof(SAMPLE29[0]))-1, 381 | (sizeof(SAMPLE30)/ sizeof(SAMPLE30[0]))-1, 382 | (sizeof(SAMPLE31)/ sizeof(SAMPLE31[0]))-1, 383 | (sizeof(SYNTH1)/ sizeof(SYNTH1[0]))-1, 384 | (sizeof(SAMPLE33)/ sizeof(SAMPLE33[0]))-1, 385 | (sizeof(SAMPLE34)/ sizeof(SAMPLE34[0]))-1, 386 | (sizeof(SAMPLE35)/ sizeof(SAMPLE35[0]))-1, 387 | (sizeof(SAMPLE36)/ sizeof(SAMPLE36[0]))-1, 388 | (sizeof(SAMPLE37)/ sizeof(SAMPLE37[0]))-1, 389 | (sizeof(SAMPLE38)/ sizeof(SAMPLE38[0]))-1, 390 | (sizeof(SAMPLE39)/ sizeof(SAMPLE39[0]))-1, 391 | (sizeof(SYNTH4)/ sizeof(SYNTH4[0]))-1, 392 | (sizeof(SAMPLE41)/ sizeof(SAMPLE41[0]))-1, 393 | (sizeof(SAMPLE42)/ sizeof(SAMPLE42[0]))-1, 394 | (sizeof(SYNTH6)/ sizeof(SYNTH6[0]))-1, 395 | (sizeof(SAMPLE44)/ sizeof(SAMPLE44[0]))-1, 396 | (sizeof(SAMPLE45)/ sizeof(SAMPLE45[0]))-1, 397 | (sizeof(SAMPLE46)/ sizeof(SAMPLE46[0]))-1, 398 | (sizeof(SAMPLE47)/ sizeof(SAMPLE47[0]))-1, 399 | (sizeof(SAMPLE48)/ sizeof(SAMPLE48[0]))-1, 400 | (sizeof(SAMPLE49)/ sizeof(SAMPLE49[0]))-1 401 | }; 402 | 403 | const int16_t* SAMPLES[50] = { 404 | SAMPLE00, 405 | SAMPLE01, 406 | SAMPLE02, 407 | SAMPLE03, 408 | SAMPLE04, 409 | SAMPLE05, 410 | SAMPLE06, 411 | SAMPLE07, 412 | SAMPLE08, 413 | SAMPLE09, 414 | SAMPLE10, 415 | SAMPLE11, 416 | SAMPLE12, 417 | SAMPLE13, 418 | SAMPLE14, 419 | SAMPLE15, 420 | SAMPLE16, 421 | SAMPLE17, 422 | SAMPLE18, 423 | SAMPLE19, 424 | SAMPLE20, 425 | SAMPLE21, 426 | SAMPLE22, 427 | SAMPLE23, 428 | SAMPLE24, 429 | SAMPLE25, 430 | SAMPLE26, 431 | SAMPLE27, 432 | SAMPLE28, 433 | SAMPLE29, 434 | SAMPLE30, 435 | SAMPLE31, 436 | SYNTH1, 437 | SAMPLE33, 438 | SAMPLE34, 439 | SAMPLE35, 440 | SAMPLE36, 441 | SAMPLE37, 442 | SAMPLE38, 443 | SAMPLE39, 444 | SYNTH4, 445 | SAMPLE41, 446 | SAMPLE42, 447 | SYNTH6, 448 | SAMPLE44, 449 | SAMPLE45, 450 | SAMPLE46, 451 | SAMPLE47, 452 | SAMPLE48, 453 | SAMPLE49 454 | }; 455 | 456 | 457 | // I2s 458 | 459 | // #define I2S_BCK_PIN 7 460 | // #define I2S_WS_PIN 16 461 | // #define I2S_DATA_OUT_PIN 15 462 | #ifdef mylcd_type1 463 | #define I2S_BCK_PIN 41 464 | #define I2S_WS_PIN 2 465 | #define I2S_DATA_OUT_PIN 42 466 | #endif 467 | #ifdef mylcd_type2 468 | #define I2S_BCK_PIN 9 469 | #define I2S_WS_PIN 5 470 | #define I2S_DATA_OUT_PIN 14 471 | #endif 472 | #define DMA_BUF_LEN 64 473 | #define DMA_NUM_BUF 8 474 | 475 | static uint16_t out_buf[DMA_BUF_LEN * 2]; 476 | 477 | // 16 filters + master L & R (Total = 18) 478 | LowPassFilter FILTROS[18]={ 479 | LowPassFilter(),LowPassFilter(),LowPassFilter(),LowPassFilter(), 480 | LowPassFilter(),LowPassFilter(),LowPassFilter(),LowPassFilter(), 481 | LowPassFilter(),LowPassFilter(),LowPassFilter(),LowPassFilter(), 482 | LowPassFilter(),LowPassFilter(),LowPassFilter(),LowPassFilter(), 483 | LowPassFilter(),LowPassFilter() 484 | }; 485 | 486 | const int cutoff=255; 487 | const int reso=511; 488 | 489 | static int VOL_R[16] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}; 490 | static int VOL_L[16] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}; 491 | static int PAN[16] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}; 492 | 493 | static int mvol=10; 494 | int master_vol=80; 495 | int master_filter=0; 496 | int octave=5; 497 | 498 | ////////////////////////////// MIDI USB 499 | //Adafruit_USBD_MIDI usb_midi; 500 | //MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI); 501 | 502 | ////////////////////////////// SEQ 503 | int bpm=120; 504 | byte selected_pattern=0; 505 | byte s_old_selected_pattern=99; 506 | byte sstep=0; 507 | int s_old_sstep=-1; 508 | 509 | uint16_t mutes=0; 510 | uint16_t solos=0; 511 | uint16_t pattern[16]; 512 | 513 | byte fx1=0; 514 | 515 | byte selected_memory=0; 516 | byte s_old_selected_memory=99; 517 | int pattern_song_counter=-1; 518 | byte last_pattern_song=255; 519 | uint8_t melodic[16][16]; 520 | //uint16_t isMelodic=B11111111<<8 | B00000000; // last 8 sounds are set to melodic, set into setup 521 | uint16_t isMelodic=B00000000<<8 | B00000000; // none set to melodic 522 | 523 | byte firstStep=0; 524 | byte lastStep=15; 525 | byte newLastStep=15; 526 | 527 | byte firstMemory=0; 528 | byte lastMemory=15; 529 | byte newLastMemory=15; 530 | 531 | byte selected_sound=0; 532 | byte oldselected_sound=0; 533 | byte s_old_selected_sound=99; 534 | //byte s_old_drawWaveform=99; 535 | byte selected_sndSet=0; 536 | byte s_old_selected_sndSet=99; 537 | int ztranspose=0; 538 | int zmpitch=0; 539 | bool load_flag=false; 540 | 541 | byte sync_state=0; // 0 no sync, 1, master, 2 slave 542 | bool sync_flag=false; 543 | 544 | // ESCALAS (255 = void) 545 | uint8_t selected_scale=0; 546 | const uint8_t escalas[13][8] = { 547 | {0, 0, 0, 0, 0, 0, 0, 0}, // free 548 | // Escalas diatónicas 549 | {0, 2, 4, 5, 7, 9, 11, 255}, // Mayor (Jónica) 550 | {0, 2, 3, 5, 7, 8, 10, 255}, // Menor natural (Eólica) 551 | {0, 2, 3, 5, 7, 8, 11, 255}, // Menor armónica 552 | {0, 2, 3, 5, 7, 9, 11, 255}, // Menor melódica 553 | 554 | // Escalas pentatónicas y blues 555 | {0, 2, 4, 7, 9, 255, 255, 255}, // Pentatónica mayor 556 | {0, 3, 5, 7, 10, 255, 255, 255}, // Pentatónica menor 557 | {0, 3, 5, 6, 7, 10, 255, 255}, // Blues menor 558 | 559 | // Modos 560 | {0, 2, 3, 5, 7, 9, 10, 255}, // Dórico 561 | {0, 1, 3, 5, 7, 8, 10, 255}, // Frigio 562 | {0, 2, 4, 6, 7, 9, 11, 255}, // Lidio 563 | {0, 2, 4, 5, 7, 9, 10, 255}, // Mixolidio 564 | {0, 1, 3, 5, 6, 8, 10, 255} // Locrio 565 | }; 566 | const char* nombresEscalas[] = { 567 | "Free" 568 | "Mayor", 569 | "Menor Natural", 570 | "Menor Armónica", 571 | "Menor Melódica", 572 | "Pentatónica Mayor", 573 | "Pentatónica Menor", 574 | "Blues Menor", 575 | "Dórico", 576 | "Frigio", 577 | "Lidio", 578 | "Mixolidio", 579 | "Locrio" 580 | }; 581 | ////////////////////////////// ROTARY 582 | #ifdef mylcd_type1 583 | #define CLK 9 // CLK ENCODER 584 | #define DT 14 // DT ENCODER 585 | const byte pinBR1=5; 586 | #endif 587 | #ifdef mylcd_type2 588 | #define CLK 7 // CLK ENCODER 589 | #define DT 6 // DT ENCODER 590 | const byte pinBR1=15; 591 | #endif 592 | 593 | byte ENC_PORT1=0; 594 | int counter1=0; 595 | int old_counter1=0; 596 | byte shiftR1=false; 597 | byte old_shiftR1=true; 598 | 599 | // 8 sound parameters + bpm + master vol + transpose + master filter + octave + Pattern song selector + Sync mode 600 | const int max_values[16]={49,2047,2047,127,1,127, 127,127,400,127, 1,127,20, 1,2,12}; 601 | const int min_values[16]={ 0, 0, 0, 0, 0, 0,-127, 0, 0, 0,-1, 0, 0,-1,0, 0}; 602 | 603 | int32_t ROTvalue[16][8]={ // init sound values 604 | { 16,0, 2047, 60,0,80,-10,0}, // THIS IS VOICE #0 605 | { 17,0, 2047, 60,0,80,-31,0}, // THIS IS VOICE #1 606 | { 18,0, 2047, 60,0,80, 12,0}, // ... 607 | { 19,0, 2047, 60,0,80, 0,0}, 608 | { 20,0, 2047, 60,0,80, 20,0}, 609 | { 21,0, 2047, 60,0,80, 0,0}, 610 | { 22,0, 2047, 60,0,80, 30,0}, 611 | { 23,0, 2047, 60,0,80, 0,0}, 612 | 613 | { 24,0, 2047, 60,0,80, 66,0}, 614 | { 25,0, 2047, 60,0,80, 66,0}, 615 | { 26,0, 2047, 60,0,80, 0,0}, 616 | { 27,0, 2047, 60,0,80,-20,0}, 617 | { 28,0, 2047, 60,0,80, 0,0}, 618 | { 29,0, 2047, 60,0,80,-10,0}, 619 | { 30,0, 2047, 60,0,80, 30,0}, 620 | { 31,0, 2047, 60,0,80,-30,0} 621 | }; 622 | 623 | byte selected_rot=0; 624 | byte s_old_selected_rot=1; 625 | 626 | byte trigger_on[48]; // 16 pads + 8 funcs + 8 norot buttons + 16 bars 627 | byte nkey; 628 | 629 | ////////////////////////////// MISC 630 | byte modeZ=0; 631 | int s_old_modeZ=-1; 632 | 633 | bool playing = false; 634 | bool pre_playing = false; 635 | bool songing = false; // switch to make load auto patterns++ 636 | bool recording = false; 637 | bool shifting = false; 638 | 639 | bool clearPADSTEP=false; 640 | bool clearPATTERNPADS=false; 641 | bool refreshPATTERN=true; 642 | bool refreshPADSTEP=false; 643 | bool refreshMODES=true; 644 | //bool refreshPADTOUCHED=false; 645 | 646 | #define MIDI_CLOCK 0xF8 647 | #define MIDI_START 0xFA 648 | #define MIDI_STOP 0xFC 649 | 650 | 651 | 652 | // //////////////////////////////////////////////////////////////////////////////////////////// 653 | // // I S R / SEQUENCER 654 | // //////////////////////////////////////////////////////////////////////////////////////////// 655 | // #include "driver/timer.h" 656 | // #define TIMER_DIVIDER 80 // 80MHz / 80 = 1MHz -> 1 tick = 1us 657 | // #define TIMER_SCALE (1000000) // para pasar a segundos 658 | // #define TIMER_GROUP TIMER_GROUP_0 659 | // #define TIMER_INDEX TIMER_0 660 | // volatile bool timerFired = false; 661 | // void (*onSync24Callback)() = nullptr; // callback a ejecutar en cada tick 662 | // uint16_t tick=0; 663 | 664 | // void IRAM_ATTR onTimer(void *arg) { 665 | // if (onSync24Callback != nullptr) { 666 | // onSync24Callback(); 667 | // } 668 | // // Limpiar interrupción 669 | // timer_group_clr_intr_status_in_isr(TIMER_GROUP, TIMER_INDEX); 670 | // // Volver a habilitar la interrupción 671 | // timer_group_enable_alarm_in_isr(TIMER_GROUP, TIMER_INDEX); 672 | // } 673 | 674 | // void IRAM_ATTR tic(){ 675 | // if (sstep==firstStep){ 676 | // sync_flag=true; 677 | // } 678 | // for (int f = 0; f < 16; f++) { 679 | // if (!bitRead(mutes, f)) { 680 | // if (solos == 0 || (solos > 0 && bitRead(solos, f))) { 681 | // if (bitRead(pattern[f], sstep)) { // note on 682 | // latch[f]=0; 683 | // if (bitRead(isMelodic,f)){ 684 | // synthESP32_TRIGGER_P(f,melodic[f][sstep]); 685 | // } else { 686 | // // Trigger con el pitch del canal 687 | // synthESP32_TRIGGER(f); 688 | // } 689 | // } 690 | // } 691 | // } 692 | // } 693 | 694 | // sstep++; 695 | // // Comprobar step final 696 | // if (sstep==(lastStep+1) || sstep==(newLastStep+1) || sstep==16) { 697 | // lastStep=newLastStep; 698 | // sstep=firstStep; 699 | // if (songing){ 700 | // load_flag=true; // inside loop I will load next pattern 701 | // } 702 | // } 703 | // refreshPADSTEP=true; 704 | // } 705 | 706 | // void IRAM_ATTR onSync24() { 707 | // // FX1 708 | // if (playing){ 709 | // if (!(tick % (12)) && fx1==1) { 710 | // synthESP32_TRIGGER(selected_sound); 711 | // } 712 | // if (!(tick % (6)) && fx1==2) { 713 | // synthESP32_TRIGGER(selected_sound); 714 | // } 715 | // if (!(tick % (3)) && fx1==3) { 716 | // synthESP32_TRIGGER(selected_sound); 717 | // } 718 | // } 719 | 720 | // // Lanzar cambio de step 721 | // if (!(tick % (6))) tic(); 722 | 723 | // // Limpiar marcas de sound y step 724 | // if ((tick % (6))==4) clearPADSTEP=true; 725 | // tick++; 726 | // if (tick==24) tick=0; 727 | // } 728 | 729 | //////////////////////////////////////////////////////////////////////////////////////////// 730 | //////////////////////////////////////////////////////////////////////////////////////////// 731 | //////////////////////////////////////////////////////////////////////////////////////////// 732 | 733 | ////////////////////////////// S E T U P ////////////////////////////// 734 | void setup() { 735 | 736 | // Serial 737 | Serial.begin(115200); 738 | delay(500); 739 | randomSeed(analogRead(0)); 740 | // // FX 741 | // if (!psramFound()) { 742 | // Serial.println("¡PSRAM no detectada!"); 743 | // while (1); 744 | // } 745 | 746 | // if (!initAudioFX()) { 747 | // Serial.println("Error inicializando efectos"); 748 | // while (1); 749 | // } 750 | 751 | // Iniciar el primer puerto I2C 752 | Wire.begin(TOUCH_SDA, TOUCH_SCL,400000); 753 | #ifdef ads_ok 754 | // Iniciar el segundo puerto I2C 755 | I2C_2.begin(SDA_2, SCL_2, 400000); 756 | 757 | // Iniciar el ADS1015 en el segundo puerto I2C 758 | if (!ads.begin(0x48, &I2C_2)) { // Dirección I2C por defecto del ADS1015/ADS1115 759 | Serial.println("ADS1015 not found."); 760 | } else { 761 | Serial.println("ADS1015 init OK."); 762 | } 763 | #endif 764 | //........................................................................................................................ 765 | // LCD and TOUCH 766 | // Init Display 767 | if (!gfx->begin()) 768 | // if (!gfx->begin(80000000)) /* specify data bus speed */ 769 | { 770 | Serial.println("gfx->begin() failed!"); 771 | } 772 | gfx->fillScreen(BLACK); 773 | 774 | #ifdef GFX_BL 775 | pinMode(GFX_BL, OUTPUT); 776 | digitalWrite(GFX_BL, HIGH); 777 | #endif 778 | 779 | gfx->setFont(u8g2_font_5x8_mr); 780 | gfx->setUTF8Print(true); 781 | 782 | fillBPOS(); 783 | drawScreen1_ONLY1(); 784 | 785 | // Touch 786 | resetGT911(); 787 | delay(100); 788 | 789 | 790 | // Serial 2 791 | // Serial1.begin(115200, SERIAL_8N1, RXD2, TXD2); //Hardware Serial of ESP32 792 | 793 | // MIDI USB 794 | // MIDI.begin(MIDI_CHANNEL_OMNI); 795 | // MIDI.setHandleNoteOn(handleNoteOn); 796 | // MIDI.setHandleControlChange(handleCC); 797 | // // check device mounted 798 | // if ( !TinyUSBDevice.mounted() ){ 799 | // Serial.println("Error USB"); 800 | // } 801 | 802 | 803 | // Synth 804 | synthESP32_begin(); 805 | 806 | // Set 16 voices 807 | for (byte f=0;f<16;f++){ 808 | setSound(f); 809 | } 810 | // Set master vol 811 | synthESP32_setMVol(master_vol); 812 | // Set master filter 813 | synthESP32_setMFilter(master_filter); 814 | 815 | // SPIFFS 816 | if (!SPIFFS.begin(true)) { 817 | Serial.println("Error al montar el sistema de archivos SPIFFS"); 818 | return; 819 | } 820 | 821 | /////////////////////////////////////////////////////// 822 | // Inicializar otro bus SPI para la tarjeta SD 823 | sdSPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS); 824 | 825 | // Inicializar la tarjeta SD 826 | if (!SD.begin(SD_CS,sdSPI)) { 827 | Serial.println("Error inicializando la tarjeta SD por SPI"); 828 | while (1); 829 | } 830 | Serial.println("Tarjeta SD inicializada correctamente"); 831 | // Listar archivos .wav desde el directorio raíz 832 | //listWavFiles("/"); 833 | 834 | /////////////////////////////////////////////////////// 835 | 836 | // Seq 837 | // fill melodic with 60 838 | for (byte a=0;a<16;a++){ 839 | for (byte b=0;b<16;b++){ 840 | melodic[a][b]=60; 841 | } 842 | } 843 | // set 8-15 as melodic; 844 | isMelodic=B11111111<<8 | B00000000; 845 | 846 | // Setup our clock system 847 | uClock.init(); 848 | uClock.setOnSync24(onSync24Callback); 849 | uClock.setTempo(bpm); 850 | 851 | // initTimer(onSync24); 852 | // setBPM(120); // 120 BPM 853 | 854 | // // demo pattern 855 | // pattern[0]=B00010001<<8 | B10010001; 856 | // pattern[2]=B11000101<<8 | B10101011; 857 | // pattern[6]=B10110101<<8 | B10001111; 858 | // pattern[3]=B00000110<<8 | B00000000; 859 | // pattern[7]=B00000000<<8 | B01001000; 860 | // // start playing demo pattern 861 | // uClock.start(); 862 | // sstep=firstStep; 863 | // refreshPADSTEP=true; 864 | // playing=true; 865 | #ifdef ads_ok 866 | // Rotary 867 | pinMode(pinBR1,INPUT_PULLUP); 868 | pinMode(CLK,INPUT_PULLUP); 869 | pinMode(DT,INPUT_PULLUP); 870 | #endif 871 | //........................................................................................................................ 872 | // 873 | // B L E M I D I 874 | // 875 | // BLEMidiServer.begin("zc2025ds"); 876 | 877 | // BLEMidiServer.setNoteOnCallback(onNoteOnBLE); 878 | 879 | // BLEMidiServer.setOnConnectCallback([]() { 880 | // Serial.println("Connected"); 881 | // }); 882 | // BLEMidiServer.setOnDisconnectCallback([](){ 883 | // Serial.println("Disconnected"); 884 | // }); 885 | 886 | 887 | //........................................................................................................................ 888 | 889 | select_rot(); 890 | draw8aBar(); 891 | draw8bBar(); 892 | 893 | 894 | } 895 | 896 | ////////////////////////////// L O O P ////////////////////////////// 897 | 898 | void loop() { 899 | 900 | // flag to do things outside sequencer timer isr 901 | if (load_flag){ 902 | load_flag=false; 903 | pattern_song_counter++; 904 | // Comprobar step final 905 | if ( (pattern_song_counter>lastMemory) || (pattern_song_counter>newLastMemory) || (pattern_song_counter==16) ){ 906 | lastMemory=newLastMemory; 907 | pattern_song_counter=firstMemory; 908 | } 909 | load_pattern(pattern_song_counter); 910 | selected_pattern=pattern_song_counter; 911 | load_sound(pattern_song_counter); 912 | selected_sndSet=pattern_song_counter; 913 | select_rot(); 914 | draw8aBar(); 915 | refreshPADSTEP=true; 916 | } 917 | 918 | // if (sync_flag){ 919 | // sync_flag=false; 920 | // if (sync_state==1){ // if this machine is master 921 | // Serial1.write(11); 922 | // } 923 | // } 924 | // if (sync_state==2){ // if this machine is slave 925 | // if (Serial1.available() > 0){ 926 | // byte var=Serial1.read(); 927 | // if (var==11){ 928 | // if (pre_playing){ 929 | // sstep=firstStep; 930 | // pre_playing=false; 931 | // uClock.start(); 932 | // refreshPADSTEP=true; 933 | // } 934 | // } 935 | // } 936 | // } 937 | 938 | // Read MIDI ports 939 | //MIDI.read(); 940 | #ifdef ads_ok 941 | shiftR1=!digitalRead(pinBR1); 942 | #endif 943 | 944 | // if (shiftR1!=old_shiftR1){ 945 | // old_shiftR1=shiftR1; 946 | // drawScreen1b(); 947 | // //Serial.println(shiftR1); 948 | // if (!shiftR1) refreshPATTERN=true; 949 | // } 950 | #ifdef ads_ok 951 | READ_ENCODERS(); 952 | #endif 953 | read_touch(); 954 | DO_KEYPAD(); 955 | REFRESH_KEYS(); 956 | REFRESH_STATUS(); 957 | 958 | showLastTouched(); 959 | clearLastTouched(); 960 | 961 | #ifdef ads_ok 962 | unsigned long currentMillis = millis(); 963 | if (currentMillis - previousMillis >= interval) { 964 | previousMillis = currentMillis; 965 | READ_POTS(); 966 | } 967 | #endif 968 | 969 | // Weird code!!!! Segunda carga de setsoud porque con la primera no se generan bien el inicio y el fin de sample y el volumen/pan. Parece que no le da tiempo. 970 | if (flag_ss=true){ 971 | count_loop++; 972 | if (count_loop==2){ 973 | count_loop=0; 974 | flag_ss=false; 975 | for (byte f=0;f<16;f++){ 976 | setSound(f); 977 | } 978 | } 979 | } 980 | 981 | } 982 | 983 | 984 | 985 | --------------------------------------------------------------------------------