|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 Marcel Licence |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + * |
| 17 | + * Dieses Programm ist Freie Software: Sie k�nnen es unter den Bedingungen |
| 18 | + * der GNU General Public License, wie von der Free Software Foundation, |
| 19 | + * Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren |
| 20 | + * ver�ffentlichten Version, weiter verteilen und/oder modifizieren. |
| 21 | + * |
| 22 | + * Dieses Programm wird in der Hoffnung bereitgestellt, dass es n�tzlich sein wird, jedoch |
| 23 | + * OHNE JEDE GEW�HR,; sogar ohne die implizite |
| 24 | + * Gew�hr der MARKTF�HIGKEIT oder EIGNUNG F�R EINEN BESTIMMTEN ZWECK. |
| 25 | + * Siehe die GNU General Public License f�r weitere Einzelheiten. |
| 26 | + * |
| 27 | + * Sie sollten eine Kopie der GNU General Public License zusammen mit diesem |
| 28 | + * Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>. |
| 29 | + */ |
| 30 | + |
| 31 | +/** |
| 32 | + * @file ml_audio_test.ino |
| 33 | + * @author Marcel Licence |
| 34 | + * @date 14.01.2025 |
| 35 | + * |
| 36 | + * @brief This is simple testproject to check the audio output using a DAC |
| 37 | + * connected via I2S |
| 38 | + */ |
| 39 | +#define OUTPUT_SAW_TEST |
| 40 | + |
| 41 | + |
| 42 | +/* |
| 43 | + * Configuration for |
| 44 | + * Board: "ESP32 Dev Module" or similar |
| 45 | + */ |
| 46 | +#ifdef ESP32 |
| 47 | + |
| 48 | +//#define BOARD_ML_V1 /* activate this when using the ML PCB V1 */ |
| 49 | +#define BOARD_ML_SYNTH_V2 /* activate this when using the ML PCB V1 */ |
| 50 | +//#define BOARD_ESP32_AUDIO_KIT_AC101 /* activate this when using the ESP32 Audio Kit v2.2 with the AC101 codec */ |
| 51 | +//#define BOARD_ESP32_AUDIO_KIT_ES8388 /* activate this when using the ESP32 Audio Kit v2.2 with the ES8388 codec */ |
| 52 | +//#define BOARD_ESP32_DOIT /* activate this when using the DOIT ESP32 DEVKIT V1 board */ |
| 53 | +//#define BOARD_WEMOS_D1_MINI_ESP32 |
| 54 | + |
| 55 | +/* |
| 56 | + * include the board configuration |
| 57 | + * there you will find the most hardware depending pin settings |
| 58 | + */ |
| 59 | +#include <ml_boards.h> /* requires the ML_Synth library: https://github.com/marcel-licence/ML_SynthTools */ |
| 60 | + |
| 61 | +#define SAMPLE_RATE 44100 |
| 62 | +#define SAMPLE_SIZE_16BIT |
| 63 | +#define SAMPLE_BUFFER_SIZE 48 |
| 64 | + |
| 65 | +#endif /* ESP32 */ |
| 66 | + |
| 67 | + |
| 68 | +#define ML_SYNTH_INLINE_DECLARATION |
| 69 | +#include <ml_inline.h> |
| 70 | +#undef ML_SYNTH_INLINE_DECLARATION |
| 71 | + |
| 72 | +#define ML_SYNTH_INLINE_DEFINITION |
| 73 | +#include <ml_inline.h> |
| 74 | +#undef ML_SYNTH_INLINE_DEFINITION |
| 75 | + |
| 76 | +void setup() |
| 77 | +{ |
| 78 | + /* |
| 79 | + * this code runs once |
| 80 | + */ |
| 81 | + Serial.begin(115200); |
| 82 | + |
| 83 | + Serial.printf("Initialize Audio Interface\n"); |
| 84 | + Audio_Setup(); |
| 85 | +} |
| 86 | + |
| 87 | +void loop() |
| 88 | +{ |
| 89 | + float left[SAMPLE_BUFFER_SIZE], right[SAMPLE_BUFFER_SIZE]; |
| 90 | + /* |
| 91 | + * Output the audio |
| 92 | + */ |
| 93 | + Audio_Output(left, right); |
| 94 | +} |
0 commit comments