arduino-audio-tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Modules Pages
AudioToolsConfig.h
1
7#pragma once
8
9#define AUDIOTOOLS_VERSION "1.0.1"
10#define AUDIOTOOLS_MAJOR_VERSION 1
11#define AUDIOTOOLS_MIOR_VERSION 0
12
13
14#if defined(IS_MIN_DESKTOP)
16# include "AudioTools/AudioLibs/Desktop/Time.h"
17# include "AudioTools/AudioLibs/Desktop/Main.h"
18# define USE_STREAM_READ_OVERRIDE
19# ifndef EXIT_ON_STOP
20# define EXIT_ON_STOP
21# endif
22#elif defined(IS_DESKTOP_WITH_TIME_ONLY)
23# include "AudioTools/AudioLibs/Desktop/Time.h"
25# ifndef EXIT_ON_STOP
26# define EXIT_ON_STOP
27# endif
28#elif defined(IS_DESKTOP)
29# include "Arduino.h"
30# include <Client.h>
31# include <WiFi.h>
32# define USE_WIFI
33# define USE_URL_ARDUINO
34# define USE_STREAM_WRITE_OVERRIDE
35# define USE_STREAM_READ_OVERRIDE
36# define USE_STREAM_READCHAR_OVERRIDE
37# ifndef EXIT_ON_STOP
38# define EXIT_ON_STOP
39# endif
40//# define USE_3BYTE_INT24
41typedef WiFiClient WiFiClientSecure;
42#elif defined(ARDUINO)
43# include "Arduino.h"
44// --- ESP32 ------------
45// E.g when using the Espressif IDF. Use cmake for the necesseary defines
46#elif defined(ESP32_CMAKE)
47# define ESP32
48# include "esp_idf_version.h"
50#else
52# define IS_JUPYTER
53# define USE_STREAM_READ_OVERRIDE
54#endif
55
56#include <string.h>
57#include <stdint.h>
58#include <assert.h>
59#include "AudioTools/CoreAudio/AudioRuntime.h"
60
61
62// If you don't want to use all the settings from here you can define your own local config settings in AudioConfigLocal.h
63#if __has_include("AudioConfigLocal.h")
64#include "AudioConfigLocal.h"
65#endif
66
67// Automatically include all core audio functionality
68#ifndef AUDIO_INCLUDE_CORE
69# define AUDIO_INCLUDE_CORE true
70#endif
71
72// Use fixed point multiplication instead float for VolumeStream for slightly better performance on platforms without float hardware. Tested on RP2040 at 16 bit per second (still too slow for 32bit)
73#ifndef PREFER_FIXEDPOINT
74# define PREFER_FIXEDPOINT false
75#endif
76
77// Add automatic using namespace audio_tools;
78#ifndef USE_AUDIOTOOLS_NS
79# define USE_AUDIOTOOLS_NS true
80#endif
81
90#ifndef USE_AUDIO_LOGGING
91# define USE_AUDIO_LOGGING true
92#endif
93
94#ifndef LOG_LEVEL
95# define LOG_LEVEL AudioLogger::Warning
96#endif
97
98#ifndef LOG_STREAM
99# define LOG_STREAM Serial
100#endif
101
102#ifndef LOG_PRINTF_BUFFER_SIZE
103# define LOG_PRINTF_BUFFER_SIZE 303
104#endif
105
106#ifndef LOG_METHOD
107# define LOG_METHOD __PRETTY_FUNCTION__
108#endif
109
110// cheange USE_CHECK_MEMORY to true to activate memory checks
111#ifndef USE_CHECK_MEMORY
112# define USE_CHECK_MEMORY false
113#endif
114
115
116// Activate/deactivate obsolete functionality
117#ifndef USE_OBSOLETE
118# define USE_OBSOLETE false
119#endif
120
125#ifndef DEFAULT_BUFFER_SIZE
126# define DEFAULT_BUFFER_SIZE 1024
127#endif
128
129#ifndef DEFAULT_SAMPLE_RATE
130# define DEFAULT_SAMPLE_RATE 44100
131#endif
132
133#ifndef DEFAULT_CHANNELS
134# define DEFAULT_CHANNELS 2
135#endif
136
137#ifndef DEFAULT_BITS_PER_SAMPLE
138# define DEFAULT_BITS_PER_SAMPLE 16
139#endif
140
141#ifndef I2S_DEFAULT_PORT
142# define I2S_DEFAULT_PORT 0
143#endif
144
145#ifndef I2S_BUFFER_SIZE
146# define I2S_BUFFER_SIZE 512
147#endif
148
149#ifndef I2S_BUFFER_COUNT
150# define I2S_BUFFER_COUNT 6 // 20
151#endif
152
153#ifndef ANALOG_BUFFER_SIZE
154# define ANALOG_BUFFER_SIZE 512
155#endif
156
157#ifndef ANALOG_BUFFER_COUNT
158# define ANALOG_BUFFER_COUNT 6 // 20
159#endif
160
161#ifndef A2DP_BUFFER_SIZE
162# define A2DP_BUFFER_SIZE 512
163#endif
164
165#ifndef A2DP_BUFFER_COUNT
166# define A2DP_BUFFER_COUNT 30
167#endif
168
169#ifndef CODEC_DELAY_MS
170# define CODEC_DELAY_MS 10
171#endif
172
173#ifndef COPY_DELAY_ON_NODATA
174# define COPY_DELAY_ON_NODATA 10
175#endif
176
177#ifndef COPY_RETRY_LIMIT
178# define COPY_RETRY_LIMIT 20
179#endif
180
181#ifndef MAX_SINGLE_CHARS
182# define MAX_SINGLE_CHARS 8
183#endif
184
185// max size of http processing buffer
186#ifndef HTTP_MAX_LEN
187# define HTTP_MAX_LEN 1024
188#endif
189
190// max size of chunked size line
191#ifndef HTTP_CHUNKED_SIZE_MAX_LEN
192# define HTTP_CHUNKED_SIZE_MAX_LEN 80
193#endif
194
195
196#ifndef USE_RESAMPLE_BUFFER
197# define USE_RESAMPLE_BUFFER true
198#endif
199
203#ifndef PWM_BUFFER_SIZE
204# define PWM_BUFFER_SIZE 1024
205#endif
206
207#ifndef PWM_BUFFER_COUNT
208# define PWM_BUFFER_COUNT 4
209#endif
210
211#ifndef PWM_AUDIO_FREQUENCY
212# define PWM_AUDIO_FREQUENCY 30000
213#endif
214
215// Activate Networking for All Processors
216// #define USE_ETHERNET
217// #define USE_AUDIO_SERVER
218// #define USE_URL_ARDUINO
219
224//-------ESP32---------
225#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32C3)
226# define ESP32C3
227# define ESP32X
228# define USE_INT24_FROM_INT
229# define USE_TDM
230# define USE_PDM
231#endif
232#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32S2)
233# define ESP32S2
234# define ESP32X
235#endif
236#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32S3)
237# define ESP32S3
238# define ESP32X
239# define USE_TDM
240# define USE_PDM
241# define USE_PDM_RX
242#endif
243#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32C6)
244# define ESP32C6
245# define ESP32X
246# define USE_TDM
247# define USE_PDM
248#endif
249#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32P4)
250# define ESP32P4
251# define ESP32X
252# define USE_TDM
253# define USE_PDM
254# define USE_PDM_RX
255#endif
256
257// for all ESP32 families
258#if defined(ESP32)
259# define USE_STRTOD
260// We need to use accept instead of available
261# if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
262# define USE_SERVER_ACCEPT true
263# endif
264# if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
265# define USE_CONCURRENCY
266// Print has been fixed
267# define USE_PRINT_FLUSH true
268# else
269# define USE_PRINT_FLUSH false
270# endif
271# define USE_SD_SUPPORTS_SPI
272//# define USE_ESP32_LOGGER true
273# if !defined(ARDUINO)
274# define USE_IDF_LOGGER
275# endif
276#endif
277
278// ----- Regular ESP32 -----
279#if defined(ESP32) && !defined(ESP32X) && !defined(CONFIG_IDF_TARGET_ESP32H2)
280#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
281# define USE_INT24_FROM_INT
282#endif
283
284#define USE_ANALOG
285#define USE_I2S
286#define USE_PDM_RX
287
288#ifdef ARDUINO
289# define USE_PWM
290# define USE_WIFI
291# define USE_WIFI_CLIENT_SECURE
292# define USE_URL_ARDUINO
293# define USE_AUDIO_SERVER
294# define USE_TIMER
295# define USE_TOUCH_READ
296#endif
297
298#define USE_TYPETRAITS
299#define USE_STREAM_WRITE_OVERRIDE
300#define USE_STREAM_READ_OVERRIDE
301#define USE_EXT_BUTTON_LOGIC
302// support for psram -> set to true
303#define USE_ALLOCATOR true
304#define HAS_IOSTRAM
305#define USE_TASK false
306
307#define PWM_FREQENCY 30000
308#define PIN_PWM_START 12
309#define PIN_I2S_BCK 14
310#define PIN_I2S_WS 15
311#define PIN_I2S_DATA_IN 32
312#define PIN_I2S_DATA_OUT 22
313#define PIN_I2S_MCK -1
314#define I2S_USE_APLL true
315// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 23). Or you could drive the LED by assigning LED_BUILTIN
316#define PIN_I2S_MUTE -1
317#define SOFT_MUTE_VALUE 0
318#define PIN_CS SS
319#define PIN_ADC1 34
320
321#define I2S_AUTO_CLEAR true
322
323// URLStream
324#define URL_STREAM_CORE 0
325#define URL_STREAM_PRIORITY 2
326#define URL_STREAM_BUFFER_COUNT 10
327#define STACK_SIZE 30000
328#define URL_CLIENT_TIMEOUT 60000;
329#define URL_HANDSHAKE_TIMEOUT 120000
330
331// // Default LED
332// #ifndef LED_BUILTIN
333// # define LED_BUILTIN 13 // pin number is specific to your esp32 board
334// #endif
335
336// support for old idf releases
337#if ESP_IDF_VERSION_MAJOR < 4 && !defined(I2S_COMM_FORMAT_STAND_I2S)
338# define I2S_COMM_FORMAT_STAND_I2S (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB)
339# define I2S_COMM_FORMAT_STAND_MSB (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_LSB)
340# define I2S_COMM_FORMAT_STAND_PCM_LONG (I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_LONG)
341# define I2S_COMM_FORMAT_STAND_PCM_SHORT (I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_SHORT)
342
343typedef int eps32_i2s_sample_rate_type;
344#else
345typedef uint32_t eps32_i2s_sample_rate_type;
346#endif
347
348#endif
349
350//-------ESP32C3, ESP32S3, ESP32S2---------
351
352#if defined(ESP32) && defined(ESP32X)
353# ifdef ARDUINO
354# include "esp32-hal-log.h"
355# endif
356# if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
357# define USE_INT24_FROM_INT
358# define USE_ANALOG
359# endif
360
361#define USE_PWM
362#define USE_URL_ARDUINO
363#define USE_WIFI
364#define USE_WIFI_CLIENT_SECURE
365#define USE_I2S
366#define USE_AUDIO_SERVER
367#define USE_TYPETRAITS
368#define USE_TIMER
369#define USE_STREAM_WRITE_OVERRIDE
370#define USE_STREAM_READ_OVERRIDE
371// support for psram -> set to true
372#define USE_ALLOCATOR true
373//#define USE_INITIALIZER_LIST
374
375#define PWM_FREQENCY 30000
376#define PIN_PWM_START 1
377#define PIN_I2S_MCK -1
378#define PIN_I2S_BCK 6
379#define PIN_I2S_WS 7
380#define PIN_I2S_DATA_OUT 8
381#define PIN_I2S_DATA_IN 9
382#define I2S_USE_APLL true
383// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 5). Or you could drive the LED by assigning LED_BUILTIN
384#define PIN_I2S_MUTE -1
385#define SOFT_MUTE_VALUE 0
386#define PIN_CS SS
387#define PIN_ADC1 21
388
389#define I2S_AUTO_CLEAR true
390
391// URLStream
392//#define USE_ESP8266_AUDIO
393#define URL_STREAM_CORE 0
394#define URL_STREAM_PRIORITY 2
395#define URL_STREAM_BUFFER_COUNT 10
396#define STACK_SIZE 30000
397#define URL_CLIENT_TIMEOUT 60000;
398#define URL_HANDSHAKE_TIMEOUT 120000
399
400// // Default LED
401// #ifndef LED_BUILTIN
402// # define LED_BUILTIN 13 // pin number is specific to your esp32 board
403// #endif
404
405typedef uint32_t eps32_i2s_sample_rate_type;
406
407#endif
408
409//-------ESP32H2---------
410
411#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32H2)
412#include "esp32-hal-log.h"
413#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
414# define USE_INT24_FROM_INT
415# define USE_ANALOG
416#endif
417
418#define ESP32H2
419#define USE_TDM
420#define USE_PWM
421#define USE_I2S
422#define USE_PDM
423#define USE_TYPETRAITS
424#define USE_TIMER
425#define USE_STREAM_WRITE_OVERRIDE
426#define USE_STREAM_READ_OVERRIDE
427// support for psram -> set to true
428#define USE_ALLOCATOR true
429//#define USE_INITIALIZER_LIST
430
431#define PWM_FREQENCY 30000
432#define PIN_PWM_START 1
433#define PIN_I2S_MCK -1
434#define PIN_I2S_BCK 6
435#define PIN_I2S_WS 7
436#define PIN_I2S_DATA_OUT 8
437#define PIN_I2S_DATA_IN 9
438#define I2S_USE_APLL true
439// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 5). Or you could drive the LED by assigning LED_BUILTIN
440#define PIN_I2S_MUTE -1
441#define SOFT_MUTE_VALUE 0
442#define PIN_CS SS
443#define PIN_ADC1 21
444#define I2S_AUTO_CLEAR true
445
446typedef uint32_t eps32_i2s_sample_rate_type;
447
448#endif
449
450
451//----- ESP8266 -----------
452#ifdef ESP8266
453# include <ESP8266WiFi.h>
454//#define USE_URL_ARDUINO // commented out because of compile errors
455#define USE_I2S
456#define USE_TYPETRAITS
457#define USE_TIMER
458#define USE_WIFI
459#define USE_AUDIO_SERVER
460#define USE_URL_ARDUINO
461
462#define PIN_PWM_START 12
463#define PIN_I2S_BCK -1
464#define PIN_I2S_WS -1
465#define PIN_I2S_DATA_IN -1
466#define PIN_I2S_DATA_OUT -1
467#define I2S_USE_APLL false
468#define PIN_I2S_MUTE 23
469#define SOFT_MUTE_VALUE 0
470#define PIN_CS SS
471#define USE_SERVER_ACCEPT 1
472
473#define URL_CLIENT_TIMEOUT 60000;
474#define URL_HANDSHAKE_TIMEOUT 120000
475#define USE_SD_SUPPORTS_SPI
476
477#endif
478
479//------ NANO33BLE ----------
480#if (defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ARDUINO_ARCH_MBED_NANO)) && !defined(ARDUINO_ARCH_ZEPHYR)
481#define USE_NANO33BLE
482#define USE_INT24_FROM_INT
483#define USE_I2S
484#define USE_PWM
485#define USE_TYPETRAITS
486#define USE_TIMER
487//#define USE_INITIALIZER_LIST
488#define USE_ALT_PIN_SUPPORT
489
490#define PIN_PWM_START 5
491#define PIN_I2S_BCK 2
492#define PIN_I2S_WS 3
493#define PIN_I2S_DATA_IN 4
494#define PIN_I2S_DATA_OUT 4
495// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 4). Or you could drive the LED by assigning LED_BUILTIN
496#define PIN_I2S_MUTE -1
497#define SOFT_MUTE_VALUE 0
498#define PIN_CS SS
499#endif
500
501//----- RP2040 MBED -----------
502#if defined(ARDUINO_ARCH_MBED_RP2040)
503// install https://github.com/pschatzmann/rp2040-i2s
504#define RP2040_MBED
505#define USE_I2S 1
506#define USE_PWM
507#define USE_ANALOG_ARDUINO
508#define USE_TYPETRAITS
509#define USE_TIMER
510#define USE_INT24_FROM_INT
511
512#define PIN_ANALOG_START 26
513#define PIN_PWM_START 6
514#define PIN_I2S_BCK 26
515#define PIN_I2S_WS PIN_I2S_BCK+1
516#define PIN_I2S_DATA_IN 28
517#define PIN_I2S_DATA_OUT 28
518// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 4). Or you could drive the LED by assigning LED_BUILTIN
519#define PIN_I2S_MUTE -1
520#define SOFT_MUTE_VALUE 0
521#define PIN_CS 1 //PIN_SPI0_SS
522
523// fix missing __sync_synchronize symbol
524#define FIX_SYNC_SYNCHRONIZE
525#define IRAM_ATTR
526#ifndef ANALOG_BUFFER_SIZE
527#define ANALOG_BUFFER_SIZE 1024
528#endif
529
530#ifndef ANALOG_BUFFERS
531#define ANALOG_BUFFERS 50
532#endif
533
534//#define USE_ESP8266_AUDIO
535
536//----- RP2040 -----------
537#elif defined(ARDUINO_ARCH_RP2040)
538#define RP2040_HOWER
539#define USE_SD_NO_NS
540#define USE_I2S
541#define USE_PWM
542#define USE_ANALOG_ARDUINO
543#define USE_TYPETRAITS
544#define USE_TIMER
545#define USE_INT24_FROM_INT
546
547#define PIN_ANALOG_START 26
548#define PIN_PWM_START 6
549#define PIN_I2S_BCK 26
550#define PIN_I2S_WS PIN_I2S_BCK+1
551#define PIN_I2S_DATA_IN 28
552#define PIN_I2S_DATA_OUT 28
553#define PIN_I2S_MCK -1
554// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 4). Or you could drive the LED by assigning LED_BUILTIN
555#define PIN_I2S_MUTE -1
556#define SOFT_MUTE_VALUE 0
557#define PIN_CS PIN_SPI0_SS
558#define USE_SERVER_ACCEPT true
559
560// fix missing __sync_synchronize symbol
561//#define FIX_SYNC_SYNCHRONIZE
562#define IRAM_ATTR
563
564#ifndef ANALOG_BUFFER_SIZE
565#define ANALOG_BUFFER_SIZE 256
566#endif
567
568#ifndef ANALOG_BUFFERS
569#define ANALOG_BUFFERS 100
570#endif
571
572//#define USE_CONCURRENCY
573#define USE_SD_SUPPORTS_SPI
574
575// default pins for VS1053 shield
576#define VS1053_CS 17
577#define VS1053_DCS 9
578#define VS1053_DREQ 10
579#define VS1053_CS_SD -1
580#define VS1053_RESET 11
581#define VS1053_DEFINED
582#endif
583
584// The Pico W has WIFI support: but platformio is messing up, so we support NO_WIFI
585#if (defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_RASPBERRY_PI_PICO_W) || defined(ARDUINO_ARCH_RP2040)) && (LWIP_IPV4==1 || LWIP_IPV6==1) &&!defined(NO_WIFI)
586# include <WiFi.h>
587# define USE_WIFI
588# define USE_WIFI_CLIENT_SECURE
589# define USE_URL_ARDUINO
590# define USE_AUDIO_SERVER
591using WiFiServerSecure = BearSSL::WiFiServerSecure;
592#endif
593
594
595//----- AVR -----------
596#ifdef __AVR__
597#define USE_SD_NO_NS
598#define USE_PWM
599#define USE_TIMER
600#define NO_INPLACE_INIT_SUPPORT
601// Uncomment to activate network
602//#include <Ethernet.h>
603//#define USE_URL_ARDUINO
604#ifndef assert
605# define assert(T)
606#endif
607
608#define PIN_PWM_START 6
609#define PIN_CS SS
610
611#undef PWM_BUFFER_SIZE
612#define PWM_BUFFER_SIZE 125
613
614#undef DEFAULT_BUFFER_SIZE
615#define DEFAULT_BUFFER_SIZE 125
616
617// logging is using too much memory
618#undef USE_AUDIO_LOGGING
619#undef LOG_PRINTF_BUFFER_SIZE
620#define LOG_PRINTF_BUFFER_SIZE 60
621#define NO_TRACED
622#define NO_TRACEI
623#define NO_TRACEE
624
625// we use spi to emulate i2s
626#define PIN_I2S_BCK 13
627#define PIN_I2S_WS 10
628#define PIN_I2S_DATA_IN 12
629#define PIN_I2S_DATA_OUT 11
630#define PIN_I2S_MUTE -1
631
632#endif
633
634
635//---- STM32 ------------
636#if defined(ARDUINO_ARCH_STM32)
637#define STM32
638#endif
639
640#ifdef STM32
641#define USE_I2S
642#define USE_PWM
643#define USE_TIMER
644#define USE_ANALOG
645#define USE_ANALOG_ARDUINO
646#define USE_INT24_FROM_INT
647
648#define PIN_ANALOG_START PA0
649#define PIN_PWM_START PA0
650#define PWM_DEFAULT_TIMER TIM2
651#define PWM_FREQ_TIMER_NO 3
652#define USE_SD_NO_NS
653
654#define PIN_I2S_BCK -1
655#define PIN_I2S_WS -1
656#define PIN_I2S_DATA_IN -1
657#define PIN_I2S_DATA_OUT -1
658#define PIN_I2S_MUTE -1
659#define SOFT_MUTE_VALUE 0
660#define PIN_CS -1
661
662#define USE_ETHERNET
663#define USE_URL_ARDUINO
664#define USE_AUDIO_SERVER
665
666
667#endif
668
669//---- SAMD ------------
670
671#ifdef ARDUINO_ARCH_SAMD
672#define NO_INPLACE_INIT_SUPPORT
673#ifndef SEEED_XIAO_M0
674# define USE_I2S
675#endif
676#define USE_INT24_FROM_INT
677#define PIN_I2S_BCK 1
678#define PIN_I2S_WS PIN_I2S_BCK+1
679#define PIN_I2S_DATA_IN 3
680#define PIN_I2S_DATA_OUT 3
681#define PIN_I2S_MUTE -1
682#define SOFT_MUTE_VALUE 0
683#define USE_SD_NO_NS
684#define PIN_CS 4
685#endif
686
687#ifdef ARDUINO_SAMD_MKRWIFI1010
688#include <WiFiNINA.h>
689#define USE_URL_ARDUINO
690#define USE_AUDIO_SERVER
691#endif
692
693//---- GIGA ------------
694// DRAFT Support - Not tested !
695#if defined(ARDUINO_GIGA)
696#include <WiFi.h>
697#include <Arduino_AdvancedAnalog.h>
698#define IS_MBED
699#define USE_INT24_FROM_INT
700#define USE_TYPETRAITS
701#define USE_ANALOG
702#define USE_STREAM_WRITE_OVERRIDE
703#define ANALOG_BUFFER_SIZE 1024
704#define ANALOG_BUFFERS 10
705#define USE_URL_ARDUINO
706#define USE_AUDIO_SERVER
707
708#define PIN_ANALOG_START A7
709#define PIN_DAC_1 A12
710#define PIN_DAC_2 A13
711
712#endif
713
714// //---- Portenta ------------
715// // DRAFT: not tested
716#if defined(ARDUINO_ARCH_MBED_PORTENTA)
717#include <WiFi.h>
718#include <Arduino_AdvancedAnalog.h>
719#define IS_MBED
720#define USE_INT24_FROM_INT
721#define USE_TYPETRAITS
722#define USE_ANALOG
723#define USE_TIMER
724#define USE_PWM
725#define USE_STREAM_WRITE_OVERRIDE
726#define ANALOG_BUFFER_SIZE 1024
727#define ANALOG_BUFFERS 10
728#define USE_URL_ARDUINO
729#define USE_AUDIO_SERVER
730
731#define PIN_ANALOG_START A0
732#define PIN_PWM_START D2
733#define PIN_DAC_1 D0
734#define PIN_DAC_2 D1
735#endif
736
737//------ RENESAS ----------
738// Arduino UNO R4
739#if defined(ARDUINO_ARCH_RENESAS) || defined(_RENESAS_RA_)
740// no trace to save on memory
741#define NO_TRACE
742#define LOG_NO_MSG // around 4K less
743
744#define USE_INT24_FROM_INT
745#define IS_RENESAS 1
746#define USE_TYPETRAITS
747#define USE_TIMER
748#define USE_PWM
749#define PIN_PWM_START D2
750#define PIN_PWM_COUNT 12
751#define USE_ANALOG
752#define USE_ANALOG_ARDUINO
753#define USE_SD_NO_NS
754#define PIN_ANALOG_START A0
755#define ANALOG_BUFFER_SIZE 512
756#define ANALOG_BUFFERS 5
757#define ANALOG_MAX_OUT_CHANNELS 1
758#define ANALOG_MAX_SAMPLE_RATE 16000
759// default pins for UNO VS1053 shield
760#define VS1053_CS 6
761#define VS1053_DCS 7
762#define VS1053_DREQ 2
763#define VS1053_CS_SD 9
764#define VS1053_RESET 8
765#define VS1053_DEFINED
766#define PIN_CS 9
767
768#if defined(ARDUINO) && !defined(ARDUINO_MINIMA)
769# define USE_WIFI
770# define USE_URL_ARDUINO
771# define USE_AUDIO_SERVER
772# include "WiFiS3.h"
773#endif
774
775#endif
776
777
778// ------ Zephyr -------
779#ifdef ARDUINO_ARCH_ZEPHYR
780# define IS_ZEPHYR
781# define NO_INPLACE_INIT_SUPPORT
782# define USE_TYPETRAITS
783# define USE_I2S
784# define PIN_I2S_BCK 2
785# define PIN_I2S_WS 3
786# define PIN_I2S_DATA_IN 4
787# define PIN_I2S_DATA_OUT 4
788// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 4). Or you could drive the LED by assigning LED_BUILTIN
789# define PIN_I2S_MUTE -1
790# define SOFT_MUTE_VALUE 0
791# define USE_NANO33BLE
792# define USE_ALT_PIN_SUPPORT
793#endif
794
795//------ VS1053 ----------
796// see https://github.com/pschatzmann/arduino-vs1053/wiki/Pinouts-for-Processors-and-Tested-Boards#microcontrollers
797// Default Pins for VS1053
798#ifndef VS1053_DEFINED
799# define VS1053_CS 5
800# define VS1053_DCS 16
801# define VS1053_DREQ 4
802# define VS1053_RESET 15
803# define VS1053_CS_SD -1
804#endif
805
806// use 0 for https://github.com/baldram/ESP_VS1053_Library
807// use 1 for https://github.com/pschatzmann/arduino-vs1053
808#define VS1053_EXT 1
809#define VS1053_DEFAULT_VOLUME 0.7
810
811
812//----------------
813// Fallback defined if nothing was defined in the platform
814
815#ifndef ARDUINO
816# define USE_STREAM_WRITE_OVERRIDE
817#endif
818
819#ifndef ANALOG_MAX_SAMPLE_RATE
820# define ANALOG_MAX_SAMPLE_RATE 44100
821#endif
822
823#ifndef PWM_MAX_SAMPLE_RATE
824# define PWM_MAX_SAMPLE_RATE 8000
825#endif
826
827
828#ifndef URL_CLIENT_TIMEOUT
829# define URL_CLIENT_TIMEOUT 60000;
830# define URL_HANDSHAKE_TIMEOUT 120000
831#endif
832
833#ifndef USE_TASK
834# define USE_TASK false
835#endif
836
837#ifndef USE_SERVER_ACCEPT
838# define USE_SERVER_ACCEPT false
839#endif
840
841#ifndef USE_ALLOCATOR
842# define USE_ALLOCATOR false
843#endif
844
845#ifndef USE_ESP32_LOGGER
846# define USE_ESP32_LOGGER false
847#endif
848
849// Standard Arduino Print provides flush function
850#ifndef USE_PRINT_FLUSH
851# define USE_PRINT_FLUSH true
852#endif
853
854#ifndef ESP_IDF_VERSION_VAL
855# define ESP_IDF_VERSION_VAL(a, b , c) 0
856#endif
857
858#if USE_CHECK_MEMORY
859# define CHECK_MEMORY() checkMemory(true)
860#else
861# define CHECK_MEMORY()
862#endif
863
864#pragma GCC diagnostic ignored "-Wunused-variable"
865#pragma GCC diagnostic ignored "-Wunused-function"
866#pragma GCC diagnostic ignored "-Wvla"
867#pragma GCC diagnostic ignored "-Wsign-compare"
868#pragma GCC diagnostic ignored "-Woverloaded-virtual"
869#pragma GCC diagnostic ignored "-Wdouble-promotion"
870
871#ifdef USE_NO_MEMACCESS
872#pragma GCC diagnostic ignored "-Wclass-memaccess"
873#endif
874
875#ifdef USE_INITIALIZER_LIST
876#pragma GCC diagnostic ignored "-Wnarrowing"
877#endif
878
879#undef rewind
880
881// select int24 implementation
882#include "AudioTools/CoreAudio/AudioBasic/Int24_3bytes_t.h"
883#include "AudioTools/CoreAudio/AudioBasic/Int24_4bytes_t.h"
884#include "AudioTools/CoreAudio/AudioBasic/FloatAudio.h"
885
886namespace audio_tools {
887 #ifdef USE_3BYTE_INT24
888 using int24_t = audio_tools::int24_3bytes_t;
889 #else
890 using int24_t = audio_tools::int24_4bytes_t;
891 #endif
892}
893
899#if USE_AUDIOTOOLS_NS
900using namespace audio_tools;
901#endif
902
If you want to use the framework w/o Arduino you need to provide the implementation of a couple of cl...
24bit integer which is used for I2S sound processing. The values are really using 3 bytes....
Definition Int24_3bytes_t.h:16
24bit integer which is used for I2S sound processing. The values are represented as int32_t,...
Definition Int24_4bytes_t.h:16
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition AudioCodecsBase.h:10