Skip to content

Commit 048a67d

Browse files
authored
Add files via upload
1 parent d619e38 commit 048a67d

File tree

13 files changed

+3915
-0
lines changed

13 files changed

+3915
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# The following lines of boilerplate have to be in your project's
2+
# CMakeLists in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.5)
4+
5+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
7+
project(play_http_music)
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
2+
# Play multiple format music from microSD card
3+
4+
- [中文版](./README_CN.md)
5+
6+
## Example Brief
7+
8+
This example demonstrates playing music in MP3 formats from online HTTP stream via HTTP IO. The music files are then decoded using a decoder element, processed by audio effects, and finally output through the CODEC_DEV_TX IO.
9+
10+
## Example Set Up
11+
12+
### Default IDF Branch
13+
14+
This example supports IDF release/v5.3 and later branches.
15+
16+
### Configuration
17+
18+
19+
This example requires prior configuration of Wi-Fi connection settings. Please specify the `Wi-Fi SSID` and `Wi-Fi Password` by navigating to `menuconfig > Example Configuration`.
20+
21+
22+
### Build and Flash
23+
24+
Before compiling this example, ensure that the ESP-IDF environment is properly configured. If it is already set up, you can proceed to the next configuration step. If not, run the following script in the root directory of ESP-IDF to set up the build environment. For detailed steps on configuring and using ESP-IDF, please refer to the [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/index.html)
25+
26+
```
27+
./install.sh
28+
. ./export.sh
29+
```
30+
31+
Here are the summarized steps for compilation:
32+
33+
- Enter the location where the HTTP music playback test project is stored
34+
35+
```
36+
cd $YOUR_GMF_PATH/gmf_examples/basic_examples/pipeline_play_http_music
37+
```
38+
39+
- Select the target chip for compilation. For example, to use the ESP32S3:
40+
41+
```
42+
idf.py set-target esp32s3
43+
```
44+
- Select the compilation board, taking esp32 s3 Korvo V2 as an example:
45+
46+
```
47+
idf.py menuconfig
48+
In 'menuconfig', select 'GMF APP Configuration' -> 'Audio Board' -> 'ESP32-S3-Korvo V2', and then save and exit
49+
```
50+
51+
- Build the Example
52+
53+
```
54+
idf.py build
55+
```
56+
57+
- Flash the program and run the monitor tool to view serial output (replace PORT with the port name):
58+
59+
```
60+
idf.py -p PORT flash monitor
61+
```
62+
63+
- Exit the debugging interface using ``Ctrl-]``
64+
65+
## How to use the Example
66+
67+
### Example Functionality
68+
69+
- After the example starts running, it will automatically play the music files transmissed by the HTTP, stop and exit after playback is complete, with the following output:
70+
71+
```c
72+
I (1045) PLAY_HTTP_MUSIC: [ 1 ] Mount peripheral
73+
E (1104) i2c.master: this port has not been initialized, please initialize it first
74+
I (1112) CODEC_INIT: Set mater handle 0 0x3c1d236c
75+
I (1116) CODEC_INIT: in:1 out:1 port: 1
76+
I (1119) CODEC_INIT: Success to int i2c: 0
77+
I (1123) CODEC_INIT: Init i2s 0 type: 3 mclk:16 bclk:9 ws:45 din:10 dout:8
78+
I (1130) CODEC_INIT: tx:0x3c1d27e4 rx:0x3c1d2998
79+
I (1134) CODEC_INIT: output init std ret 0
80+
I (1138) CODEC_INIT: Input init std ret 0
81+
I (1142) CODEC_INIT: Init i2s 0 ok
82+
I (1145) CODEC_INIT: Success to init i2s: 0
83+
I (1149) CODEC_INIT: Success to int i2c: 0
84+
I (1153) CODEC_INIT: Success to init i2s: 0
85+
I (1156) CODEC_INIT: Get out handle 0x3c1d27e4 port 0
86+
I (1166) ES8311: Work in Slave mode
87+
I (1172) ES7210: Work in Slave mode
88+
I (1179) ES7210: Enable ES7210_INPUT_MIC1
89+
I (1181) ES7210: Enable ES7210_INPUT_MIC3
90+
I (1189) I2S_IF: channel mode 0 bits:16/16 channel:2 mask:3
91+
I (1189) I2S_IF: STD Mode 1 bits:16/16 channel:2 sample_rate:48000 mask:3
92+
I (1204) Adev_Codec: Open codec device OK
93+
I (1206) I2S_IF: channel mode 0 bits:16/16 channel:2 mask:3
94+
I (1206) I2S_IF: STD Mode 0 bits:16/16 channel:2 sample_rate:48000 mask:3
95+
I (1210) ES7210: Bits 16
96+
I (1218) ES7210: Enable ES7210_INPUT_MIC1
97+
I (1221) ES7210: Enable ES7210_INPUT_MIC3
98+
I (1228) ES7210: Unmuted
99+
I (1228) Adev_Codec: Open codec device OK
100+
I (1231) example_connect: Start example_connect.
101+
I (1232) pp: pp rom version: e7ae62f
102+
I (1232) net80211: net80211 rom version: e7ae62f
103+
I (1238) wifi:wifi driver task: 3fcba5b4, prio:23, stack:6656, core=0
104+
I (1244) wifi:wifi firmware version: cc37956
105+
I (1247) wifi:wifi certification version: v7.0
106+
I (1251) wifi:config NVS flash: enabled
107+
I (1254) wifi:config nano formatting: disabled
108+
I (1259) wifi:Init data frame dynamic rx buffer num: 32
109+
I (1264) wifi:Init static rx mgmt buffer num: 5
110+
I (1268) wifi:Init management short buffer num: 32
111+
I (1272) wifi:Init static tx buffer num: 16
112+
I (1276) wifi:Init tx cache buffer num: 32
113+
I (1280) wifi:Init static tx FG buffer num: 2
114+
I (1284) wifi:Init static rx buffer size: 1600
115+
I (1288) wifi:Init static rx buffer num: 16
116+
I (1292) wifi:Init dynamic rx buffer num: 32
117+
I (1296) wifi_init: rx ba win: 16
118+
I (1299) wifi_init: accept mbox: 6
119+
I (1302) wifi_init: tcpip mbox: 32
120+
I (1305) wifi_init: udp mbox: 6
121+
I (1308) wifi_init: tcp mbox: 6
122+
I (1311) wifi_init: tcp tx win: 5760
123+
I (1314) wifi_init: tcp rx win: 5760
124+
I (1318) wifi_init: tcp mss: 1440
125+
I (1321) wifi_init: WiFi/LWIP prefer SPIRAM
126+
I (1325) wifi_init: WiFi IRAM OP enabled
127+
I (1328) wifi_init: WiFi RX IRAM OP enabled
128+
I (1333) phy_init: phy_version 701,f4f1da3a,Mar 3 2025,15:50:10
129+
I (1388) wifi:mode : sta (8c:bf:ea:86:71:04)
130+
I (1389) wifi:enable tsf
131+
I (1390) example_connect: Connecting to ESP-Audio...
132+
I (1391) example_connect: Waiting for IP(s)
133+
I (3866) wifi:new:<2,0>, old:<1,0>, ap:<255,255>, sta:<2,0>, prof:1, snd_ch_cfg:0x0
134+
I (3867) wifi:state: init -> auth (0xb0)
135+
I (3870) wifi:state: auth -> assoc (0x0)
136+
I (3876) wifi:state: assoc -> run (0x10)
137+
I (3979) wifi:[ADDBA]RX DELBA, reason:39, delete tid:0, initiator:1(originator)
138+
I (3979) wifi:[ADDBA]RX DELBA, reason:39, delete tid:0, initiator:0(recipient)
139+
I (4084) wifi:connected with ESP-Audio, aid = 2, channel 2, BW20, bssid = fc:2f:ef:ab:db:70
140+
I (4084) wifi:security: WPA2-PSK, phy: bgn, rssi: -34
141+
I (4086) wifi:pm start, type: 1
142+
I (4089) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
143+
I (4108) wifi:<ba-add>idx:0 (ifx:0, fc:2f:ef:ab:db:70), tid:0, ssn:5, winSize:64
144+
I (4276) wifi:AP's beacon interval = 204800 us, DTIM period = 1
145+
I (5106) esp_netif_handlers: example_netif_sta ip: 192.168.1.102, mask: 255.255.255.0, gw: 192.168.1.1
146+
I (5106) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 192.168.1.102
147+
I (5231) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fe80:0000:0000:0000:8ebf:eaff:fe86:7104, type: ESP_IP6_ADDR_IS_LINK_LOCAL
148+
I (5233) example_common: Connected to example_netif_sta
149+
I (5238) example_common: - IPv4 address: 192.168.1.102,
150+
I (5243) example_common: - IPv6 address: fe80:0000:0000:0000:8ebf:eaff:fe86:7104, type: ESP_IP6_ADDR_IS_LINK_LOCAL
151+
I (5254) PLAY_HTTP_MUSIC: [ 2 ] Register all the elements and set audio information to play codec device
152+
I (5263) ESP_GMF_BLOCK: The block buf:0x3c1e3a24, end:0x3c1e5a24
153+
I (5268) NEW_DATA_BUS: New block buf, num:1, item_cnt:8192, db:0x3c1e5a28
154+
I (5275) ESP_GMF_TASK: Waiting to run... [tsk:io_http-0x3fcc8d50, wk:0x0, run:0]
155+
I (5282) ESP_GMF_TASK: Waiting to run... [tsk:io_http-0x3fcc8d50, wk:0x3c1e5ab0, run:0]
156+
I (5290) ESP_GMF_POOL: Registered items on pool:0x3c1e3678, app_main-57
157+
I (5296) ESP_GMF_POOL: IO, Item:0x3c1e3724, H:0x3c1e368c, TAG:io_codec_dev
158+
I (5303) ESP_GMF_POOL: IO, Item:0x3c1e37cc, H:0x3c1e3734, TAG:io_codec_dev
159+
I (5309) ESP_GMF_POOL: IO, Item:0x3c1e3870, H:0x3c1e37dc, TAG:io_file
160+
I (5315) ESP_GMF_POOL: IO, Item:0x3c1e3914, H:0x3c1e3880, TAG:io_file
161+
I (5322) ESP_GMF_POOL: IO, Item:0x3c1e5af8, H:0x3c1e3924, TAG:io_http
162+
I (5328) ESP_GMF_POOL: IO, Item:0x3c1e5ba8, H:0x3c1e5b08, TAG:io_embed_flash
163+
I (5335) ESP_GMF_POOL: EL, Item:0x3c1e5cac, H:0x3c1e5bb8, TAG:aud_enc
164+
I (5341) ESP_GMF_POOL: EL, Item:0x3c1e5dc8, H:0x3c1e5cbc, TAG:aud_dec
165+
I (5347) ESP_GMF_POOL: EL, Item:0x3c1e5ebc, H:0x3c1e5dd8, TAG:aud_alc
166+
I (5353) ESP_GMF_POOL: EL, Item:0x3c1e5f9c, H:0x3c1e5ecc, TAG:aud_ch_cvt
167+
I (5359) ESP_GMF_POOL: EL, Item:0x3c1e6078, H:0x3c1e5fac, TAG:aud_bit_cvt
168+
I (5366) ESP_GMF_POOL: EL, Item:0x3c1e615c, H:0x3c1e6088, TAG:aud_rate_cvt
169+
I (5373) PLAY_HTTP_MUSIC: [ 3 ] Create http stream to read data
170+
I (5379) ESP_GMF_BLOCK: The block buf:0x3c1e626c, end:0x3c1eb26c
171+
I (5384) NEW_DATA_BUS: New block buf, num:1, item_cnt:20480, db:0x3c1eb270
172+
I (5391) ESP_GMF_TASK: Waiting to run... [tsk:io_http-0x3fcca184, wk:0x0, run:0]
173+
I (5398) ESP_GMF_TASK: Waiting to run... [tsk:io_http-0x3fcca184, wk:0x3c1ecafc, run:0]
174+
I (5405) PLAY_HTTP_MUSIC: [ 4 ] Create audio pipeline
175+
I (5411) ESP_GMF_BLOCK: The block buf:0x3c1ed184, end:0x3c1ef184
176+
I (5416) NEW_DATA_BUS: New block buf, num:1, item_cnt:8192, db:0x3c1ef188
177+
I (5422) ESP_GMF_TASK: Waiting to run... [tsk:io_http-0x3fcca730, wk:0x0, run:0]
178+
I (5430) ESP_GMF_TASK: Waiting to run... [tsk:io_http-0x3fcca730, wk:0x3c1ef210, run:0]
179+
I (5437) PLAY_HTTP_MUSIC: [ 4.1 ] Set audio url to play
180+
I (5442) PLAY_HTTP_MUSIC: [ 5 ] Create gmf task, bind task to pipeline and load linked element jobs to the bind task
181+
I (5453) ESP_GMF_TASK: Waiting to run... [tsk:TSK_0x3fccb620-0x3fccb620, wk:0x0, run:0]
182+
I (5460) ESP_GMF_TASK: Waiting to run... [tsk:TSK_0x3fccb620-0x3fccb620, wk:0x3c1ef3c0, run:0]
183+
I (5468) PLAY_HTTP_MUSIC: [ 5.1 ] Create envent group and listening event from pipeline
184+
I (5476) PLAY_HTTP_MUSIC: [ 5.2 ] Start audio_pipeline
185+
I (5481) ESP_GMF_HTTP: HTTP Open, URI = https://dl.espressif.com/dl/audio/ff-16b-2c-44100hz.mp3
186+
I (6215) ESP_GMF_HTTP: The total size is 2994349 bytes
187+
I (6216) PLAY_HTTP_MUSIC: CB: RECV Pipeline EVT: el: OBJ_GET_TAG(event->from)-0x3c1ecb44, type: 2000, sub: ESP_GMF_EVENT_STATE_OPENING, payload: 0x0, size: 0, 0x3fccc910
188+
I (6224) ESP_GMF_TASK: One times job is complete, del[wk:0x3c1ef3c0, ctx:0x3c1ecb88, label:aud_dec_open]
189+
I (6233) ESP_GMF_PORT: ACQ IN, new self payload:0x3c1ef3c0, port:0x3c1ef258, el:0x3c1ecb88-aud_dec
190+
W (6243) ESP_GMF_ASMP_DEC: Not enough memory for out, need:4608, old: 1024, new: 4608
191+
I (6252) ESP_GMF_TASK: One times job is complete, del[wk:0x3c1f081c, ctx:0x3c1ecc94, label:aud_rate_cvt_open]
192+
I (6259) ESP_GMF_TASK: One times job is complete, del[wk:0x3c1f08f4, ctx:0x3c1ecde8, label:aud_ch_cvt_open]
193+
I (6269) PLAY_HTTP_MUSIC: CB: RECV Pipeline EVT: el: OBJ_GET_TAG(event->from)-0x3c1ecf38, type: 3000, sub: ESP_GMF_EVENT_STATE_INITIALIZED, payload: 0x3fccc560, size: 16, 0x3fccc910
194+
I (6285) PLAY_HTTP_MUSIC: CB: RECV Pipeline EVT: el: OBJ_GET_TAG(event->from)-0x3c1ecf38, type: 2000, sub: ESP_GMF_EVENT_STATE_RUNNING, payload: 0x0, size: 0, 0x3fccc910
195+
I (6299) ESP_GMF_TASK: One times job is complete, del[wk:0x3c1f081c, ctx:0x3c1ecf38, label:aud_bit_cvt_open]
196+
I (6313) PLAY_HTTP_MUSIC: [ 5.3 ] Wait stop event to the pipeline and stop all the pipeline
197+
W (179717) ESP_GMF_HTTP: No more data, errno: 0, read bytes: 2994349, rlen = 0
198+
I (179717) ESP_GMF_TASK: Job is done, [tsk:io_http-0x3fcca730, wk:0x3c1ef210, job:0x3c1ed084-io_http_proc]
199+
I (179722) ESP_GMF_TASK: Waiting to run... [tsk:io_http-0x3fcca730, wk:0x0, run:0]
200+
I (179860) ESP_GMF_BLOCK: Done on read, wanted:173, h:0x3c1ed14c, r:0x3c1ed984, w:0x3c1eda31, we:0x3c1ed184
201+
W (179885) ESP_GMF_BLOCK: Done set on read, h:0x3c1ed14c, rd:0x3c1eda31, wr:0x3c1eda31, wr_e:0x3c1ed184
202+
I (179885) ESP_GMF_TASK: Job is done, [tsk:TSK_0x3fccb620-0x3fccb620, wk:0x3c1ef3f8, job:0x3c1ecb88-aud_dec_proc]
203+
I (179893) ESP_GMF_TASK: Job is done, [tsk:TSK_0x3fccb620-0x3fccb620, wk:0x3c1f08d0, job:0x3c1ecc94-aud_rate_cvt_proc]
204+
I (179903) ESP_GMF_TASK: Job is done, [tsk:TSK_0x3fccb620-0x3fccb620, wk:0x3c1f0918, job:0x3c1ecde8-aud_ch_cvt_proc]
205+
I (179913) ESP_GMF_TASK: Job is done, [tsk:TSK_0x3fccb620-0x3fccb620, wk:0x3c1f0950, job:0x3c1ecf38-aud_bit_cvt_proc]
206+
W (179924) ESP_GMF_TASK: Already stopped, ESP_GMF_EVENT_STATE_FINISHED, [io_http,0x3fcca730]
207+
I (179933) ESP_GMF_CODEC_DEV: CLose, 0x3c1ef298, pos = 33007104/0
208+
I (179938) ESP_GMF_TASK: One times job is complete, del[wk:0x3c1f081c, ctx:0x3c1ecb88, label:aud_dec_close]
209+
I (179947) ESP_GMF_TASK: One times job is complete, del[wk:0x3c1ef210, ctx:0x3c1ecc94, label:aud_rate_cvt_close]
210+
I (179957) ESP_GMF_TASK: One times job is complete, del[wk:0x3c1ef3e4, ctx:0x3c1ecde8, label:aud_ch_cvt_close]
211+
I (179967) ESP_GMF_TASK: One times job is complete, del[wk:0x3c1f0790, ctx:0x3c1ecf38, label:aud_bit_cvt_close]
212+
I (179977) PLAY_HTTP_MUSIC: CB: RECV Pipeline EVT: el: OBJ_GET_TAG(event->from)-0x3c1ecb44, type: 2000, sub: ESP_GMF_EVENT_STATE_FINISHED, payload: 0x0, size: 0, 0x3fccc910
213+
I (179992) ESP_GMF_TASK: Waiting to run... [tsk:TSK_0x3fccb620-0x3fccb620, wk:0x0, run:0]
214+
I (180000) ESP_GMF_TASK: Waiting to run... [tsk:TSK_0x3fccb620-0x3fccb620, wk:0x0, run:0]
215+
W (180007) ESP_GMF_TASK: Already stopped, ESP_GMF_EVENT_STATE_FINISHED, [TSK_0x3fccb620,0x3fccb620]
216+
I (180016) PLAY_HTTP_MUSIC: [ 6 ] Destroy all the resources
217+
```
218+
219+
## Troubleshooting
220+
221+
If your log has the following error message, Please modify the SSL server verification settings in `sdkconfig`:
222+
223+
Run `menuconfig > Component config > ESP LTS` , and enabled `allow potentially insecure options > Skip server verification by default`
224+
225+
```c
226+
I (5477) PLAY_HTTP_MUSIC: [ 5.2 ] Start audio_pipeline
227+
I (5482) ESP_GMF_HTTP: HTTP Open, URI = https://dl.espressif.com/dl/audio/ff-16b-2c-44100hz.mp3
228+
E (5577) esp-tls-mbedtls: No server verification option set in esp_tls_cfg_t structure. Check esp_tls API reference
229+
E (5577) esp-tls-mbedtls: Failed to set client configurations, returned [0x8017] (ESP_ERR_MBEDTLS_SSL_SETUP_FAILED)
230+
E (5586) esp-tls: create_ssl_handle failed
231+
E (5590) esp-tls: Failed to open new connection
232+
E (5594) transport_base: Failed to open a new connection
233+
E (5600) HTTP_CLIENT: Connection failed, sock < 0
234+
E (5604) ESP_GMF_HTTP: Failed to open http stream
235+
E (5608) ESP_GMF_IO: esp_gmf_io_open(66): esp_gmf_io_open failed
236+
E (5614) ESP_GMF_PIPELINE: Failed to open the in port, ret:28674,[0x3fccb618-TSK_0x3fccb618]
237+
```

0 commit comments

Comments
 (0)