Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ESP32-audioI2S
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ESP32-audioI2S
Commits
9783563c
Unverified
Commit
9783563c
authored
Sep 01, 2021
by
Wolle
Committed by
GitHub
Sep 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ES8388 example
parent
84e97632
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80027 additions
and
0 deletions
+80027
-0
examples/ESP32-ES8388/ESP32-ADF_Rev_C.svg
examples/ESP32-ES8388/ESP32-ADF_Rev_C.svg
+79891
-0
examples/ESP32-ES8388/ESP32_ES8388.ino
examples/ESP32-ES8388/ESP32_ES8388.ino
+136
-0
No files found.
examples/ESP32-ES8388/ESP32-ADF_Rev_C.svg
0 → 100644
View file @
9783563c
This diff is collapsed.
Click to expand it.
examples/ESP32-ES8388/ESP32_ES8388.ino
0 → 100644
View file @
9783563c
#include "Arduino.h"
#include "WiFi.h"
#include "SPI.h"
#include "SD.h"
#include "FS.h"
#include "Wire.h"
#include "ES8388.h" // https://github.com/maditnerd/es8388
#include "Audio.h" // https://github.com/schreibfaul1/ESP32-audioI2S
#define SD_CS 21
// GPIOs for SPI
#define SPI_MOSI 13
#define SPI_MISO 12
#define SPI_SCK 14
// I2S GPIOs
#define I2S_SDOUT 26
#define I2S_BCLK 5
#define I2S_LRCK 25
#define I2S_MCLK 0
// I2C GPIOs
#define IIC_CLK 23
#define IIC_DATA 18
// Amplifier enable
#define GPIO_PA_EN 19
char
ssid
[]
=
"xxxxxxxxx"
;
char
password
[]
=
"xxxxxxxxx"
;
int
volume
=
80
;
// 0...100
ES8388
es
;
Audio
audio
;
//----------------------------------------------------------------------------------------------------------------------
void
setup
()
{
Serial
.
begin
(
115200
);
Serial
.
println
(
"
\r\n
Reset"
);
Serial
.
printf_P
(
PSTR
(
"Free mem=%d
\n
"
),
ESP
.
getFreeHeap
());
SPI
.
begin
(
SPI_SCK
,
SPI_MISO
,
SPI_MOSI
);
SPI
.
setFrequency
(
1000000
);
SD
.
begin
(
SD_CS
);
WiFi
.
mode
(
WIFI_STA
);
WiFi
.
begin
(
ssid
,
password
);
while
(
WiFi
.
status
()
!=
WL_CONNECTED
)
{
Serial
.
print
(
"."
);
delay
(
100
);
}
Serial
.
printf_P
(
PSTR
(
"Connected
\r\n
RSSI: "
));
Serial
.
print
(
WiFi
.
RSSI
());
Serial
.
print
(
" IP: "
);
Serial
.
println
(
WiFi
.
localIP
());
Serial
.
printf
(
"Connect to AC101 codec... "
);
while
(
not
es
.
begin
(
IIC_DATA
,
IIC_CLK
))
{
Serial
.
printf
(
"Failed!
\n
"
);
delay
(
1000
);
}
Serial
.
printf
(
"OK
\n
"
);
es
.
volume
(
ES8388
::
ES_MAIN
,
volume
);
es
.
volume
(
ES8388
::
ES_OUT1
,
volume
);
es
.
volume
(
ES8388
::
ES_OUT2
,
volume
);
es
.
mute
(
ES8388
::
ES_OUT1
,
false
);
es
.
mute
(
ES8388
::
ES_OUT2
,
false
);
es
.
mute
(
ES8388
::
ES_MAIN
,
false
);
// Enable amplifier
pinMode
(
GPIO_PA_EN
,
OUTPUT
);
digitalWrite
(
GPIO_PA_EN
,
HIGH
);
audio
.
setPinout
(
I2S_BCLK
,
I2S_LRCK
,
I2S_SDOUT
);
audio
.
i2s_mclk_pin_select
(
I2S_MCLK
);
audio
.
setVolume
(
21
);
// 0...21
audio
.
connecttohost
(
"http://mp3channels.webradio.antenne.de:80/oldies-but-goldies"
);
// audio.connecttoFS(SD, "320k_test.mp3");
// audio.connecttospeech("Wenn die Hunde schlafen, kann der Wolf gut Schafe stehlen.", "de");
}
//----------------------------------------------------------------------------------------------------------------------
void
loop
()
{
audio
.
loop
();
}
//----------------------------------------------------------------------------------------------------------------------
// optional
void
audio_info
(
const
char
*
info
){
Serial
.
print
(
"info "
);
Serial
.
println
(
info
);
}
void
audio_id3data
(
const
char
*
info
){
//id3 metadata
Serial
.
print
(
"id3data "
);
Serial
.
println
(
info
);
}
void
audio_eof_mp3
(
const
char
*
info
){
//end of file
Serial
.
print
(
"eof_mp3 "
);
Serial
.
println
(
info
);
}
void
audio_showstation
(
const
char
*
info
){
Serial
.
print
(
"station "
);
Serial
.
println
(
info
);
}
void
audio_showstreaminfo
(
const
char
*
info
){
Serial
.
print
(
"streaminfo "
);
Serial
.
println
(
info
);
}
void
audio_showstreamtitle
(
const
char
*
info
){
Serial
.
print
(
"streamtitle "
);
Serial
.
println
(
info
);
}
void
audio_bitrate
(
const
char
*
info
){
Serial
.
print
(
"bitrate "
);
Serial
.
println
(
info
);
}
void
audio_commercial
(
const
char
*
info
){
//duration in sec
Serial
.
print
(
"commercial "
);
Serial
.
println
(
info
);
}
void
audio_icyurl
(
const
char
*
info
){
//homepage
Serial
.
print
(
"icyurl "
);
Serial
.
println
(
info
);
}
void
audio_lasthost
(
const
char
*
info
){
//stream URL played
Serial
.
print
(
"lasthost "
);
Serial
.
println
(
info
);
}
void
audio_eof_speech
(
const
char
*
info
){
Serial
.
print
(
"eof_speech "
);
Serial
.
println
(
info
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment