Merge branch 'master' into planck_thk

This commit is contained in:
Jack Humbert 2019-08-01 09:09:26 -04:00 committed by GitHub
commit 21c2324c3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8128 changed files with 356427 additions and 96548 deletions

View file

@ -165,7 +165,7 @@ uint16_t notes_count;
bool notes_repeat;
bool note_resting = false;
uint8_t current_note = 0;
uint16_t current_note = 0;
uint8_t rest_counter = 0;
#ifdef VIBRATO_ENABLE

View file

@ -54,7 +54,7 @@ uint16_t notes_count;
bool notes_repeat;
bool note_resting = false;
uint8_t current_note = 0;
uint16_t current_note = 0;
uint8_t rest_counter = 0;
#ifdef VIBRATO_ENABLE
@ -79,7 +79,10 @@ float startup_song[][2] = STARTUP_SONG;
static void gpt_cb8(GPTDriver *gptp);
#define DAC_BUFFER_SIZE 720
#define DAC_BUFFER_SIZE 100
#ifndef DAC_SAMPLE_MAX
#define DAC_SAMPLE_MAX 65535U
#endif
#define START_CHANNEL_1() gptStart(&GPTD6, &gpt6cfg1); \
gptStartContinuous(&GPTD6, 2U)
@ -95,8 +98,8 @@ static void gpt_cb8(GPTDriver *gptp);
RESTART_CHANNEL_1()
#define UPDATE_CHANNEL_2_FREQ(freq) gpt7cfg1.frequency = freq * DAC_BUFFER_SIZE; \
RESTART_CHANNEL_2()
#define GET_CHANNEL_1_FREQ gpt6cfg1.frequency
#define GET_CHANNEL_2_FREQ gpt7cfg1.frequency
#define GET_CHANNEL_1_FREQ (uint16_t)(gpt6cfg1.frequency * DAC_BUFFER_SIZE)
#define GET_CHANNEL_2_FREQ (uint16_t)(gpt7cfg1.frequency * DAC_BUFFER_SIZE)
/*
@ -202,132 +205,16 @@ GPTConfig gpt8cfg1 = {
// squarewave
static const dacsample_t dac_buffer[DAC_BUFFER_SIZE] = {
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
// First half is max, second half is 0
[0 ... DAC_BUFFER_SIZE/2-1] = DAC_SAMPLE_MAX,
[DAC_BUFFER_SIZE/2 ... DAC_BUFFER_SIZE -1] = 0,
};
// squarewave
static const dacsample_t dac_buffer_2[DAC_BUFFER_SIZE] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047
// opposite of dac_buffer above
[0 ... DAC_BUFFER_SIZE/2-1] = 0,
[DAC_BUFFER_SIZE/2 ... DAC_BUFFER_SIZE -1] = DAC_SAMPLE_MAX,
};
/*
@ -363,7 +250,7 @@ static void error_cb1(DACDriver *dacp, dacerror_t err) {
}
static const DACConfig dac1cfg1 = {
.init = 2047U,
.init = DAC_SAMPLE_MAX,
.datamode = DAC_DHRM_12BIT_RIGHT
};
@ -375,7 +262,7 @@ static const DACConversionGroup dacgrpcfg1 = {
};
static const DACConfig dac1cfg2 = {
.init = 2047U,
.init = DAC_SAMPLE_MAX,
.datamode = DAC_DHRM_12BIT_RIGHT
};
@ -386,19 +273,24 @@ static const DACConversionGroup dacgrpcfg2 = {
.trigger = DAC_TRG(0)
};
void audio_init()
{
void audio_init() {
if (audio_initialized)
return;
if (audio_initialized) {
return;
}
// Check EEPROM
// if (!eeconfig_is_enabled())
// {
// eeconfig_init();
// }
// audio_config.raw = eeconfig_read_audio();
// Check EEPROM
#if defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE)
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
audio_config.raw = eeconfig_read_audio();
#else // ARM EEPROM
audio_config.enable = true;
#ifdef AUDIO_CLICKY_ON
audio_config.clicky_enable = true;
#endif
#endif // ARM EEPROM
/*
* Starting DAC1 driver, setting up the output pin as analog as suggested
@ -421,16 +313,17 @@ void audio_init()
dacStartConversion(&DACD1, &dacgrpcfg1, (dacsample_t *)dac_buffer, DAC_BUFFER_SIZE);
dacStartConversion(&DACD2, &dacgrpcfg2, (dacsample_t *)dac_buffer_2, DAC_BUFFER_SIZE);
audio_initialized = true;
audio_initialized = true;
if (audio_config.enable) {
PLAY_SONG(startup_song);
}
if (audio_config.enable) {
PLAY_SONG(startup_song);
} else {
stop_all_notes();
}
}
void stop_all_notes()
{
void stop_all_notes() {
dprintf("audio stop all notes");
if (!audio_initialized) {
@ -455,347 +348,347 @@ void stop_all_notes()
}
}
void stop_note(float freq)
{
dprintf("audio stop note freq=%d", (int)freq);
void stop_note(float freq) {
dprintf("audio stop note freq=%d", (int)freq);
if (playing_note) {
if (!audio_initialized) {
audio_init();
}
for (int i = 7; i >= 0; i--) {
if (frequencies[i] == freq) {
frequencies[i] = 0;
volumes[i] = 0;
for (int j = i; (j < 7); j++) {
frequencies[j] = frequencies[j+1];
frequencies[j+1] = 0;
volumes[j] = volumes[j+1];
volumes[j+1] = 0;
}
break;
}
}
voices--;
if (voices < 0)
voices = 0;
if (voice_place >= voices) {
voice_place = 0;
}
if (voices == 0) {
STOP_CHANNEL_1();
STOP_CHANNEL_2();
gptStopTimer(&GPTD8);
frequency = 0;
frequency_alt = 0;
volume = 0;
playing_note = false;
}
if (playing_note) {
if (!audio_initialized) {
audio_init();
}
for (int i = 7; i >= 0; i--) {
if (frequencies[i] == freq) {
frequencies[i] = 0;
volumes[i] = 0;
for (int j = i; (j < 7); j++) {
frequencies[j] = frequencies[j+1];
frequencies[j+1] = 0;
volumes[j] = volumes[j+1];
volumes[j+1] = 0;
}
break;
}
}
voices--;
if (voices < 0) {
voices = 0;
}
if (voice_place >= voices) {
voice_place = 0;
}
if (voices == 0) {
STOP_CHANNEL_1();
STOP_CHANNEL_2();
gptStopTimer(&GPTD8);
frequency = 0;
frequency_alt = 0;
volume = 0;
playing_note = false;
}
}
}
#ifdef VIBRATO_ENABLE
float mod(float a, int b)
{
float r = fmod(a, b);
return r < 0 ? r + b : r;
float mod(float a, int b) {
float r = fmod(a, b);
return r < 0 ? r + b : r;
}
float vibrato(float average_freq) {
#ifdef VIBRATO_STRENGTH_ENABLE
float vibrated_freq = average_freq * pow(vibrato_lut[(int)vibrato_counter], vibrato_strength);
#else
float vibrated_freq = average_freq * vibrato_lut[(int)vibrato_counter];
#endif
vibrato_counter = mod((vibrato_counter + vibrato_rate * (1.0 + 440.0/average_freq)), VIBRATO_LUT_LENGTH);
return vibrated_freq;
#ifdef VIBRATO_STRENGTH_ENABLE
float vibrated_freq = average_freq * pow(vibrato_lut[(int)vibrato_counter], vibrato_strength);
#else
float vibrated_freq = average_freq * vibrato_lut[(int)vibrato_counter];
#endif
vibrato_counter = mod((vibrato_counter + vibrato_rate * (1.0 + 440.0/average_freq)), VIBRATO_LUT_LENGTH);
return vibrated_freq;
}
#endif
static void gpt_cb8(GPTDriver *gptp) {
float freq;
float freq;
if (playing_note) {
if (voices > 0) {
if (playing_note) {
if (voices > 0) {
float freq_alt = 0;
if (voices > 1) {
if (polyphony_rate == 0) {
if (glissando) {
if (frequency_alt != 0 && frequency_alt < frequencies[voices - 2] && frequency_alt < frequencies[voices - 2] * pow(2, -440/frequencies[voices - 2]/12/2)) {
frequency_alt = frequency_alt * pow(2, 440/frequency_alt/12/2);
} else if (frequency_alt != 0 && frequency_alt > frequencies[voices - 2] && frequency_alt > frequencies[voices - 2] * pow(2, 440/frequencies[voices - 2]/12/2)) {
frequency_alt = frequency_alt * pow(2, -440/frequency_alt/12/2);
} else {
frequency_alt = frequencies[voices - 2];
}
} else {
frequency_alt = frequencies[voices - 2];
}
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq_alt = vibrato(frequency_alt);
} else {
freq_alt = frequency_alt;
}
#else
freq_alt = frequency_alt;
#endif
}
if (envelope_index < 65535) {
envelope_index++;
}
freq_alt = voice_envelope(freq_alt);
if (freq_alt < 30.517578125) {
freq_alt = 30.52;
}
if (GET_CHANNEL_2_FREQ != (uint16_t)freq_alt) {
UPDATE_CHANNEL_2_FREQ(freq_alt);
} else {
RESTART_CHANNEL_2();
}
//note_timbre;
}
if (polyphony_rate > 0) {
if (voices > 1) {
voice_place %= voices;
if (place++ > (frequencies[voice_place] / polyphony_rate)) {
voice_place = (voice_place + 1) % voices;
place = 0.0;
}
}
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequencies[voice_place]);
} else {
freq = frequencies[voice_place];
}
#else
freq = frequencies[voice_place];
#endif
float freq_alt = 0;
if (voices > 1) {
if (polyphony_rate == 0) {
if (glissando) {
if (frequency_alt != 0 && frequency_alt < frequencies[voices - 2] && frequency_alt < frequencies[voices - 2] * pow(2, -440/frequencies[voices - 2]/12/2)) {
frequency_alt = frequency_alt * pow(2, 440/frequency_alt/12/2);
} else if (frequency_alt != 0 && frequency_alt > frequencies[voices - 2] && frequency_alt > frequencies[voices - 2] * pow(2, 440/frequencies[voices - 2]/12/2)) {
frequency_alt = frequency_alt * pow(2, -440/frequency_alt/12/2);
} else {
if (glissando) {
if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) {
frequency = frequency * pow(2, 440/frequency/12/2);
} else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) {
frequency = frequency * pow(2, -440/frequency/12/2);
} else {
frequency = frequencies[voices - 1];
}
} else {
frequency = frequencies[voices - 1];
}
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequency);
} else {
freq = frequency;
}
#else
freq = frequency;
#endif
frequency_alt = frequencies[voices - 2];
}
} else {
frequency_alt = frequencies[voices - 2];
}
if (envelope_index < 65535) {
envelope_index++;
}
freq = voice_envelope(freq);
if (freq < 30.517578125) {
freq = 30.52;
}
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
UPDATE_CHANNEL_1_FREQ(freq);
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq_alt = vibrato(frequency_alt);
} else {
RESTART_CHANNEL_1();
freq_alt = frequency_alt;
}
//note_timbre;
#else
freq_alt = frequency_alt;
#endif
}
}
if (playing_notes) {
if (note_frequency > 0) {
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(note_frequency);
} else {
freq = note_frequency;
}
#else
freq = note_frequency;
#endif
if (envelope_index < 65535) {
envelope_index++;
}
if (envelope_index < 65535) {
envelope_index++;
}
freq = voice_envelope(freq);
freq_alt = voice_envelope(freq_alt);
if (freq_alt < 30.517578125) {
freq_alt = 30.52;
}
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
UPDATE_CHANNEL_1_FREQ(freq);
UPDATE_CHANNEL_2_FREQ(freq);
}
//note_timbre;
if (GET_CHANNEL_2_FREQ != (uint16_t)freq_alt) {
UPDATE_CHANNEL_2_FREQ(freq_alt);
} else {
// gptStopTimer(&GPTD6);
// gptStopTimer(&GPTD7);
RESTART_CHANNEL_2();
}
//note_timbre;
}
if (polyphony_rate > 0) {
if (voices > 1) {
voice_place %= voices;
if (place++ > (frequencies[voice_place] / polyphony_rate)) {
voice_place = (voice_place + 1) % voices;
place = 0.0;
}
}
note_position++;
bool end_of_note = false;
if (GET_CHANNEL_1_FREQ > 0) {
if (!note_resting)
end_of_note = (note_position >= (note_length*8 - 1));
else
end_of_note = (note_position >= (note_length*8));
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequencies[voice_place]);
} else {
freq = frequencies[voice_place];
}
#else
freq = frequencies[voice_place];
#endif
} else {
if (glissando) {
if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) {
frequency = frequency * pow(2, 440/frequency/12/2);
} else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) {
frequency = frequency * pow(2, -440/frequency/12/2);
} else {
frequency = frequencies[voices - 1];
}
} else {
end_of_note = (note_position >= (note_length*8));
frequency = frequencies[voices - 1];
}
if (end_of_note) {
current_note++;
if (current_note >= notes_count) {
if (notes_repeat) {
current_note = 0;
} else {
STOP_CHANNEL_1();
STOP_CHANNEL_2();
// gptStopTimer(&GPTD8);
playing_notes = false;
return;
}
}
if (!note_resting) {
note_resting = true;
current_note--;
if ((*notes_pointer)[current_note][0] == (*notes_pointer)[current_note + 1][0]) {
note_frequency = 0;
note_length = 1;
} else {
note_frequency = (*notes_pointer)[current_note][0];
note_length = 1;
}
} else {
note_resting = false;
envelope_index = 0;
note_frequency = (*notes_pointer)[current_note][0];
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
}
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequency);
} else {
freq = frequency;
}
#else
freq = frequency;
#endif
}
note_position = 0;
if (envelope_index < 65535) {
envelope_index++;
}
freq = voice_envelope(freq);
if (freq < 30.517578125) {
freq = 30.52;
}
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
UPDATE_CHANNEL_1_FREQ(freq);
} else {
RESTART_CHANNEL_1();
}
//note_timbre;
}
}
if (playing_notes) {
if (note_frequency > 0) {
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(note_frequency);
} else {
freq = note_frequency;
}
#else
freq = note_frequency;
#endif
if (envelope_index < 65535) {
envelope_index++;
}
freq = voice_envelope(freq);
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
UPDATE_CHANNEL_1_FREQ(freq);
UPDATE_CHANNEL_2_FREQ(freq);
}
//note_timbre;
} else {
// gptStopTimer(&GPTD6);
// gptStopTimer(&GPTD7);
}
if (!audio_config.enable) {
playing_notes = false;
playing_note = false;
note_position++;
bool end_of_note = false;
if (GET_CHANNEL_1_FREQ > 0) {
if (!note_resting)
end_of_note = (note_position >= (note_length*8 - 1));
else
end_of_note = (note_position >= (note_length*8));
} else {
end_of_note = (note_position >= (note_length*8));
}
if (end_of_note) {
current_note++;
if (current_note >= notes_count) {
if (notes_repeat) {
current_note = 0;
} else {
STOP_CHANNEL_1();
STOP_CHANNEL_2();
// gptStopTimer(&GPTD8);
playing_notes = false;
return;
}
}
if (!note_resting) {
note_resting = true;
current_note--;
if ((*notes_pointer)[current_note][0] == (*notes_pointer)[current_note + 1][0]) {
note_frequency = 0;
note_length = 1;
} else {
note_frequency = (*notes_pointer)[current_note][0];
note_length = 1;
}
} else {
note_resting = false;
envelope_index = 0;
note_frequency = (*notes_pointer)[current_note][0];
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
}
note_position = 0;
}
}
if (!audio_config.enable) {
playing_notes = false;
playing_note = false;
}
}
void play_note(float freq, int vol) {
dprintf("audio play note freq=%d vol=%d", (int)freq, vol);
dprintf("audio play note freq=%d vol=%d", (int)freq, vol);
if (!audio_initialized) {
audio_init();
if (!audio_initialized) {
audio_init();
}
if (audio_config.enable && voices < 8) {
// Cancel notes if notes are playing
if (playing_notes) {
stop_all_notes();
}
if (audio_config.enable && voices < 8) {
playing_note = true;
envelope_index = 0;
// Cancel notes if notes are playing
if (playing_notes)
stop_all_notes();
playing_note = true;
envelope_index = 0;
if (freq > 0) {
frequencies[voices] = freq;
volumes[voices] = vol;
voices++;
}
gptStart(&GPTD8, &gpt8cfg1);
gptStartContinuous(&GPTD8, 2U);
RESTART_CHANNEL_1();
RESTART_CHANNEL_2();
if (freq > 0) {
frequencies[voices] = freq;
volumes[voices] = vol;
voices++;
}
gptStart(&GPTD8, &gpt8cfg1);
gptStartContinuous(&GPTD8, 2U);
RESTART_CHANNEL_1();
RESTART_CHANNEL_2();
}
}
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat)
{
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat) {
if (!audio_initialized) {
audio_init();
if (!audio_initialized) {
audio_init();
}
if (audio_config.enable) {
// Cancel note if a note is playing
if (playing_note) {
stop_all_notes();
}
if (audio_config.enable) {
playing_notes = true;
// Cancel note if a note is playing
if (playing_note)
stop_all_notes();
notes_pointer = np;
notes_count = n_count;
notes_repeat = n_repeat;
playing_notes = true;
place = 0;
current_note = 0;
notes_pointer = np;
notes_count = n_count;
notes_repeat = n_repeat;
place = 0;
current_note = 0;
note_frequency = (*notes_pointer)[current_note][0];
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
note_position = 0;
gptStart(&GPTD8, &gpt8cfg1);
gptStartContinuous(&GPTD8, 2U);
RESTART_CHANNEL_1();
RESTART_CHANNEL_2();
}
note_frequency = (*notes_pointer)[current_note][0];
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
note_position = 0;
gptStart(&GPTD8, &gpt8cfg1);
gptStartContinuous(&GPTD8, 2U);
RESTART_CHANNEL_1();
RESTART_CHANNEL_2();
}
}
bool is_playing_notes(void) {
return playing_notes;
return playing_notes;
}
bool is_audio_on(void) {
return (audio_config.enable != 0);
return (audio_config.enable != 0);
}
void audio_toggle(void) {
audio_config.enable ^= 1;
eeconfig_update_audio(audio_config.raw);
if (audio_config.enable)
audio_on_user();
audio_config.enable ^= 1;
eeconfig_update_audio(audio_config.raw);
if (audio_config.enable) {
audio_on_user();
}
}
void audio_on(void) {
audio_config.enable = 1;
eeconfig_update_audio(audio_config.raw);
audio_on_user();
audio_config.enable = 1;
eeconfig_update_audio(audio_config.raw);
audio_on_user();
}
void audio_off(void) {
audio_config.enable = 0;
eeconfig_update_audio(audio_config.raw);
stop_all_notes();
audio_config.enable = 0;
eeconfig_update_audio(audio_config.raw);
}
#ifdef VIBRATO_ENABLE
@ -803,29 +696,29 @@ void audio_off(void) {
// Vibrato rate functions
void set_vibrato_rate(float rate) {
vibrato_rate = rate;
vibrato_rate = rate;
}
void increase_vibrato_rate(float change) {
vibrato_rate *= change;
vibrato_rate *= change;
}
void decrease_vibrato_rate(float change) {
vibrato_rate /= change;
vibrato_rate /= change;
}
#ifdef VIBRATO_STRENGTH_ENABLE
void set_vibrato_strength(float strength) {
vibrato_strength = strength;
vibrato_strength = strength;
}
void increase_vibrato_strength(float change) {
vibrato_strength *= change;
vibrato_strength *= change;
}
void decrease_vibrato_strength(float change) {
vibrato_strength /= change;
vibrato_strength /= change;
}
#endif /* VIBRATO_STRENGTH_ENABLE */
@ -835,45 +728,45 @@ void decrease_vibrato_strength(float change) {
// Polyphony functions
void set_polyphony_rate(float rate) {
polyphony_rate = rate;
polyphony_rate = rate;
}
void enable_polyphony() {
polyphony_rate = 5;
polyphony_rate = 5;
}
void disable_polyphony() {
polyphony_rate = 0;
polyphony_rate = 0;
}
void increase_polyphony_rate(float change) {
polyphony_rate *= change;
polyphony_rate *= change;
}
void decrease_polyphony_rate(float change) {
polyphony_rate /= change;
polyphony_rate /= change;
}
// Timbre function
void set_timbre(float timbre) {
note_timbre = timbre;
note_timbre = timbre;
}
// Tempo functions
void set_tempo(uint8_t tempo) {
note_tempo = tempo;
note_tempo = tempo;
}
void decrease_tempo(uint8_t tempo_change) {
note_tempo += tempo_change;
note_tempo += tempo_change;
}
void increase_tempo(uint8_t tempo_change) {
if (note_tempo - tempo_change < 10) {
note_tempo = 10;
} else {
note_tempo -= tempo_change;
}
if (note_tempo - tempo_change < 10) {
note_tempo = 10;
} else {
note_tempo -= tempo_change;
}
}

View file

@ -94,7 +94,7 @@ bool notes_repeat;
float notes_rest;
bool note_resting = false;
uint8_t current_note = 0;
uint16_t current_note = 0;
uint8_t rest_counter = 0;
#ifdef VIBRATO_ENABLE

View file

@ -26,12 +26,14 @@
// Note Types
#define MUSICAL_NOTE(note, duration) {(NOTE##note), duration}
#define BREVE_NOTE(note) MUSICAL_NOTE(note, 128)
#define WHOLE_NOTE(note) MUSICAL_NOTE(note, 64)
#define HALF_NOTE(note) MUSICAL_NOTE(note, 32)
#define QUARTER_NOTE(note) MUSICAL_NOTE(note, 16)
#define EIGHTH_NOTE(note) MUSICAL_NOTE(note, 8)
#define SIXTEENTH_NOTE(note) MUSICAL_NOTE(note, 4)
#define BREVE_DOT_NOTE(note) MUSICAL_NOTE(note, 128+64)
#define WHOLE_DOT_NOTE(note) MUSICAL_NOTE(note, 64+32)
#define HALF_DOT_NOTE(note) MUSICAL_NOTE(note, 32+16)
#define QUARTER_DOT_NOTE(note) MUSICAL_NOTE(note, 16+8)
@ -40,11 +42,13 @@
// Note Type Shortcuts
#define M__NOTE(note, duration) MUSICAL_NOTE(note, duration)
#define B__NOTE(n) BREVE_NOTE(n)
#define W__NOTE(n) WHOLE_NOTE(n)
#define H__NOTE(n) HALF_NOTE(n)
#define Q__NOTE(n) QUARTER_NOTE(n)
#define E__NOTE(n) EIGHTH_NOTE(n)
#define S__NOTE(n) SIXTEENTH_NOTE(n)
#define BD_NOTE(n) BREVE_DOT_NOTE(n)
#define WD_NOTE(n) WHOLE_DOT_NOTE(n)
#define HD_NOTE(n) HALF_DOT_NOTE(n)
#define QD_NOTE(n) QUARTER_DOT_NOTE(n)
@ -61,7 +65,11 @@
// Notes - # = Octave
#ifdef __arm__
#define NOTE_REST 1.00f
#else
#define NOTE_REST 0.00f
#endif
/* These notes are currently bugged
#define NOTE_C0 16.35f

View file

@ -1,4 +1,7 @@
/* Copyright 2016 Jack Humbert
/* Any song or sound without a license explicitly stated is:
*
* Copyright 2016 Jack Humbert
* Copyright 2017 Zach White
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -13,57 +16,32 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "musical_notes.h"
#pragma once
#ifndef SONG_LIST_H
#define SONG_LIST_H
#include "musical_notes.h"
#define NO_SOUND
#define LP_NUMB \
H__NOTE(_CS5), H__NOTE(_E5), H__NOTE(_CS5), WD_NOTE(_FS5), \
WD_NOTE(_A5), WD_NOTE(_GS5), WD_NOTE(_REST), H__NOTE(_CS5), H__NOTE(_E5), \
H__NOTE(_CS5), WD_NOTE(_A5), WD_NOTE(_GS5), WD_NOTE(_E5),
/* Ode to Joy
* Author: Friedrich Schiller
+ License: Public Domain
*/
#define ODE_TO_JOY \
Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \
Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \
Q__NOTE(_C4), Q__NOTE(_C4), Q__NOTE(_D4), Q__NOTE(_E4), \
QD_NOTE(_E4), E__NOTE(_D4), H__NOTE(_D4),
/* Rock-a-bye Baby
* Author: Unknown
+ License: Public Domain
*/
#define ROCK_A_BYE_BABY \
QD_NOTE(_B4), E__NOTE(_D4), Q__NOTE(_B5), \
H__NOTE(_A5), Q__NOTE(_G5), \
QD_NOTE(_B4), E__NOTE(_D5), Q__NOTE(_G5), \
H__NOTE(_FS5),
#define CLOSE_ENCOUNTERS_5_NOTE \
Q__NOTE(_D5), \
Q__NOTE(_E5), \
Q__NOTE(_C5), \
Q__NOTE(_C4), \
Q__NOTE(_G4),
#define DOE_A_DEER \
QD_NOTE(_C4), E__NOTE(_D4), \
QD_NOTE(_E4), E__NOTE(_C4), \
Q__NOTE(_E4), Q__NOTE(_C4), \
Q__NOTE(_E4),
/* Requires: PLAY_NOTE_ARRAY(..., ..., STACCATO); */
#define IN_LIKE_FLINT \
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4), \
E__NOTE(_AS4), E__NOTE(_B4), QD_NOTE(_CS4), \
E__NOTE(_B4), E__NOTE(_CS4), QD_NOTE(_DS4), \
E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4),
#define IMPERIAL_MARCH \
HD_NOTE(_A4), HD_NOTE(_A4), HD_NOTE(_A4), QD_NOTE(_F4), QD_NOTE(_C5), \
HD_NOTE(_A4), QD_NOTE(_F4), QD_NOTE(_C5), WD_NOTE(_A4), \
HD_NOTE(_E5), HD_NOTE(_E5), HD_NOTE(_E5), QD_NOTE(_F5), QD_NOTE(_C5), \
HD_NOTE(_A4), QD_NOTE(_F4), QD_NOTE(_C5), WD_NOTE(_A4)
#define CLUEBOARD_SOUND \
HD_NOTE(_C3), HD_NOTE(_D3), HD_NOTE(_E3), HD_NOTE(_F3), HD_NOTE(_G3), HD_NOTE(_A4), HD_NOTE(_B4), HD_NOTE(_C4)
@ -78,11 +56,6 @@
Q__NOTE(_F3)
*/
#define BASKET_CASE \
QD_NOTE(_G3), E__NOTE(_F3), E__NOTE(_E3), Q__NOTE(_F3), M__NOTE(_G3, 8+32), Q__NOTE(_REST), \
Q__NOTE(_B4), Q__NOTE(_C4), Q__NOTE(_B4), E__NOTE(_A4), Q__NOTE(_G3), M__NOTE(_G3, 8+32), Q__NOTE(_REST), \
Q__NOTE(_B4), Q__NOTE(_C4), Q__NOTE(_B4), E__NOTE(_A4), Q__NOTE(_G3), Q__NOTE(_G3), Q__NOTE(_G3), Q__NOTE(_G3), E__NOTE(_A4), E__NOTE(_C4), QD_NOTE(_B4), HD_NOTE(_B4)
#define STARTUP_SOUND \
E__NOTE(_E6), \
E__NOTE(_A6), \
@ -130,6 +103,17 @@
S__NOTE(_REST), \
E__NOTE(_E7 ),
#define WORKMAN_SOUND \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
ED_NOTE(_FS7 ), \
S__NOTE(_REST), \
ED_NOTE(_A7 ),
#define PLOVER_SOUND \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
@ -257,219 +241,118 @@
E__NOTE(_E6), \
S__NOTE(_B5),
#define COIN_SOUND \
E__NOTE(_A5 ), \
HD_NOTE(_E6 ),
#define ONE_UP_SOUND \
Q__NOTE(_E6 ), \
Q__NOTE(_G6 ), \
Q__NOTE(_E7 ), \
Q__NOTE(_C7 ), \
Q__NOTE(_D7 ), \
Q__NOTE(_G7 ),
#define SONIC_RING \
E__NOTE(_E6), \
E__NOTE(_G6), \
HD_NOTE(_C7),
#define ZELDA_PUZZLE \
Q__NOTE(_G5), \
Q__NOTE(_FS5), \
Q__NOTE(_DS5), \
Q__NOTE(_A4), \
Q__NOTE(_GS4), \
Q__NOTE(_E5), \
Q__NOTE(_GS5), \
HD_NOTE(_C6),
#define ZELDA_TREASURE \
Q__NOTE(_A4 ), \
Q__NOTE(_AS4), \
Q__NOTE(_B4 ), \
HD_NOTE(_C5 ), \
#define TERMINAL_SOUND \
E__NOTE(_C5 )
#define OVERWATCH_THEME \
HD_NOTE(_A4 ), \
Q__NOTE(_E4 ), \
Q__NOTE(_A4 ), \
HD_NOTE(_B4 ), \
Q__NOTE(_E4 ), \
Q__NOTE(_B4 ), \
W__NOTE(_CS5),
#define MARIO_THEME \
Q__NOTE(_E5), \
H__NOTE(_E5), \
H__NOTE(_E5), \
Q__NOTE(_C5), \
H__NOTE(_E5), \
W__NOTE(_G5), \
Q__NOTE(_G4),
/* Title: La Campanella
* Author/Composer: Frank Lizst
+ License: Public Domain
*/
#define CAMPANELLA \
Q__NOTE(_DS4), E__NOTE(_DS4), E__NOTE(_DS5), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_DS5), E__NOTE(_DS5), \
E__NOTE(_DS6), Q__NOTE(_CS5), E__NOTE(_CS5), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), \
Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_GS4), \
E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_G4), E__NOTE(_G4), E__NOTE(_DS6), Q__NOTE(_GS4), E__NOTE(_GS4), \
E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_DS4), E__NOTE(_DS4), E__NOTE(_DS6), \
Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_E5), E__NOTE(_E5), E__NOTE(_DS6), Q__NOTE(_DS5), \
E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_CS5), E__NOTE(_CS5), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), \
E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), \
Q__NOTE(_GS4), E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_G4), E__NOTE(_G4), E__NOTE(_DS6), Q__NOTE(_GS4), \
E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_DS4), E__NOTE(_DS4), \
E__NOTE(_DS5), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_DS6), E__NOTE(_DS6), E__NOTE(_DS7), \
Q__NOTE(_DS6), E__NOTE(_DS6), E__NOTE(_DS7), Q__NOTE(_CS6), E__NOTE(_CS6), E__NOTE(_DS7), Q__NOTE(_B5), \
E__NOTE(_B5), E__NOTE(_DS7), Q__NOTE(_B5), E__NOTE(_B5), E__NOTE(_DS7), Q__NOTE(_AS5), E__NOTE(_AS5), \
E__NOTE(_DS7), Q__NOTE(_GS5), E__NOTE(_GS5), E__NOTE(_DS7), Q__NOTE(_G5), E__NOTE(_G5), E__NOTE(_DS7), \
Q__NOTE(_GS5), E__NOTE(_GS5), E__NOTE(_DS7), Q__NOTE(_AS5), E__NOTE(_AS5), E__NOTE(_DS7), Q__NOTE(_DS5), \
E__NOTE(_DS5), E__NOTE(_DS7), W__NOTE(_DS6), W__NOTE(_GS5),
#define MARIO_GAMEOVER \
HD_NOTE(_C5 ), \
HD_NOTE(_G4 ), \
H__NOTE(_E4 ), \
H__NOTE(_A4 ), \
H__NOTE(_B4 ), \
H__NOTE(_A4 ), \
H__NOTE(_AF4), \
H__NOTE(_BF4), \
H__NOTE(_AF4), \
WD_NOTE(_G4 ),
#define MARIO_MUSHROOM \
S__NOTE(_C5 ), \
S__NOTE(_G4 ), \
S__NOTE(_C5 ), \
S__NOTE(_E5 ), \
S__NOTE(_G5 ), \
S__NOTE(_C6 ), \
S__NOTE(_G5 ), \
S__NOTE(_GS4), \
S__NOTE(_C5 ), \
S__NOTE(_DS5), \
S__NOTE(_GS5), \
S__NOTE(_DS5), \
S__NOTE(_GS5), \
S__NOTE(_C6 ), \
S__NOTE(_DS6), \
S__NOTE(_GS6), \
S__NOTE(_DS6), \
S__NOTE(_AS4), \
S__NOTE(_D5 ), \
S__NOTE(_F5 ), \
S__NOTE(_AS5), \
S__NOTE(_D6 ), \
S__NOTE(_F6 ), \
S__NOTE(_AS6), \
S__NOTE(_F6 )
#define E1M1_DOOM \
Q__NOTE(_E3 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_E4 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_D4 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_C4 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_BF3), \
Q__NOTE(_E3 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_B3 ), \
Q__NOTE(_C4 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_E4 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_D4 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_C4 ), \
Q__NOTE(_E3 ), \
Q__NOTE(_E3 ), \
H__NOTE(_BF3),
#define DISNEY_SONG \
H__NOTE(_G3 ), \
H__NOTE(_G4 ), \
H__NOTE(_F4 ), \
H__NOTE(_E4 ), \
H__NOTE(_CS4), \
H__NOTE(_D4 ), \
W__NOTE(_A4 ), \
H__NOTE(_B3 ), \
H__NOTE(_B4 ), \
H__NOTE(_A4 ), \
H__NOTE(_G4 ), \
H__NOTE(_FS4), \
H__NOTE(_G4 ), \
W__NOTE(_C5 ), \
H__NOTE(_D5 ), \
H__NOTE(_C5 ), \
H__NOTE(_B4 ), \
H__NOTE(_A4 ), \
H__NOTE(_G4 ), \
H__NOTE(_F4 ), \
H__NOTE(_E4 ), \
H__NOTE(_D4 ), \
W__NOTE(_A4 ), \
W__NOTE(_B3 ), \
W__NOTE(_C4 ),
/* Title: Fantaisie-Impromptu
* Author/Composer: Chopin
* License: Public Domain
*/
#define FANTASIE_IMPROMPTU \
E__NOTE(_GS4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), \
E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_GS4), E__NOTE(_A4), \
E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), \
E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_A4), E__NOTE(_CS5), E__NOTE(_DS5), \
E__NOTE(_FS5), E__NOTE(_A5), E__NOTE(_CS6), E__NOTE(_DS6), E__NOTE(_B6), E__NOTE(_A6), E__NOTE(_GS6), E__NOTE(_FS6), \
E__NOTE(_E6), E__NOTE(_DS6), E__NOTE(_FS6), E__NOTE(_CS6), E__NOTE(_C5), E__NOTE(_DS6), E__NOTE(_A5), E__NOTE(_GS5), \
E__NOTE(_FS5), E__NOTE(_A5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_FS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_DS5), \
E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_B4), E__NOTE(_A4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_A4), E__NOTE(_GS4), \
E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), \
E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_GS4), E__NOTE(_AS4), E__NOTE(_GS4), E__NOTE(_REST), \
E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), \
E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_DS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_REST), E__NOTE(_DS5), \
E__NOTE(_B5), E__NOTE(_AS5), E__NOTE(_GS5), E__NOTE(_REST), E__NOTE(_E6), E__NOTE(_DS6), E__NOTE(_CS6), E__NOTE(_B5), \
E__NOTE(_AS5), E__NOTE(_GS5), E__NOTE(_REST), E__NOTE(_AS5), WD_NOTE(_GS5),
#define NUMBER_ONE \
HD_NOTE(_F4 ), \
Q__NOTE(_C5 ), \
E__NOTE(_B4 ), \
E__NOTE(_C5 ), \
E__NOTE(_B4 ), \
E__NOTE(_C5 ), \
Q__NOTE(_B4 ), \
Q__NOTE(_C5 ), \
H__NOTE(_AF4), \
HD_NOTE(_F4 ), \
Q__NOTE(_F4 ), \
Q__NOTE(_AF4), \
Q__NOTE(_C5 ), \
H__NOTE(_DF5), \
H__NOTE(_AF4), \
H__NOTE(_DF5), \
H__NOTE(_EF5), \
Q__NOTE(_C5 ), \
Q__NOTE(_DF5), \
Q__NOTE(_C5 ), \
Q__NOTE(_DF5), \
H__NOTE(_C5 ),
#define CABBAGE_SONG \
H__NOTE(_C4), \
H__NOTE(_A4), \
H__NOTE(_B4), \
H__NOTE(_B4), \
H__NOTE(_A4), \
H__NOTE(_G4), \
H__NOTE(_E4),
/* Title: Nocturne Op. 9 No. 1 in B flat minor
* Author/Composer: Chopin
License: Public Domain
*/
#define NOCTURNE_OP_9_NO_1 \
H__NOTE(_BF5), H__NOTE(_C6), H__NOTE(_DF6), H__NOTE(_A5), H__NOTE(_BF5), H__NOTE(_GF5), W__NOTE(_F5), W__NOTE(_F5), W__NOTE(_F5), \
W__NOTE(_F5), H__NOTE(_GF5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_C5), B__NOTE(_DF5), W__NOTE(_BF4), Q__NOTE(_BF5), \
Q__NOTE(_C6), Q__NOTE(_DF6), Q__NOTE(_A5), Q__NOTE(_BF5), Q__NOTE(_A5), Q__NOTE(_GS5), Q__NOTE(_A5), Q__NOTE(_C6), \
Q__NOTE(_BF5), Q__NOTE(_GF5), Q__NOTE(_F5), Q__NOTE(_GF5), Q__NOTE(_E5), Q__NOTE(_F5), Q__NOTE(_BF5), Q__NOTE(_A5), \
Q__NOTE(_AF5), Q__NOTE(_G5), Q__NOTE(_GF5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_EF5), Q__NOTE(_D5), Q__NOTE(_DF5), \
Q__NOTE(_C5), Q__NOTE(_DF5), Q__NOTE(_C5), Q__NOTE(_B4), Q__NOTE(_C5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_EF5), \
B__NOTE(_DF5), W__NOTE(_BF4), W__NOTE(_BF5), W__NOTE(_BF5), W__NOTE(_BF5), BD_NOTE(_AF5), W__NOTE(_DF5), H__NOTE(_BF4), \
H__NOTE(_C5), H__NOTE(_DF5), H__NOTE(_GF5), H__NOTE(_GF5), BD_NOTE(_F5), W__NOTE(_EF5), H__NOTE(_F5), H__NOTE(_EF5), \
H__NOTE(_DF5), H__NOTE(_A4), B__NOTE(_AF4), W__NOTE(_DF5), W__NOTE(_EF5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_DF5), \
H__NOTE(_EF5), BD_NOTE(_F5),
#define OLD_SPICE \
Q__NOTE(_A4 ), \
Q__NOTE(_A4 ), \
H__NOTE(_B4 ), \
H__NOTE(_D5 ), \
H__NOTE(_CS5), \
Q__NOTE(_E5 ), \
H__NOTE(_FS5), \
H__NOTE(_D5 ), \
#define VICTORY_FANFARE_SHORT \
ED_NOTE(_C6), \
ED_NOTE(_C6), \
ED_NOTE(_C6), \
ED_NOTE(_C6), \
W__NOTE(_REST), \
QD_NOTE(_GS5), \
QD_NOTE(_AS5), \
Q__NOTE(_C6), \
Q__NOTE(_AS5), \
Q__NOTE(_C6), \
/* Removed sounds
+ This list is here solely for compatibility, so that removed songs don't just break things
* If you think that any of these songs were wrongfully removed, let us know and provide
* proof of permission to use them, or public domain status.
*/
#define ALL_STAR \
H__NOTE(_AS4), W__NOTE(_FS4), Q__NOTE(_FS4), Q__NOTE(_DS4), H__NOTE(_FS4), W__NOTE(_FS4), Q__NOTE(_FS4), Q__NOTE(_DS4), \
H__NOTE(_FS4), W__NOTE(_FS4), W__NOTE(_FS4), QD_NOTE(_AS4), \
H__NOTE(_AS4), W__NOTE(_FS4), Q__NOTE(_FS4), Q__NOTE(_DS4), H__NOTE(_FS4), W__NOTE(_FS4), Q__NOTE(_FS4), Q__NOTE(_DS4), \
H__NOTE(_FS4), W__NOTE(_FS4), W__NOTE(_FS4), W__NOTE(_AS4), H__NOTE(_REST),\
W__NOTE(_AS4), W__NOTE(_CS5), H__NOTE(_B4), H__NOTE(_CS5), H__NOTE(_DS5), W__NOTE(_FS5), \
H__NOTE(_GS5), W__NOTE(_GS5), H__NOTE(_FS4), H__NOTE(_FS4), H__NOTE(_GS4), H__NOTE(_FS4), \
H__NOTE(_AS4), W__NOTE(_GS4), W__NOTE(_GS4), W__NOTE(_FS4), W__NOTE(_GS4), \
H__NOTE(_AS4), WD_NOTE(_DS4)
#endif
#define CLOSE_ENCOUNTERS_5_NOTE
#define DOE_A_DEER
#define IN_LIKE_FLINT
#define IMPERIAL_MARCH
#define BASKET_CASE
#define COIN_SOUND
#define ONE_UP_SOUND
#define SONIC_RING
#define ZELDA_PUZZLE
#define ZELDA_TREASURE
#define OVERWATCH_THEME
#define MARIO_THEME
#define MARIO_GAMEOVER
#define MARIO_MUSHROOM
#define E1M1_DOOM
#define DISNEY_SONG
#define NUMBER_ONE
#define CABBAGE_SONG
#define OLD_SPICE
#define VICTORY_FANFARE_SHORT
#define ALL_STAR
#define RICK_ROLL
#define FF_PRELUDE
#define TO_BOLDLY_GO
#define KATAWARE_DOKI
#define MEGALOVANIA
#define MICHISHIRUBE
#define LIEBESLEID
#define MELODIES_OF_LIFE
#define EYES_ON_ME
#define SONG_OF_THE_ANCIENTS
#define NIER_AMUSEMENT_PARK
#define COPIED_CITY
#define VAGUE_HOPE_COLD_RAIN
#define KAINE_SALVATION
#define WEIGHT_OF_THE_WORLD
#define ISABELLAS_LULLABY
#define TERRAS_THEME
#define RENAI_CIRCULATION
#define PLATINUM_DISCO
#define LP_NUMB