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
13 static float compute_freq_for_midi_note(uint8_t note)
15 // https://en.wikipedia.org/wiki/MIDI_tuning_standard
16 return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A;
19 bool process_audio(uint16_t keycode, keyrecord_t *record) {
21 if (keycode == AU_ON && record->event.pressed) {
26 if (keycode == AU_OFF && record->event.pressed) {
31 if (keycode == AU_TOG && record->event.pressed) {
40 if (keycode == MUV_IN && record->event.pressed) {
42 PLAY_SONG(voice_change_song);
46 if (keycode == MUV_DE && record->event.pressed) {
48 PLAY_SONG(voice_change_song);
55 void process_audio_noteon(uint8_t note) {
56 play_note(compute_freq_for_midi_note(note), 0xF);
59 void process_audio_noteoff(uint8_t note) {
60 stop_note(compute_freq_for_midi_note(note));
63 void process_audio_all_notes_off(void) {
67 __attribute__ ((weak))
68 void audio_on_user() {}