2 #include "process_audio.h"
4 #ifndef VOICE_CHANGE_SONG
5 #define VOICE_CHANGE_SONG SONG(VOICE_CHANGE_SOUND)
7 float voice_change_song[][2] = VOICE_CHANGE_SONG;
9 #ifndef PITCH_STANDARD_A
10 #define PITCH_STANDARD_A 440.0f
15 static float compute_freq_for_midi_note(uint8_t note)
17 // https://en.wikipedia.org/wiki/MIDI_tuning_standard
18 return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A;
21 bool process_audio(uint16_t keycode, keyrecord_t *record) {
23 if (keycode == AU_ON && record->event.pressed) {
28 if (keycode == AU_OFF && record->event.pressed) {
33 if (keycode == AU_TOG && record->event.pressed) {
42 if (keycode == MUV_IN && record->event.pressed) {
44 PLAY_SONG(voice_change_song);
48 if (keycode == MUV_DE && record->event.pressed) {
50 PLAY_SONG(voice_change_song);
57 void process_audio_noteon(uint8_t note) {
58 play_note(compute_freq_for_midi_note(note), 0xF);
61 void process_audio_noteoff(uint8_t note) {
62 stop_note(compute_freq_for_midi_note(note));
65 void process_audio_all_notes_off(void) {
69 __attribute__ ((weak))
70 void audio_on_user() {}