File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
examples/examples-audiokit Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* *
2
+ * @file streams-sd-audiokit.ino
3
+ * @author Phil Schatzmann
4
+ * @brief Just a small demo, how to use files with the SD library with a streaming decoder
5
+ * @version 0.1
6
+ * @date 2022-10-09
7
+ *
8
+ * @copyright Copyright (c) 2022
9
+ *
10
+ */
11
+ #include < SPI.h>
12
+ #include < SD.h>
13
+ #include " AudioTools.h"
14
+ #include " AudioLibs/AudioBoardStream.h"
15
+ #include " AudioCodecs/CodecFLAC.h"
16
+
17
+
18
+ const int chipSelect=PIN_AUDIO_KIT_SD_CARD_CS;
19
+ AudioBoardStream i2s (AudioKitEs8388V1); // final output of decoded stream
20
+ FLACDecoder dec;
21
+ StreamCopy copier;
22
+ File audioFile;
23
+
24
+ void setup (){
25
+ Serial.begin (115200 );
26
+ AudioLogger::instance ().begin (Serial, AudioLogger::Info);
27
+
28
+ // setup audiokit before SD!
29
+ auto config = i2s.defaultConfig (TX_MODE);
30
+ config.sd_active = true ;
31
+ i2s.begin (config);
32
+
33
+ // setup file
34
+ SD.begin (chipSelect);
35
+ audioFile = SD.open (" /flac/test2.flac" );
36
+
37
+ // setup decoder
38
+ dec.setInputStream (audioFile);
39
+ dec.setOutputStream (i2s);
40
+ dec.begin ();
41
+
42
+ }
43
+
44
+ void loop (){
45
+ dec.copy ();
46
+ }
File renamed without changes.
You can’t perform that action at this time.
0 commit comments