diff options
Diffstat (limited to 'quantum/audio')
| -rw-r--r-- | quantum/audio/audio.c | 607 | ||||
| -rw-r--r-- | quantum/audio/audio.h | 89 | ||||
| -rw-r--r-- | quantum/audio/musical_notes.h | 217 | ||||
| -rw-r--r-- | quantum/audio/song_list.h | 117 | ||||
| -rw-r--r-- | quantum/audio/vibrato_lut.h | 28 | ||||
| -rw-r--r-- | quantum/audio/voices.c | 60 | ||||
| -rw-r--r-- | quantum/audio/voices.h | 21 | ||||
| -rw-r--r-- | quantum/audio/wave.h | 265 |
8 files changed, 1404 insertions, 0 deletions
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c new file mode 100644 index 000000000..3225557ba --- /dev/null +++ b/quantum/audio/audio.c | |||
| @@ -0,0 +1,607 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | #include <string.h> | ||
| 3 | #include <math.h> | ||
| 4 | #include <avr/pgmspace.h> | ||
| 5 | #include <avr/interrupt.h> | ||
| 6 | #include <avr/io.h> | ||
| 7 | #include "print.h" | ||
| 8 | #include "audio.h" | ||
| 9 | #include "keymap_common.h" | ||
| 10 | |||
| 11 | #include "eeconfig.h" | ||
| 12 | |||
| 13 | #ifdef VIBRATO_ENABLE | ||
| 14 | #include "vibrato_lut.h" | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #define PI 3.14159265 | ||
| 18 | |||
| 19 | #define CPU_PRESCALER 8 | ||
| 20 | |||
| 21 | #ifdef PWM_AUDIO | ||
| 22 | #include "wave.h" | ||
| 23 | #define SAMPLE_DIVIDER 39 | ||
| 24 | #define SAMPLE_RATE (2000000.0/SAMPLE_DIVIDER/2048) | ||
| 25 | // Resistor value of 1/ (2 * PI * 10nF * (2000000 hertz / SAMPLE_DIVIDER / 10)) for 10nF cap | ||
| 26 | |||
| 27 | float places[8] = {0, 0, 0, 0, 0, 0, 0, 0}; | ||
| 28 | uint16_t place_int = 0; | ||
| 29 | bool repeat = true; | ||
| 30 | #endif | ||
| 31 | |||
| 32 | void delay_us(int count) { | ||
| 33 | while(count--) { | ||
| 34 | _delay_us(1); | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | int voices = 0; | ||
| 39 | int voice_place = 0; | ||
| 40 | float frequency = 0; | ||
| 41 | int volume = 0; | ||
| 42 | long position = 0; | ||
| 43 | |||
| 44 | float frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0}; | ||
| 45 | int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0}; | ||
| 46 | bool sliding = false; | ||
| 47 | |||
| 48 | int max = 0xFF; | ||
| 49 | float sum = 0; | ||
| 50 | float place = 0; | ||
| 51 | |||
| 52 | uint8_t * sample; | ||
| 53 | uint16_t sample_length = 0; | ||
| 54 | // float freq = 0; | ||
| 55 | |||
| 56 | bool notes = false; | ||
| 57 | bool note = false; | ||
| 58 | float note_frequency = 0; | ||
| 59 | float note_length = 0; | ||
| 60 | float note_tempo = TEMPO_DEFAULT; | ||
| 61 | float note_timbre = TIMBRE_DEFAULT; | ||
| 62 | uint16_t note_position = 0; | ||
| 63 | float (* notes_pointer)[][2]; | ||
| 64 | uint16_t notes_count; | ||
| 65 | bool notes_repeat; | ||
| 66 | float notes_rest; | ||
| 67 | bool note_resting = false; | ||
| 68 | |||
| 69 | uint8_t current_note = 0; | ||
| 70 | uint8_t rest_counter = 0; | ||
| 71 | |||
| 72 | #ifdef VIBRATO_ENABLE | ||
| 73 | float vibrato_counter = 0; | ||
| 74 | float vibrato_strength = .5; | ||
| 75 | float vibrato_rate = 0.125; | ||
| 76 | #endif | ||
| 77 | |||
| 78 | float polyphony_rate = 0; | ||
| 79 | |||
| 80 | bool inited = false; | ||
| 81 | |||
| 82 | audio_config_t audio_config; | ||
| 83 | |||
| 84 | uint16_t envelope_index = 0; | ||
| 85 | |||
| 86 | void audio_toggle(void) { | ||
| 87 | audio_config.enable ^= 1; | ||
| 88 | eeconfig_write_audio(audio_config.raw); | ||
| 89 | } | ||
| 90 | |||
| 91 | void audio_on(void) { | ||
| 92 | audio_config.enable = 1; | ||
| 93 | eeconfig_write_audio(audio_config.raw); | ||
| 94 | } | ||
| 95 | |||
| 96 | void audio_off(void) { | ||
| 97 | audio_config.enable = 0; | ||
| 98 | eeconfig_write_audio(audio_config.raw); | ||
| 99 | } | ||
| 100 | |||
| 101 | #ifdef VIBRATO_ENABLE | ||
| 102 | // Vibrato rate functions | ||
| 103 | |||
| 104 | void set_vibrato_rate(float rate) { | ||
| 105 | vibrato_rate = rate; | ||
| 106 | } | ||
| 107 | |||
| 108 | void increase_vibrato_rate(float change) { | ||
| 109 | vibrato_rate *= change; | ||
| 110 | } | ||
| 111 | |||
| 112 | void decrease_vibrato_rate(float change) { | ||
| 113 | vibrato_rate /= change; | ||
| 114 | } | ||
| 115 | |||
| 116 | #ifdef VIBRATO_STRENGTH_ENABLE | ||
| 117 | |||
| 118 | void set_vibrato_strength(float strength) { | ||
| 119 | vibrato_strength = strength; | ||
| 120 | } | ||
| 121 | |||
| 122 | void increase_vibrato_strength(float change) { | ||
| 123 | vibrato_strength *= change; | ||
| 124 | } | ||
| 125 | |||
| 126 | void decrease_vibrato_strength(float change) { | ||
| 127 | vibrato_strength /= change; | ||
| 128 | } | ||
| 129 | |||
| 130 | #endif | ||
| 131 | |||
| 132 | #endif | ||
| 133 | |||
| 134 | // Polyphony functions | ||
| 135 | |||
| 136 | void set_polyphony_rate(float rate) { | ||
| 137 | polyphony_rate = rate; | ||
| 138 | } | ||
| 139 | |||
| 140 | void enable_polyphony() { | ||
| 141 | polyphony_rate = 5; | ||
| 142 | } | ||
| 143 | |||
| 144 | void disable_polyphony() { | ||
| 145 | polyphony_rate = 0; | ||
| 146 | } | ||
| 147 | |||
| 148 | void increase_polyphony_rate(float change) { | ||
| 149 | polyphony_rate *= change; | ||
| 150 | } | ||
| 151 | |||
| 152 | void decrease_polyphony_rate(float change) { | ||
| 153 | polyphony_rate /= change; | ||
| 154 | } | ||
| 155 | |||
| 156 | // Timbre function | ||
| 157 | |||
| 158 | void set_timbre(float timbre) { | ||
| 159 | note_timbre = timbre; | ||
| 160 | } | ||
| 161 | |||
| 162 | // Tempo functions | ||
| 163 | |||
| 164 | void set_tempo(float tempo) { | ||
| 165 | note_tempo = tempo; | ||
| 166 | } | ||
| 167 | |||
| 168 | void decrease_tempo(uint8_t tempo_change) { | ||
| 169 | note_tempo += (float) tempo_change; | ||
| 170 | } | ||
| 171 | |||
| 172 | void increase_tempo(uint8_t tempo_change) { | ||
| 173 | if (note_tempo - (float) tempo_change < 10) { | ||
| 174 | note_tempo = 10; | ||
| 175 | } else { | ||
| 176 | note_tempo -= (float) tempo_change; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | |||
| 180 | void audio_init() { | ||
| 181 | |||
| 182 | /* check signature */ | ||
| 183 | if (!eeconfig_is_enabled()) { | ||
| 184 | eeconfig_init(); | ||
| 185 | } | ||
| 186 | audio_config.raw = eeconfig_read_audio(); | ||
| 187 | |||
| 188 | #ifdef PWM_AUDIO | ||
| 189 | PLLFRQ = _BV(PDIV2); | ||
| 190 | PLLCSR = _BV(PLLE); | ||
| 191 | while(!(PLLCSR & _BV(PLOCK))); | ||
| 192 | PLLFRQ |= _BV(PLLTM0); /* PCK 48MHz */ | ||
| 193 | |||
| 194 | /* Init a fast PWM on Timer4 */ | ||
| 195 | TCCR4A = _BV(COM4A0) | _BV(PWM4A); /* Clear OC4A on Compare Match */ | ||
| 196 | TCCR4B = _BV(CS40); /* No prescaling => f = PCK/256 = 187500Hz */ | ||
| 197 | OCR4A = 0; | ||
| 198 | |||
| 199 | /* Enable the OC4A output */ | ||
| 200 | DDRC |= _BV(PORTC6); | ||
| 201 | |||
| 202 | TIMSK3 &= ~_BV(OCIE3A); // Turn off 3A interputs | ||
| 203 | |||
| 204 | TCCR3A = 0x0; // Options not needed | ||
| 205 | TCCR3B = _BV(CS31) | _BV(CS30) | _BV(WGM32); // 64th prescaling and CTC | ||
| 206 | OCR3A = SAMPLE_DIVIDER - 1; // Correct count/compare, related to sample playback | ||
| 207 | #else | ||
| 208 | DDRC |= _BV(PORTC6); | ||
| 209 | |||
| 210 | TIMSK3 &= ~_BV(OCIE3A); // Turn off 3A interputs | ||
| 211 | |||
| 212 | TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30); | ||
| 213 | TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30); | ||
| 214 | #endif | ||
| 215 | |||
| 216 | inited = true; | ||
| 217 | } | ||
| 218 | |||
| 219 | void stop_all_notes() { | ||
| 220 | if (!inited) { | ||
| 221 | audio_init(); | ||
| 222 | } | ||
| 223 | voices = 0; | ||
| 224 | #ifdef PWM_AUDIO | ||
| 225 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 226 | #else | ||
| 227 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 228 | TCCR3A &= ~_BV(COM3A1); | ||
| 229 | #endif | ||
| 230 | notes = false; | ||
| 231 | note = false; | ||
| 232 | frequency = 0; | ||
| 233 | volume = 0; | ||
| 234 | |||
| 235 | for (int i = 0; i < 8; i++) { | ||
| 236 | frequencies[i] = 0; | ||
| 237 | volumes[i] = 0; | ||
| 238 | } | ||
| 239 | } | ||
| 240 | |||
| 241 | void stop_note(float freq) { | ||
| 242 | if (note) { | ||
| 243 | if (!inited) { | ||
| 244 | audio_init(); | ||
| 245 | } | ||
| 246 | #ifdef PWM_AUDIO | ||
| 247 | freq = freq / SAMPLE_RATE; | ||
| 248 | #endif | ||
| 249 | for (int i = 7; i >= 0; i--) { | ||
| 250 | if (frequencies[i] == freq) { | ||
| 251 | frequencies[i] = 0; | ||
| 252 | volumes[i] = 0; | ||
| 253 | for (int j = i; (j < 7); j++) { | ||
| 254 | frequencies[j] = frequencies[j+1]; | ||
| 255 | frequencies[j+1] = 0; | ||
| 256 | volumes[j] = volumes[j+1]; | ||
| 257 | volumes[j+1] = 0; | ||
| 258 | } | ||
| 259 | break; | ||
| 260 | } | ||
| 261 | } | ||
| 262 | voices--; | ||
| 263 | if (voices < 0) | ||
| 264 | voices = 0; | ||
| 265 | if (voice_place >= voices) { | ||
| 266 | voice_place = 0; | ||
| 267 | } | ||
| 268 | if (voices == 0) { | ||
| 269 | #ifdef PWM_AUDIO | ||
| 270 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 271 | #else | ||
| 272 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 273 | TCCR3A &= ~_BV(COM3A1); | ||
| 274 | #endif | ||
| 275 | frequency = 0; | ||
| 276 | volume = 0; | ||
| 277 | note = false; | ||
| 278 | } | ||
| 279 | } | ||
| 280 | } | ||
| 281 | |||
| 282 | #ifdef VIBRATO_ENABLE | ||
| 283 | |||
| 284 | float mod(float a, int b) | ||
| 285 | { | ||
| 286 | float r = fmod(a, b); | ||
| 287 | return r < 0 ? r + b : r; | ||
| 288 | } | ||
| 289 | |||
| 290 | float vibrato(float average_freq) { | ||
| 291 | #ifdef VIBRATO_STRENGTH_ENABLE | ||
| 292 | float vibrated_freq = average_freq * pow(VIBRATO_LUT[(int)vibrato_counter], vibrato_strength); | ||
| 293 | #else | ||
| 294 | float vibrated_freq = average_freq * VIBRATO_LUT[(int)vibrato_counter]; | ||
| 295 | #endif | ||
| 296 | vibrato_counter = mod((vibrato_counter + vibrato_rate * (1.0 + 440.0/average_freq)), VIBRATO_LUT_LENGTH); | ||
| 297 | return vibrated_freq; | ||
| 298 | } | ||
| 299 | |||
| 300 | #endif | ||
| 301 | |||
| 302 | ISR(TIMER3_COMPA_vect) { | ||
| 303 | if (note) { | ||
| 304 | #ifdef PWM_AUDIO | ||
| 305 | if (voices == 1) { | ||
| 306 | // SINE | ||
| 307 | OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 2; | ||
| 308 | |||
| 309 | // SQUARE | ||
| 310 | // if (((int)place) >= 1024){ | ||
| 311 | // OCR4A = 0xFF >> 2; | ||
| 312 | // } else { | ||
| 313 | // OCR4A = 0x00; | ||
| 314 | // } | ||
| 315 | |||
| 316 | // SAWTOOTH | ||
| 317 | // OCR4A = (int)place / 4; | ||
| 318 | |||
| 319 | // TRIANGLE | ||
| 320 | // if (((int)place) >= 1024) { | ||
| 321 | // OCR4A = (int)place / 2; | ||
| 322 | // } else { | ||
| 323 | // OCR4A = 2048 - (int)place / 2; | ||
| 324 | // } | ||
| 325 | |||
| 326 | place += frequency; | ||
| 327 | |||
| 328 | if (place >= SINE_LENGTH) | ||
| 329 | place -= SINE_LENGTH; | ||
| 330 | |||
| 331 | } else { | ||
| 332 | int sum = 0; | ||
| 333 | for (int i = 0; i < voices; i++) { | ||
| 334 | // SINE | ||
| 335 | sum += pgm_read_byte(&sinewave[(uint16_t)places[i]]) >> 2; | ||
| 336 | |||
| 337 | // SQUARE | ||
| 338 | // if (((int)places[i]) >= 1024){ | ||
| 339 | // sum += 0xFF >> 2; | ||
| 340 | // } else { | ||
| 341 | // sum += 0x00; | ||
| 342 | // } | ||
| 343 | |||
| 344 | places[i] += frequencies[i]; | ||
| 345 | |||
| 346 | if (places[i] >= SINE_LENGTH) | ||
| 347 | places[i] -= SINE_LENGTH; | ||
| 348 | } | ||
| 349 | OCR4A = sum; | ||
| 350 | } | ||
| 351 | #else | ||
| 352 | if (voices > 0) { | ||
| 353 | float freq; | ||
| 354 | if (polyphony_rate > 0) { | ||
| 355 | if (voices > 1) { | ||
| 356 | voice_place %= voices; | ||
| 357 | if (place++ > (frequencies[voice_place] / polyphony_rate / CPU_PRESCALER)) { | ||
| 358 | voice_place = (voice_place + 1) % voices; | ||
| 359 | place = 0.0; | ||
| 360 | } | ||
| 361 | } | ||
| 362 | #ifdef VIBRATO_ENABLE | ||
| 363 | if (vibrato_strength > 0) { | ||
| 364 | freq = vibrato(frequencies[voice_place]); | ||
| 365 | } else { | ||
| 366 | #else | ||
| 367 | { | ||
| 368 | #endif | ||
| 369 | freq = frequencies[voice_place]; | ||
| 370 | } | ||
| 371 | } else { | ||
| 372 | if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) { | ||
| 373 | frequency = frequency * pow(2, 440/frequency/12/2); | ||
| 374 | } else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) { | ||
| 375 | frequency = frequency * pow(2, -440/frequency/12/2); | ||
| 376 | } else { | ||
| 377 | frequency = frequencies[voices - 1]; | ||
| 378 | } | ||
| 379 | |||
| 380 | |||
| 381 | #ifdef VIBRATO_ENABLE | ||
| 382 | if (vibrato_strength > 0) { | ||
| 383 | freq = vibrato(frequency); | ||
| 384 | } else { | ||
| 385 | #else | ||
| 386 | { | ||
| 387 | #endif | ||
| 388 | freq = frequency; | ||
| 389 | } | ||
| 390 | } | ||
| 391 | |||
| 392 | if (envelope_index < 65535) { | ||
| 393 | envelope_index++; | ||
| 394 | } | ||
| 395 | freq = voice_envelope(freq); | ||
| 396 | |||
| 397 | if (freq < 30.517578125) | ||
| 398 | freq = 30.52; | ||
| 399 | ICR3 = (int)(((double)F_CPU) / (freq * CPU_PRESCALER)); // Set max to the period | ||
| 400 | OCR3A = (int)((((double)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); // Set compare to half the period | ||
| 401 | } | ||
| 402 | #endif | ||
| 403 | } | ||
| 404 | |||
| 405 | // SAMPLE | ||
| 406 | // OCR4A = pgm_read_byte(&sample[(uint16_t)place_int]); | ||
| 407 | |||
| 408 | // place_int++; | ||
| 409 | |||
| 410 | // if (place_int >= sample_length) | ||
| 411 | // if (repeat) | ||
| 412 | // place_int -= sample_length; | ||
| 413 | // else | ||
| 414 | // TIMSK3 &= ~_BV(OCIE3A); | ||
| 415 | |||
| 416 | |||
| 417 | if (notes) { | ||
| 418 | #ifdef PWM_AUDIO | ||
| 419 | OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 0; | ||
| 420 | |||
| 421 | place += note_frequency; | ||
| 422 | if (place >= SINE_LENGTH) | ||
| 423 | place -= SINE_LENGTH; | ||
| 424 | #else | ||
| 425 | if (note_frequency > 0) { | ||
| 426 | float freq; | ||
| 427 | |||
| 428 | #ifdef VIBRATO_ENABLE | ||
| 429 | if (vibrato_strength > 0) { | ||
| 430 | freq = vibrato(note_frequency); | ||
| 431 | } else { | ||
| 432 | #else | ||
| 433 | { | ||
| 434 | #endif | ||
| 435 | freq = note_frequency; | ||
| 436 | } | ||
| 437 | |||
| 438 | if (envelope_index < 65535) { | ||
| 439 | envelope_index++; | ||
| 440 | } | ||
| 441 | freq = voice_envelope(freq); | ||
| 442 | |||
| 443 | ICR3 = (int)(((double)F_CPU) / (freq * CPU_PRESCALER)); // Set max to the period | ||
| 444 | OCR3A = (int)((((double)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); // Set compare to half the period | ||
| 445 | } else { | ||
| 446 | ICR3 = 0; | ||
| 447 | OCR3A = 0; | ||
| 448 | } | ||
| 449 | #endif | ||
| 450 | |||
| 451 | |||
| 452 | note_position++; | ||
| 453 | bool end_of_note = false; | ||
| 454 | if (ICR3 > 0) | ||
| 455 | end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF)); | ||
| 456 | else | ||
| 457 | end_of_note = (note_position >= (note_length * 0x7FF)); | ||
| 458 | if (end_of_note) { | ||
| 459 | current_note++; | ||
| 460 | if (current_note >= notes_count) { | ||
| 461 | if (notes_repeat) { | ||
| 462 | current_note = 0; | ||
| 463 | } else { | ||
| 464 | #ifdef PWM_AUDIO | ||
| 465 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 466 | #else | ||
| 467 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 468 | TCCR3A &= ~_BV(COM3A1); | ||
| 469 | #endif | ||
| 470 | notes = false; | ||
| 471 | return; | ||
| 472 | } | ||
| 473 | } | ||
| 474 | if (!note_resting && (notes_rest > 0)) { | ||
| 475 | note_resting = true; | ||
| 476 | note_frequency = 0; | ||
| 477 | note_length = notes_rest; | ||
| 478 | current_note--; | ||
| 479 | } else { | ||
| 480 | note_resting = false; | ||
| 481 | #ifdef PWM_AUDIO | ||
| 482 | note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE; | ||
| 483 | note_length = (*notes_pointer)[current_note][1] * (note_tempo / 100); | ||
| 484 | #else | ||
| 485 | envelope_index = 0; | ||
| 486 | note_frequency = (*notes_pointer)[current_note][0]; | ||
| 487 | note_length = ((*notes_pointer)[current_note][1] / 4) * (note_tempo / 100); | ||
| 488 | #endif | ||
| 489 | } | ||
| 490 | note_position = 0; | ||
| 491 | } | ||
| 492 | |||
| 493 | } | ||
| 494 | |||
| 495 | if (!audio_config.enable) { | ||
| 496 | notes = false; | ||
| 497 | note = false; | ||
| 498 | } | ||
| 499 | } | ||
| 500 | |||
| 501 | void play_note(float freq, int vol) { | ||
| 502 | |||
| 503 | if (!inited) { | ||
| 504 | audio_init(); | ||
| 505 | } | ||
| 506 | |||
| 507 | if (audio_config.enable && voices < 8) { | ||
| 508 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 509 | // Cancel notes if notes are playing | ||
| 510 | if (notes) | ||
| 511 | stop_all_notes(); | ||
| 512 | note = true; | ||
| 513 | envelope_index = 0; | ||
| 514 | #ifdef PWM_AUDIO | ||
| 515 | freq = freq / SAMPLE_RATE; | ||
| 516 | #endif | ||
| 517 | if (freq > 0) { | ||
| 518 | frequencies[voices] = freq; | ||
| 519 | volumes[voices] = vol; | ||
| 520 | voices++; | ||
| 521 | } | ||
| 522 | |||
| 523 | #ifdef PWM_AUDIO | ||
| 524 | TIMSK3 |= _BV(OCIE3A); | ||
| 525 | #else | ||
| 526 | TIMSK3 |= _BV(OCIE3A); | ||
| 527 | TCCR3A |= _BV(COM3A1); | ||
| 528 | #endif | ||
| 529 | } | ||
| 530 | |||
| 531 | } | ||
| 532 | |||
| 533 | void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest) { | ||
| 534 | |||
| 535 | if (!inited) { | ||
| 536 | audio_init(); | ||
| 537 | } | ||
| 538 | |||
| 539 | if (audio_config.enable) { | ||
| 540 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 541 | // Cancel note if a note is playing | ||
| 542 | if (note) | ||
| 543 | stop_all_notes(); | ||
| 544 | notes = true; | ||
| 545 | |||
| 546 | notes_pointer = np; | ||
| 547 | notes_count = n_count; | ||
| 548 | notes_repeat = n_repeat; | ||
| 549 | notes_rest = n_rest; | ||
| 550 | |||
| 551 | place = 0; | ||
| 552 | current_note = 0; | ||
| 553 | #ifdef PWM_AUDIO | ||
| 554 | note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE; | ||
| 555 | note_length = (*notes_pointer)[current_note][1] * (note_tempo / 100); | ||
| 556 | #else | ||
| 557 | note_frequency = (*notes_pointer)[current_note][0]; | ||
| 558 | note_length = ((*notes_pointer)[current_note][1] / 4) * (note_tempo / 100); | ||
| 559 | #endif | ||
| 560 | note_position = 0; | ||
| 561 | |||
| 562 | |||
| 563 | #ifdef PWM_AUDIO | ||
| 564 | TIMSK3 |= _BV(OCIE3A); | ||
| 565 | #else | ||
| 566 | TIMSK3 |= _BV(OCIE3A); | ||
| 567 | TCCR3A |= _BV(COM3A1); | ||
| 568 | #endif | ||
| 569 | } | ||
| 570 | |||
| 571 | } | ||
| 572 | |||
| 573 | #ifdef PWM_AUDIO | ||
| 574 | void play_sample(uint8_t * s, uint16_t l, bool r) { | ||
| 575 | if (!inited) { | ||
| 576 | audio_init(); | ||
| 577 | } | ||
| 578 | |||
| 579 | if (audio_config.enable) { | ||
| 580 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 581 | stop_all_notes(); | ||
| 582 | place_int = 0; | ||
| 583 | sample = s; | ||
| 584 | sample_length = l; | ||
| 585 | repeat = r; | ||
| 586 | |||
| 587 | TIMSK3 |= _BV(OCIE3A); | ||
| 588 | } | ||
| 589 | } | ||
| 590 | #endif | ||
| 591 | |||
| 592 | //------------------------------------------------------------------------------ | ||
| 593 | // Override these functions in your keymap file to play different tunes on | ||
| 594 | // startup and bootloader jump | ||
| 595 | __attribute__ ((weak)) | ||
| 596 | void play_startup_tone() | ||
| 597 | { | ||
| 598 | } | ||
| 599 | |||
| 600 | |||
| 601 | |||
| 602 | __attribute__ ((weak)) | ||
| 603 | void play_goodbye_tone() | ||
| 604 | { | ||
| 605 | |||
| 606 | } | ||
| 607 | //------------------------------------------------------------------------------ | ||
diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h new file mode 100644 index 000000000..d1ccfdb82 --- /dev/null +++ b/quantum/audio/audio.h | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | #include <stdint.h> | ||
| 2 | #include <stdbool.h> | ||
| 3 | #include <avr/io.h> | ||
| 4 | #include <util/delay.h> | ||
| 5 | #include "musical_notes.h" | ||
| 6 | #include "song_list.h" | ||
| 7 | #include "voices.h" | ||
| 8 | |||
| 9 | #ifndef AUDIO_H | ||
| 10 | #define AUDIO_H | ||
| 11 | |||
| 12 | // Largely untested PWM audio mode (doesn't sound as good) | ||
| 13 | // #define PWM_AUDIO | ||
| 14 | |||
| 15 | // #define VIBRATO_ENABLE | ||
| 16 | |||
| 17 | // Enable vibrato strength/amplitude - slows down ISR too much | ||
| 18 | // #define VIBRATO_STRENGTH_ENABLE | ||
| 19 | |||
| 20 | typedef union { | ||
| 21 | uint8_t raw; | ||
| 22 | struct { | ||
| 23 | bool enable :1; | ||
| 24 | uint8_t level :7; | ||
| 25 | }; | ||
| 26 | } audio_config_t; | ||
| 27 | |||
| 28 | void audio_toggle(void); | ||
| 29 | void audio_on(void); | ||
| 30 | void audio_off(void); | ||
| 31 | |||
| 32 | // Vibrato rate functions | ||
| 33 | |||
| 34 | #ifdef VIBRATO_ENABLE | ||
| 35 | |||
| 36 | void set_vibrato_rate(float rate); | ||
| 37 | void increase_vibrato_rate(float change); | ||
| 38 | void decrease_vibrato_rate(float change); | ||
| 39 | |||
| 40 | #ifdef VIBRATO_STRENGTH_ENABLE | ||
| 41 | |||
| 42 | void set_vibrato_strength(float strength); | ||
| 43 | void increase_vibrato_strength(float change); | ||
| 44 | void decrease_vibrato_strength(float change); | ||
| 45 | |||
| 46 | #endif | ||
| 47 | |||
| 48 | #endif | ||
| 49 | |||
| 50 | // Polyphony functions | ||
| 51 | |||
| 52 | void set_polyphony_rate(float rate); | ||
| 53 | void enable_polyphony(); | ||
| 54 | void disable_polyphony(); | ||
| 55 | void increase_polyphony_rate(float change); | ||
| 56 | void decrease_polyphony_rate(float change); | ||
| 57 | |||
| 58 | void set_timbre(float timbre); | ||
| 59 | void set_tempo(float tempo); | ||
| 60 | |||
| 61 | void increase_tempo(uint8_t tempo_change); | ||
| 62 | void decrease_tempo(uint8_t tempo_change); | ||
| 63 | |||
| 64 | void audio_init(); | ||
| 65 | |||
| 66 | #ifdef PWM_AUDIO | ||
| 67 | void play_sample(uint8_t * s, uint16_t l, bool r); | ||
| 68 | #endif | ||
| 69 | void play_note(float freq, int vol); | ||
| 70 | void stop_note(float freq); | ||
| 71 | void stop_all_notes(void); | ||
| 72 | void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest); | ||
| 73 | |||
| 74 | #define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \ | ||
| 75 | 0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \ | ||
| 76 | 0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \ | ||
| 77 | 0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \ | ||
| 78 | 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), } | ||
| 79 | |||
| 80 | // These macros are used to allow play_notes to play an array of indeterminate | ||
| 81 | // length. This works around the limitation of C's sizeof operation on pointers. | ||
| 82 | // The global float array for the song must be used here. | ||
| 83 | #define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0])))) | ||
| 84 | #define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style)); | ||
| 85 | |||
| 86 | void play_goodbye_tone(void); | ||
| 87 | void play_startup_tone(void); | ||
| 88 | |||
| 89 | #endif \ No newline at end of file | ||
diff --git a/quantum/audio/musical_notes.h b/quantum/audio/musical_notes.h new file mode 100644 index 000000000..b08d16a6f --- /dev/null +++ b/quantum/audio/musical_notes.h | |||
| @@ -0,0 +1,217 @@ | |||
| 1 | #ifndef MUSICAL_NOTES_H | ||
| 2 | #define MUSICAL_NOTES_H | ||
| 3 | |||
| 4 | // Tempo Placeholder | ||
| 5 | #define TEMPO_DEFAULT 100 | ||
| 6 | |||
| 7 | |||
| 8 | #define SONG(notes...) { notes } | ||
| 9 | |||
| 10 | |||
| 11 | // Note Types | ||
| 12 | #define MUSICAL_NOTE(note, duration) {(NOTE##note), duration} | ||
| 13 | #define WHOLE_NOTE(note) MUSICAL_NOTE(note, 64) | ||
| 14 | #define HALF_NOTE(note) MUSICAL_NOTE(note, 32) | ||
| 15 | #define QUARTER_NOTE(note) MUSICAL_NOTE(note, 16) | ||
| 16 | #define EIGHTH_NOTE(note) MUSICAL_NOTE(note, 8) | ||
| 17 | #define SIXTEENTH_NOTE(note) MUSICAL_NOTE(note, 4) | ||
| 18 | |||
| 19 | #define WHOLE_DOT_NOTE(note) MUSICAL_NOTE(note, 64+32) | ||
| 20 | #define HALF_DOT_NOTE(note) MUSICAL_NOTE(note, 32+16) | ||
| 21 | #define QUARTER_DOT_NOTE(note) MUSICAL_NOTE(note, 16+8) | ||
| 22 | #define EIGHTH_DOT_NOTE(note) MUSICAL_NOTE(note, 8+4) | ||
| 23 | #define SIXTEENTH_DOT_NOTE(note) MUSICAL_NOTE(note, 4+2) | ||
| 24 | |||
| 25 | // Note Type Shortcuts | ||
| 26 | #define M__NOTE(note, duration) MUSICAL_NOTE(note, duration) | ||
| 27 | #define W__NOTE(n) WHOLE_NOTE(n) | ||
| 28 | #define H__NOTE(n) HALF_NOTE(n) | ||
| 29 | #define Q__NOTE(n) QUARTER_NOTE(n) | ||
| 30 | #define E__NOTE(n) EIGHTH_NOTE(n) | ||
| 31 | #define S__NOTE(n) SIXTEENTH_NOTE(n) | ||
| 32 | #define WD_NOTE(n) WHOLE_DOT_NOTE(n) | ||
| 33 | #define HD_NOTE(n) HALF_DOT_NOTE(n) | ||
| 34 | #define QD_NOTE(n) QUARTER_DOT_NOTE(n) | ||
| 35 | #define ED_NOTE(n) EIGHTH_DOT_NOTE(n) | ||
| 36 | #define SD_NOTE(n) SIXTEENTH_DOT_NOTE(n) | ||
| 37 | |||
| 38 | // Note Styles | ||
| 39 | // Staccato makes sure there is a rest between each note. Think: TA TA TA | ||
| 40 | // Legato makes notes flow together. Think: TAAA | ||
| 41 | #define STACCATO 0.01 | ||
| 42 | #define LEGATO 0 | ||
| 43 | |||
| 44 | // Note Timbre | ||
| 45 | // Changes how the notes sound | ||
| 46 | #define TIMBRE_12 0.125 | ||
| 47 | #define TIMBRE_25 0.250 | ||
| 48 | #define TIMBRE_50 0.500 | ||
| 49 | #define TIMBRE_75 0.750 | ||
| 50 | #define TIMBRE_DEFAULT TIMBRE_50 | ||
| 51 | |||
| 52 | |||
| 53 | // Notes - # = Octave | ||
| 54 | |||
| 55 | #define NOTE_REST 0.00 | ||
| 56 | |||
| 57 | /* These notes are currently bugged | ||
| 58 | #define NOTE_C0 16.35 | ||
| 59 | #define NOTE_CS0 17.32 | ||
| 60 | #define NOTE_D0 18.35 | ||
| 61 | #define NOTE_DS0 19.45 | ||
| 62 | #define NOTE_E0 20.60 | ||
| 63 | #define NOTE_F0 21.83 | ||
| 64 | #define NOTE_FS0 23.12 | ||
| 65 | #define NOTE_G0 24.50 | ||
| 66 | #define NOTE_GS0 25.96 | ||
| 67 | #define NOTE_A0 27.50 | ||
| 68 | #define NOTE_AS0 29.14 | ||
| 69 | #define NOTE_B0 30.87 | ||
| 70 | #define NOTE_C1 32.70 | ||
| 71 | #define NOTE_CS1 34.65 | ||
| 72 | #define NOTE_D1 36.71 | ||
| 73 | #define NOTE_DS1 38.89 | ||
| 74 | #define NOTE_E1 41.20 | ||
| 75 | #define NOTE_F1 43.65 | ||
| 76 | #define NOTE_FS1 46.25 | ||
| 77 | #define NOTE_G1 49.00 | ||
| 78 | #define NOTE_GS1 51.91 | ||
| 79 | #define NOTE_A1 55.00 | ||
| 80 | #define NOTE_AS1 58.27 | ||
| 81 | */ | ||
| 82 | |||
| 83 | #define NOTE_B1 61.74 | ||
| 84 | #define NOTE_C2 65.41 | ||
| 85 | #define NOTE_CS2 69.30 | ||
| 86 | #define NOTE_D2 73.42 | ||
| 87 | #define NOTE_DS2 77.78 | ||
| 88 | #define NOTE_E2 82.41 | ||
| 89 | #define NOTE_F2 87.31 | ||
| 90 | #define NOTE_FS2 92.50 | ||
| 91 | #define NOTE_G2 98.00 | ||
| 92 | #define NOTE_GS2 103.83 | ||
| 93 | #define NOTE_A2 110.00 | ||
| 94 | #define NOTE_AS2 116.54 | ||
| 95 | #define NOTE_B2 123.47 | ||
| 96 | #define NOTE_C3 130.81 | ||
| 97 | #define NOTE_CS3 138.59 | ||
| 98 | #define NOTE_D3 146.83 | ||
| 99 | #define NOTE_DS3 155.56 | ||
| 100 | #define NOTE_E3 164.81 | ||
| 101 | #define NOTE_F3 174.61 | ||
| 102 | #define NOTE_FS3 185.00 | ||
| 103 | #define NOTE_G3 196.00 | ||
| 104 | #define NOTE_GS3 207.65 | ||
| 105 | #define NOTE_A3 220.00 | ||
| 106 | #define NOTE_AS3 233.08 | ||
| 107 | #define NOTE_B3 246.94 | ||
| 108 | #define NOTE_C4 261.63 | ||
| 109 | #define NOTE_CS4 277.18 | ||
| 110 | #define NOTE_D4 293.66 | ||
| 111 | #define NOTE_DS4 311.13 | ||
| 112 | #define NOTE_E4 329.63 | ||
| 113 | #define NOTE_F4 349.23 | ||
| 114 | #define NOTE_FS4 369.99 | ||
| 115 | #define NOTE_G4 392.00 | ||
| 116 | #define NOTE_GS4 415.30 | ||
| 117 | #define NOTE_A4 440.00 | ||
| 118 | #define NOTE_AS4 466.16 | ||
| 119 | #define NOTE_B4 493.88 | ||
| 120 | #define NOTE_C5 523.25 | ||
| 121 | #define NOTE_CS5 554.37 | ||
| 122 | #define NOTE_D5 587.33 | ||
| 123 | #define NOTE_DS5 622.25 | ||
| 124 | #define NOTE_E5 659.26 | ||
| 125 | #define NOTE_F5 698.46 | ||
| 126 | #define NOTE_FS5 739.99 | ||
| 127 | #define NOTE_G5 783.99 | ||
| 128 | #define NOTE_GS5 830.61 | ||
| 129 | #define NOTE_A5 880.00 | ||
| 130 | #define NOTE_AS5 932.33 | ||
| 131 | #define NOTE_B5 987.77 | ||
| 132 | #define NOTE_C6 1046.50 | ||
| 133 | #define NOTE_CS6 1108.73 | ||
| 134 | #define NOTE_D6 1174.66 | ||
| 135 | #define NOTE_DS6 1244.51 | ||
| 136 | #define NOTE_E6 1318.51 | ||
| 137 | #define NOTE_F6 1396.91 | ||
| 138 | #define NOTE_FS6 1479.98 | ||
| 139 | #define NOTE_G6 1567.98 | ||
| 140 | #define NOTE_GS6 1661.22 | ||
| 141 | #define NOTE_A6 1760.00 | ||
| 142 | #define NOTE_AS6 1864.66 | ||
| 143 | #define NOTE_B6 1975.53 | ||
| 144 | #define NOTE_C7 2093.00 | ||
| 145 | #define NOTE_CS7 2217.46 | ||
| 146 | #define NOTE_D7 2349.32 | ||
| 147 | #define NOTE_DS7 2489.02 | ||
| 148 | #define NOTE_E7 2637.02 | ||
| 149 | #define NOTE_F7 2793.83 | ||
| 150 | #define NOTE_FS7 2959.96 | ||
| 151 | #define NOTE_G7 3135.96 | ||
| 152 | #define NOTE_GS7 3322.44 | ||
| 153 | #define NOTE_A7 3520.00 | ||
| 154 | #define NOTE_AS7 3729.31 | ||
| 155 | #define NOTE_B7 3951.07 | ||
| 156 | #define NOTE_C8 4186.01 | ||
| 157 | #define NOTE_CS8 4434.92 | ||
| 158 | #define NOTE_D8 4698.64 | ||
| 159 | #define NOTE_DS8 4978.03 | ||
| 160 | #define NOTE_E8 5274.04 | ||
| 161 | #define NOTE_F8 5587.65 | ||
| 162 | #define NOTE_FS8 5919.91 | ||
| 163 | #define NOTE_G8 6271.93 | ||
| 164 | #define NOTE_GS8 6644.88 | ||
| 165 | #define NOTE_A8 7040.00 | ||
| 166 | #define NOTE_AS8 7458.62 | ||
| 167 | #define NOTE_B8 7902.13 | ||
| 168 | |||
| 169 | // Flat Aliases | ||
| 170 | #define NOTE_DF0 NOTE_CS0 | ||
| 171 | #define NOTE_EF0 NOTE_DS0 | ||
| 172 | #define NOTE_GF0 NOTE_FS0 | ||
| 173 | #define NOTE_AF0 NOTE_GS0 | ||
| 174 | #define NOTE_BF0 NOTE_AS0 | ||
| 175 | #define NOTE_DF1 NOTE_CS1 | ||
| 176 | #define NOTE_EF1 NOTE_DS1 | ||
| 177 | #define NOTE_GF1 NOTE_FS1 | ||
| 178 | #define NOTE_AF1 NOTE_GS1 | ||
| 179 | #define NOTE_BF1 NOTE_AS1 | ||
| 180 | #define NOTE_DF2 NOTE_CS2 | ||
| 181 | #define NOTE_EF2 NOTE_DS2 | ||
| 182 | #define NOTE_GF2 NOTE_FS2 | ||
| 183 | #define NOTE_AF2 NOTE_GS2 | ||
| 184 | #define NOTE_BF2 NOTE_AS2 | ||
| 185 | #define NOTE_DF3 NOTE_CS3 | ||
| 186 | #define NOTE_EF3 NOTE_DS3 | ||
| 187 | #define NOTE_GF3 NOTE_FS3 | ||
| 188 | #define NOTE_AF3 NOTE_GS3 | ||
| 189 | #define NOTE_BF3 NOTE_AS3 | ||
| 190 | #define NOTE_DF4 NOTE_CS4 | ||
| 191 | #define NOTE_EF4 NOTE_DS4 | ||
| 192 | #define NOTE_GF4 NOTE_FS4 | ||
| 193 | #define NOTE_AF4 NOTE_GS4 | ||
| 194 | #define NOTE_BF4 NOTE_AS4 | ||
| 195 | #define NOTE_DF5 NOTE_CS5 | ||
| 196 | #define NOTE_EF5 NOTE_DS5 | ||
| 197 | #define NOTE_GF5 NOTE_FS5 | ||
| 198 | #define NOTE_AF5 NOTE_GS5 | ||
| 199 | #define NOTE_BF5 NOTE_AS5 | ||
| 200 | #define NOTE_DF6 NOTE_CS6 | ||
| 201 | #define NOTE_EF6 NOTE_DS6 | ||
| 202 | #define NOTE_GF6 NOTE_FS6 | ||
| 203 | #define NOTE_AF6 NOTE_GS6 | ||
| 204 | #define NOTE_BF6 NOTE_AS6 | ||
| 205 | #define NOTE_DF7 NOTE_CS7 | ||
| 206 | #define NOTE_EF7 NOTE_DS7 | ||
| 207 | #define NOTE_GF7 NOTE_FS7 | ||
| 208 | #define NOTE_AF7 NOTE_GS7 | ||
| 209 | #define NOTE_BF7 NOTE_AS7 | ||
| 210 | #define NOTE_DF8 NOTE_CS8 | ||
| 211 | #define NOTE_EF8 NOTE_DS8 | ||
| 212 | #define NOTE_GF8 NOTE_FS8 | ||
| 213 | #define NOTE_AF8 NOTE_GS8 | ||
| 214 | #define NOTE_BF8 NOTE_AS8 | ||
| 215 | |||
| 216 | |||
| 217 | #endif \ No newline at end of file | ||
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h new file mode 100644 index 000000000..fc6fcdeef --- /dev/null +++ b/quantum/audio/song_list.h | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | #include "musical_notes.h" | ||
| 2 | |||
| 3 | #ifndef SONG_LIST_H | ||
| 4 | #define SONG_LIST_H | ||
| 5 | |||
| 6 | #define ODE_TO_JOY \ | ||
| 7 | Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \ | ||
| 8 | Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \ | ||
| 9 | Q__NOTE(_C4), Q__NOTE(_C4), Q__NOTE(_D4), Q__NOTE(_E4), \ | ||
| 10 | QD_NOTE(_E4), E__NOTE(_D4), H__NOTE(_D4), | ||
| 11 | |||
| 12 | #define ROCK_A_BYE_BABY \ | ||
| 13 | QD_NOTE(_B4), E__NOTE(_D4), Q__NOTE(_B5), \ | ||
| 14 | H__NOTE(_A5), Q__NOTE(_G5), \ | ||
| 15 | QD_NOTE(_B4), E__NOTE(_D5), Q__NOTE(_G5), \ | ||
| 16 | H__NOTE(_FS5), | ||
| 17 | |||
| 18 | #define CLOSE_ENCOUNTERS_5_NOTE \ | ||
| 19 | Q__NOTE(_D5), \ | ||
| 20 | Q__NOTE(_E5), \ | ||
| 21 | Q__NOTE(_C5), \ | ||
| 22 | Q__NOTE(_C4), \ | ||
| 23 | Q__NOTE(_G4), | ||
| 24 | |||
| 25 | #define DOE_A_DEER \ | ||
| 26 | QD_NOTE(_C4), E__NOTE(_D4), \ | ||
| 27 | QD_NOTE(_E4), E__NOTE(_C4), \ | ||
| 28 | Q__NOTE(_E4), Q__NOTE(_C4), \ | ||
| 29 | Q__NOTE(_E4), | ||
| 30 | |||
| 31 | #define GOODBYE_SOUND \ | ||
| 32 | E__NOTE(_E7), \ | ||
| 33 | E__NOTE(_A6), \ | ||
| 34 | ED_NOTE(_E6), | ||
| 35 | |||
| 36 | #define STARTUP_SOUND \ | ||
| 37 | ED_NOTE(_E7 ), \ | ||
| 38 | E__NOTE(_CS7), \ | ||
| 39 | E__NOTE(_E6 ), \ | ||
| 40 | E__NOTE(_A6 ), \ | ||
| 41 | M__NOTE(_CS7, 20), | ||
| 42 | |||
| 43 | #define QWERTY_SOUND \ | ||
| 44 | E__NOTE(_GS6 ), \ | ||
| 45 | E__NOTE(_A6 ), \ | ||
| 46 | S__NOTE(_REST), \ | ||
| 47 | Q__NOTE(_E7 ), | ||
| 48 | |||
| 49 | #define COLEMAK_SOUND \ | ||
| 50 | E__NOTE(_GS6 ), \ | ||
| 51 | E__NOTE(_A6 ), \ | ||
| 52 | S__NOTE(_REST), \ | ||
| 53 | ED_NOTE(_E7 ), \ | ||
| 54 | S__NOTE(_REST), \ | ||
| 55 | ED_NOTE(_GS7 ), | ||
| 56 | |||
| 57 | #define DVORAK_SOUND \ | ||
| 58 | E__NOTE(_GS6 ), \ | ||
| 59 | E__NOTE(_A6 ), \ | ||
| 60 | S__NOTE(_REST), \ | ||
| 61 | E__NOTE(_E7 ), \ | ||
| 62 | S__NOTE(_REST), \ | ||
| 63 | E__NOTE(_FS7 ), \ | ||
| 64 | S__NOTE(_REST), \ | ||
| 65 | E__NOTE(_E7 ), | ||
| 66 | |||
| 67 | #define PLOVER_SOUND \ | ||
| 68 | E__NOTE(_GS6 ), \ | ||
| 69 | E__NOTE(_A6 ), \ | ||
| 70 | S__NOTE(_REST), \ | ||
| 71 | ED_NOTE(_E7 ), \ | ||
| 72 | S__NOTE(_REST), \ | ||
| 73 | ED_NOTE(_A7 ), | ||
| 74 | |||
| 75 | #define PLOVER_GOODBYE_SOUND \ | ||
| 76 | E__NOTE(_GS6 ), \ | ||
| 77 | E__NOTE(_A6 ), \ | ||
| 78 | S__NOTE(_REST), \ | ||
| 79 | ED_NOTE(_A7 ), \ | ||
| 80 | S__NOTE(_REST), \ | ||
| 81 | ED_NOTE(_E7 ), | ||
| 82 | |||
| 83 | #define MUSIC_SCALE_SOUND \ | ||
| 84 | E__NOTE(_A5 ), \ | ||
| 85 | E__NOTE(_B5 ), \ | ||
| 86 | E__NOTE(_CS6), \ | ||
| 87 | E__NOTE(_D6 ), \ | ||
| 88 | E__NOTE(_E6 ), \ | ||
| 89 | E__NOTE(_FS6), \ | ||
| 90 | E__NOTE(_GS6), \ | ||
| 91 | E__NOTE(_A6 ), | ||
| 92 | |||
| 93 | #define CAPS_LOCK_ON_SOUND \ | ||
| 94 | E__NOTE(_A3), \ | ||
| 95 | E__NOTE(_B3), | ||
| 96 | |||
| 97 | #define CAPS_LOCK_OFF_SOUND \ | ||
| 98 | E__NOTE(_B3), \ | ||
| 99 | E__NOTE(_A3), | ||
| 100 | |||
| 101 | #define SCROLL_LOCK_ON_SOUND \ | ||
| 102 | E__NOTE(_D4), \ | ||
| 103 | E__NOTE(_E4), | ||
| 104 | |||
| 105 | #define SCROLL_LOCK_OFF_SOUND \ | ||
| 106 | E__NOTE(_E4), \ | ||
| 107 | E__NOTE(_D4), | ||
| 108 | |||
| 109 | #define NUM_LOCK_ON_SOUND \ | ||
| 110 | E__NOTE(_D5), \ | ||
| 111 | E__NOTE(_E5), | ||
| 112 | |||
| 113 | #define NUM_LOCK_OFF_SOUND \ | ||
| 114 | E__NOTE(_E5), \ | ||
| 115 | E__NOTE(_D5), | ||
| 116 | |||
| 117 | #endif | ||
diff --git a/quantum/audio/vibrato_lut.h b/quantum/audio/vibrato_lut.h new file mode 100644 index 000000000..a2b1f3e5c --- /dev/null +++ b/quantum/audio/vibrato_lut.h | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #include <avr/io.h> | ||
| 2 | #include <avr/interrupt.h> | ||
| 3 | #include <avr/pgmspace.h> | ||
| 4 | |||
| 5 | #define VIBRATO_LUT_LENGTH 20 | ||
| 6 | |||
| 7 | const float VIBRATO_LUT[VIBRATO_LUT_LENGTH] = { \ | ||
| 8 | 1.00223368114872, | ||
| 9 | 1.00425299436105, | ||
| 10 | 1.00585842560279, | ||
| 11 | 1.00689052852052, | ||
| 12 | 1.0072464122237, | ||
| 13 | 1.00689052852052, | ||
| 14 | 1.00585842560279, | ||
| 15 | 1.00425299436105, | ||
| 16 | 1.00223368114872, | ||
| 17 | 1, | ||
| 18 | 0.99777129706302, | ||
| 19 | 0.99576501699778, | ||
| 20 | 0.994175695650927, | ||
| 21 | 0.993156625943589, | ||
| 22 | 0.992805720491269, | ||
| 23 | 0.993156625943589, | ||
| 24 | 0.994175695650927, | ||
| 25 | 0.99576501699778, | ||
| 26 | 0.99777129706302, | ||
| 27 | 1 | ||
| 28 | }; \ No newline at end of file | ||
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c new file mode 100644 index 000000000..51652927b --- /dev/null +++ b/quantum/audio/voices.c | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | #include "voices.h" | ||
| 2 | |||
| 3 | extern uint16_t envelope_index; | ||
| 4 | extern float note_timbre; | ||
| 5 | |||
| 6 | voice_type voice = default_voice; | ||
| 7 | |||
| 8 | void set_voice(voice_type v) { | ||
| 9 | voice = v; | ||
| 10 | } | ||
| 11 | |||
| 12 | float voice_envelope(float frequency) { | ||
| 13 | // envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz | ||
| 14 | uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency)); | ||
| 15 | |||
| 16 | switch (voice) { | ||
| 17 | case default_voice: | ||
| 18 | // nothing here on purpose | ||
| 19 | break; | ||
| 20 | case butts_fader: | ||
| 21 | switch (compensated_index) { | ||
| 22 | case 0 ... 9: | ||
| 23 | frequency = frequency / 4; | ||
| 24 | note_timbre = TIMBRE_12; | ||
| 25 | break; | ||
| 26 | case 10 ... 19: | ||
| 27 | frequency = frequency / 2; | ||
| 28 | note_timbre = TIMBRE_12; | ||
| 29 | break; | ||
| 30 | case 20 ... 200: | ||
| 31 | note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2)*.125; | ||
| 32 | break; | ||
| 33 | default: | ||
| 34 | note_timbre = 0; | ||
| 35 | break; | ||
| 36 | } | ||
| 37 | break; | ||
| 38 | case octave_crunch: | ||
| 39 | switch (compensated_index) { | ||
| 40 | case 0 ... 9: | ||
| 41 | case 20 ... 24: | ||
| 42 | case 30 ... 32: | ||
| 43 | frequency = frequency / 2; | ||
| 44 | note_timbre = TIMBRE_12; | ||
| 45 | break; | ||
| 46 | case 10 ... 19: | ||
| 47 | case 25 ... 29: | ||
| 48 | case 33 ... 35: | ||
| 49 | frequency = frequency * 2; | ||
| 50 | note_timbre = TIMBRE_12; | ||
| 51 | break; | ||
| 52 | default: | ||
| 53 | note_timbre = TIMBRE_12; | ||
| 54 | break; | ||
| 55 | } | ||
| 56 | break; | ||
| 57 | } | ||
| 58 | |||
| 59 | return frequency; | ||
| 60 | } \ No newline at end of file | ||
diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h new file mode 100644 index 000000000..317f5d98c --- /dev/null +++ b/quantum/audio/voices.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #include <stdint.h> | ||
| 2 | #include <stdbool.h> | ||
| 3 | #include <avr/io.h> | ||
| 4 | #include <util/delay.h> | ||
| 5 | #include "musical_notes.h" | ||
| 6 | #include "song_list.h" | ||
| 7 | |||
| 8 | #ifndef VOICES_H | ||
| 9 | #define VOICES_H | ||
| 10 | |||
| 11 | float voice_envelope(float frequency); | ||
| 12 | |||
| 13 | typedef enum { | ||
| 14 | default_voice, | ||
| 15 | butts_fader, | ||
| 16 | octave_crunch | ||
| 17 | } voice_type; | ||
| 18 | |||
| 19 | void set_voice(voice_type v); | ||
| 20 | |||
| 21 | #endif \ No newline at end of file | ||
diff --git a/quantum/audio/wave.h b/quantum/audio/wave.h new file mode 100644 index 000000000..6ebc34851 --- /dev/null +++ b/quantum/audio/wave.h | |||
| @@ -0,0 +1,265 @@ | |||
| 1 | #include <avr/io.h> | ||
| 2 | #include <avr/interrupt.h> | ||
| 3 | #include <avr/pgmspace.h> | ||
| 4 | |||
| 5 | #define SINE_LENGTH 2048 | ||
| 6 | |||
| 7 | const uint8_t sinewave[] PROGMEM= //2048 values | ||
| 8 | { | ||
| 9 | 0x80,0x80,0x80,0x81,0x81,0x81,0x82,0x82, | ||
| 10 | 0x83,0x83,0x83,0x84,0x84,0x85,0x85,0x85, | ||
| 11 | 0x86,0x86,0x87,0x87,0x87,0x88,0x88,0x88, | ||
| 12 | 0x89,0x89,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c, | ||
| 13 | 0x8c,0x8c,0x8d,0x8d,0x8e,0x8e,0x8e,0x8f, | ||
| 14 | 0x8f,0x8f,0x90,0x90,0x91,0x91,0x91,0x92, | ||
| 15 | 0x92,0x93,0x93,0x93,0x94,0x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||
| 58 | 0xf6,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7, | ||
| 59 | 0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8, | ||
| 60 | 0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9, | ||
| 61 | 0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa, | ||
| 62 | 0xfa,0xfa,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb, | ||
| 63 | 0xfb,0xfb,0xfb,0xfb,0xfc,0xfc,0xfc,0xfc, | ||
| 64 | 0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc, | ||
| 65 | 0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd, | ||
| 66 | 0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfe,0xfe, | ||
| 67 | 0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe, | ||
| 68 | 0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe, | ||
| 69 | 0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xff, | ||
| 70 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, | ||
| 71 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, | ||
| 72 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, | ||
| 73 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, | ||
| 74 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, | ||
| 75 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, | ||
| 76 | 0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xfe, | ||
| 77 | 0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe, | ||
| 78 | 0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe, | ||
| 79 | 0xfe,0xfe,0xfe,0xfd,0xf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0,0xaf,0xaf,0xae,0xae,0xae, | ||
| 122 | 0xad,0xad,0xad,0xac,0xac,0xac,0xab,0xab, | ||
| 123 | 0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xa8,0xa8, | ||
| 124 | 0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa5,0xa5, | ||
| 125 | 0xa5,0xa4,0xa4,0xa3,0xa3,0xa3,0xa2,0xa2, | ||
| 126 | 0xa2,0xa1,0xa1,0xa0,0xa0,0xa0,0x9f,0x9f, | ||
| 127 | 0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0x9c,0x9c, | ||
| 128 | 0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,0x99,0x99, | ||
| 129 | 0x98,0x98,0x98,0x97,0x97,0x96,0x96,0x96, | ||
| 130 | 0x95,0x95,0x95,0x94,0x94,0x93,0x93,0x93, | ||
| 131 | 0x92,0x92,0x91,0x91,0x91,0x90,0x90,0x8f, | ||
| 132 | 0x8f,0x8f,0x8e,0x8e,0x8e,0x8d,0x8d,0x8c, | ||
| 133 | 0x8c,0x8c,0x8b,0x8b,0x8a,0x8a,0x8a,0x89, | ||
| 134 | 0x89,0x88,0x88,0x88,0x87,0x87,0x87,0x86, | ||
| 135 | 0x86,0x85,0x85,0x85,0x84,0x84,0x83,0x83, | ||
| 136 | 0x83,0x82,0x82,0x81,0x81,0x81,0x80,0x80, | ||
| 137 | 0x80,0x7f,0x7f,0x7e,0x7e,0x7e,0x7d,0x7d, | ||
| 138 | 0x7c,0x7c,0x7c,0x7b,0x7b,0x7a,0x7a,0x7a, | ||
| 139 | 0x79,0x79,0x78,0x78,0x78,0x77,0x77,0x77, | ||
| 140 | 0x76,0x76,0x75,0x75,0x75,0x74,0x74,0x73, | ||
| 141 | 0x73,0x73,0x72,0x72,0x71,0x71,0x71,0x70, | ||
| 142 | 0x70,0x70,0x6f,0x6f,0x6e,0x6e,0x6e,0x6d, | ||
| 143 | 0x6d,0x6c,0x6c,0x6c,0x6b,0x6b,0x6a,0x6a, | ||
| 144 | 0x6a,0x69,0x69,0x69,0x68,0x68,0x67,0x67, | ||
| 145 | 0x67,0x66,0x66,0x65,0x65,0x65,0x64,0x64, | ||
| 146 | 0x64,0x63,0x63,0x62,0x62,0x62,0x61,0x61, | ||
| 147 | 0x61,0x60,0x60,0x5f,0x5f,0x5f,0x5e,0x5e, | ||
| 148 | 0x5d,0x5d,0x5d,0x5c,0x5c,0x5c,0x5b,0x5b, | ||
| 149 | 0x5a,0x5a,0x5a,0x59,0x59,0x59,0x58,0x58, | ||
| 150 | 0x58,0x57,0x57,0x56,0x56,0x56,0x55,0x55, | ||
| 151 | 0x55,0x54,0x54,0x53,0x53,0x53,0x52,0x52, | ||
| 152 | 0x52,0x51,0x51,0x51,0x50,0x50,0x4f,0x4f, | ||
| 153 | 0x4f,0x4e,0x4e,0x4e,0x4d,0x4d,0x4d,0x4c, | ||
| 154 | 0x4c,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x49, | ||
| 155 | 0x49,0x49,0x48,0x48,0x48,0x47,0x47,0x47, | ||
| 156 | 0x46,0x46,0x45,0x45,0x45,0x44,0x44,0x44, | ||
| 157 | 0x43,0x43,0x43,0x42,0x42,0x42,0x41,0x41, | ||
| 158 | 0x41,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x3e, | ||
| 159 | 0x3e,0x3e,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c, | ||
| 160 | 0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x39,0x39, | ||
| 161 | 0x39,0x38,0x38,0x38,0x37,0x37,0x37,0x36, | ||
| 162 | 0x36,0x36,0x35,0x35,0x35,0x34,0x34,0x34, | ||
| 163 | 0x34,0x33,0x33,0x33,0x32,0x32,0x32,0x31, | ||
| 164 | 0x31,0x31,0x30,0x30,0x30,0x30,0x2f,0x2f, | ||
| 165 | 0x2f,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d, | ||
| 166 | 0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2a,0x2a, | ||
| 167 | 0x2a,0x2a,0x29,0x29,0x29,0x28,0x28,0x28, | ||
| 168 | 0x28,0x27,0x27,0x27,0x26,0x26,0x26,0x26, | ||
| 169 | 0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x23, | ||
| 170 | 0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x21, | ||
| 171 | 0x21,0x21,0x21,0x20,0x20,0x20,0x1f,0x1f, | ||
| 172 | 0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, | ||
| 173 | 0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b, | ||
| 174 | 0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x19, | ||
| 175 | 0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x17, | ||
| 176 | 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16, | ||
| 177 | 0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14, | ||
| 178 | 0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x12, | ||
| 179 | 0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11, | ||
| 180 | 0x11,0x10,0x10,0x10,0x10,0x10,0xf,0xf, | ||
| 181 | 0xf,0xf,0xf,0xf,0xe,0xe,0xe,0xe, | ||
| 182 | 0xe,0xd,0xd,0xd,0xd,0xd,0xd,0xc, | ||
| 183 | 0xc,0xc,0xc,0xc,0xc,0xb,0xb,0xb, | ||
| 184 | 0xb,0xb,0xb,0xa,0xa,0xa,0xa,0xa, | ||
| 185 | 0xa,0xa,0x9,0x9,0x9,0x9,0x9,0x9, | ||
| 186 | 0x9,0x8,0x8,0x8,0x8,0x8,0x8,0x8, | ||
| 187 | 0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7, | ||
| 188 | 0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6, | ||
| 189 | 0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5, | ||
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7,0x7,0x7,0x7,0x7,0x7, | ||
| 215 | 0x7,0x8,0x8,0x8,0x8,0x8,0x8,0x8, | ||
| 216 | 0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xa, | ||
| 217 | 0xa,0xa,0xa,0xa,0xa,0xa,0xb,0xb, | ||
| 218 | 0xb,0xb,0xb,0xb,0xc,0xc,0xc,0xc, | ||
| 219 | 0xc,0xc,0xd,0xd,0xd,0xd,0xd,0xd, | ||
| 220 | 0xe,0xe,0xe,0xe,0xe,0xf,0xf,0xf, | ||
| 221 | 0xf,0xf,0xf,0x10,0x10,0x10,0x10,0x10, | ||
| 222 | 0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12, | ||
| 223 | 0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x14, | ||
| 224 | 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, | ||
| 225 | 0x15,0x16,0x16,0x16,0x16,0x17,0x17,0x17, | ||
| 226 | 0x17,0x17,0x18,0x18,0x18,0x18,0x19,0x19, | ||
| 227 | 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, | ||
| 228 | 0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d, | ||
| 229 | 0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f, | ||
| 230 | 0x1f,0x1f,0x1f,0x20,0x20,0x20,0x21,0x21, | ||
| 231 | 0x21,0x21,0x22,0x22,0x22,0x22,0x23,0x23, | ||
| 232 | 0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x25, | ||
| 233 | 0x25,0x26,0x26,0x26,0x26,0x27,0x27,0x27, | ||
| 234 | 0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a, | ||
| 235 | 0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2c,0x2c, | ||
| 236 | 0x2c,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, | ||
| 237 | 0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x31, | ||
| 238 | 0x31,0x31,0x32,0x32,0x32,0x33,0x33,0x33, | ||
| 239 | 0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x36, | ||
| 240 | 0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38, | ||
| 241 | 0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b, | ||
| 242 | 0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3e, | ||
| 243 | 0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40, | ||
| 244 | 0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43, | ||
| 245 | 0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x46, | ||
| 246 | 0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x49, | ||
| 247 | 0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b, | ||
| 248 | 0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e, | ||
| 249 | 0x4f,0x4f,0x4f,0x50,0x50,0x51,0x51,0x51, | ||
| 250 | 0x52,0x52,0x52,0x53,0x53,0x53,0x54,0x54, | ||
| 251 | 0x55,0x55,0x55,0x56,0x56,0x56,0x57,0x57, | ||
| 252 | 0x58,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a, | ||
| 253 | 0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d, | ||
| 254 | 0x5d,0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x60, | ||
| 255 | 0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x63, | ||
| 256 | 0x64,0x64,0x64,0x65,0x65,0x65,0x66,0x66, | ||
| 257 | 0x67,0x67,0x67,0x68,0x68,0x69,0x69,0x69, | ||
| 258 | 0x6a,0x6a,0x6a,0x6b,0x6b,0x6c,0x6c,0x6c, | ||
| 259 | 0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x70, | ||
| 260 | 0x70,0x70,0x71,0x71,0x71,0x72,0x72,0x73, | ||
| 261 | 0x73,0x73,0x74,0x74,0x75,0x75,0x75,0x76, | ||
| 262 | 0x76,0x77,0x77,0x77,0x78,0x78,0x78,0x79, | ||
| 263 | 0x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c, | ||
| 264 | 0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f | ||
| 265 | }; \ No newline at end of file | ||
