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 static float compute_freq_for_midi_note(uint8_t note)
11 // https://en.wikipedia.org/wiki/MIDI_tuning_standard
12 return pow(2.0, (note - 69) / 12.0) * 440.0f;
15 bool process_audio(uint16_t keycode, keyrecord_t *record) {
17 if (keycode == AU_ON && record->event.pressed) {
22 if (keycode == AU_OFF && record->event.pressed) {
27 if (keycode == AU_TOG && record->event.pressed) {
36 if (keycode == MUV_IN && record->event.pressed) {
38 PLAY_SONG(voice_change_song);
42 if (keycode == MUV_DE && record->event.pressed) {
44 PLAY_SONG(voice_change_song);
51 void process_audio_noteon(uint8_t note) {
52 play_note(compute_freq_for_midi_note(note), 0xF);
55 void process_audio_noteoff(uint8_t note) {
56 stop_note(compute_freq_for_midi_note(note));
59 void process_audio_all_notes_off(void) {
63 __attribute__ ((weak))
64 void audio_on_user() {}