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