Skip to content

Commit 70964ff

Browse files
committed
Add files via upload
Update README.md Delete gmf_examples/basic_examples/pipeline_play_http_music/dependencies.lock Delete gmf_examples/basic_examples/pipeline_play_http_music/sdkconfig Update README.md Update README.md Update README_CN.md Update README_CN.md Update CMakeLists.txt Update pytest_pipeline_play_http_music.py Update sdkconfig.defaults Update sdkconfig.defaults Update play_http_music.c Update sdkconfig.defaults Update sdkconfig.defaults
1 parent d619e38 commit 70964ff

File tree

11 files changed

+731
-0
lines changed

11 files changed

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

0 commit comments

Comments
 (0)