mrbuddycasino / esp32_mp3_decoder Goto Github PK
View Code? Open in Web Editor NEWA internet radio and bluetooth speaker project for the Espressif ESP32
A internet radio and bluetooth speaker project for the Espressif ESP32
is it not possible to use both?
switch bluetooth on/off with an gpio toogle or web command?
Some mp3 file will make the decoder crash.
I (6822) http_client: requesting GET /cg.mp3 HTTP/1.0
Host: 192.168.1.9
I (6822) http_client: ... socket send success
I (6922) audio_player: Buffer fill 50%, 16066 bytes
I (6982) audio_player: RAM left 175916
I (6982) audio_player: created decoder task: mp3_decoder_task
MAD: Decoder start.
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0102 (reserved header layer value)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
I (7002) audio_player: Buffer fill 70%, 22647 bytes
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0104 (reserved sample frequency value)
dec err 0x0104 (reserved sample frequency value)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
E (7052) decoder: Buffer underflow, need 2881 bytes.
E (7062) decoder: Buffer underflow, need 2881 bytes.
E (7062) decoder: Buffer underflow, need 2881 bytes.
E (7072) decoder: Buffer underflow, need 2881 bytes.
E (7072) decoder: Buffer underflow, need 2881 bytes.
E (7082) decoder: Buffer underflow, need 2881 bytes.
E (7082) decoder: Buffer underflow, need 2881 bytes.
E (7092) decoder: Buffer underflow, need 2881 bytes.
E (7102) decoder: Buffer underflow, need 2881 bytes.
E (7102) decoder: Buffer underflow, need 2881 bytes.
E (7112) decoder: Buffer underflow, need 2881 bytes.
E (7112) decoder: Buffer underflow, need 2881 bytes.
E (7122) decoder: Buffer underflow, need 2881 bytes.
E (7122) decoder: Buffer underflow, need 2881 bytes.
E (7132) decoder: Buffer underflow, need 2881 bytes.
E (7142) decoder: Buffer underflow, need 2881 bytes.
E (7142) decoder: Buffer underflow, need 2881 bytes.
E (7152) decoder: Buffer underflow, need 2881 bytes.
E (7152) decoder: Buffer underflow, need 2881 bytes.
E (7162) decoder: Buffer underflow, need 2881 bytes.
E (7162) decoder: Buffer underflow, need 2881 bytes.
E (7172) decoder: Buffer underflow, need 2881 bytes.
E (7182) decoder: Buffer underflow, need 2881 bytes.
E (7182) decoder: Buffer underflow, need 2881 bytes.
E (7192) decoder: Buffer underflow, need 2881 bytes.
E (7192) decoder: Buffer underflow, need 2881 bytes.
E (7202) decoder: Buffer underflow, need 2881 bytes.
E (7202) decoder: Buffer underflow, need 2881 bytes.
E (7212) decoder: Buffer underflow, need 2881 bytes.
E (7212) decoder: Buffer underflow, need 2881 bytes.
E (7222) decoder: Buffer underflow, need 2881 bytes.
E (7232) decoder: Buffer underflow, need 2881 bytes.
E (7232) decoder: Buffer underflow, need 2881 bytes.
E (7242) decoder: Buffer underflow, need 2881 bytes.
E (7242) decoder: Buffer underflow, need 2881 bytes.
E (7252) decoder: Buffer underflow, need 2881 bytes.
E (7252) decoder: Buffer underflow, need 2881 bytes.
E (7262) decoder: Buffer underflow, need 2881 bytes.
E (7272) decoder: Buffer underflow, need 2881 bytes.
E (7272) decoder: Buffer underflow, need 2881 bytes.
E (7282) decoder: Buffer underflow, need 2881 bytes.
E (7282) decoder: Buffer underflow, need 2881 bytes.
E (7292) decoder: Buffer underflow, need 2881 bytes.
E (7292) decoder: Buffer underflow, need 2881 bytes.
E (7302) decoder: Buffer underflow, need 2881 bytes.
E (7302) decoder: Buffer underflow, need 2881 bytes.
E (7312) decoder: Buffer underflow, need 2881 bytes.
E (7322) decoder: Buffer underflow, need 2881 bytes.
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0104 (reserved sample frequency value)
dec err 0x0101 (lost synchronization)
dec err 0x0201 (CRC check failed)
dec err 0x0101 (lost synchronization)
dec err 0x0101 (lost synchronization)
dec err 0x0102 (reserved header layer value)
dec err 0x0101 (lost synchronization)
Guru Meditation Error of type InstrFetchProhibited occurred on core 1. Exception was unhandled.
Register dump:
PC : 0x00000000 PS : 0x00060030 A0 : 0x8011e147 A1 : 0x3ffd7490
A2 : 0x3ffd7554 A3 : 0x3ffc35d8 A4 : 0x3ffda9a4 A5 : 0x0000007f
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x8015cea4 A9 : 0x3f43d9a8
A10 : 0x3ffc35d8 A11 : 0x3ffd7554 A12 : 0x00000050 A13 : 0x00000000
A14 : 0x00000000 A15 : 0x0000045a SAR : 0x00000018 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
Backtrace: 0x00000000:0x3ffd7490 0x4011e147:0x3ffd74c0
Rebooting...
ets Jun 8 2016 00:22:57
…
Hi,
I want to read the mp3 file from sd card, decode it and output throuhg built-in DAC, but it occured an error(MAD_ERROR_LOSTSYNC ).
following is my code that calling funcion:
static void play_mp3_file(void *vparameter)
{
web_radio_t *radio_conf = vparameter;
char mp3_data[1024];//[4096];
player_t *player_config = radio_conf->player_config;
int ret;
int i;
ESP_LOGI(TAG,"play_mp3_file task\r\n");
FILE* f = fopen("/sdcard/ghsy.mp3","r");
if (f == NULL) {
ESP_LOGI(TAG,"Failed to open file for reading.\r\n");
vTaskDelete(NULL);
}
player_config->media_stream->content_type = AUDIO_MPEG;
player_config->media_stream->eof = false;
player_config->command = CMD_START;
player_config->buffer_pref = BUF_PREF_FAST;//BUF_PREF_SAFE;//
audio_player_start(player_config);
while(1)
{
ret=fread(mp3_data,1,sizeof(mp3_data),f);
if(ret <= 0)
{
ESP_LOGI(TAG,"play mp3 read file error.\r\n");
break;
}
ESP_LOGI(TAG,"play_mp3_file read data succ\r\n");
while( audio_stream_consumer(mp3_data, sizeof(mp3_data), player_config) != 0)
{
vTaskDelay(500/ portTICK_PERIOD_MS);
ESP_LOGI(TAG,"play_mp3_file vTaskDelay ing\r\n");
}
vTaskDelay(3000/ portTICK_PERIOD_MS);
}
fclose(f);
printf("delete play_mp3_file_task.\r\n");
vTaskDelete(NULL);
}
void web_radio_start(web_radio_t *config)
{
// start reader task
//xTaskCreatePinnedToCore(&http_get_task, "http_get_task", 2560, config, 20,
//NULL, 0);
ESP_LOGI(TAG,"web_radio_start\r\n");
xTaskCreate(&play_mp3_file, "play_mp3_file", 4096+4096, config, 5, NULL);
}
and the debug log is:
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5648
ho 0 tail 12 room 4
load:0x40078000,len:0
load:0x40078000,len:13912
entry 0x40078fd8
�[0;32mI (30) boot: ESP-IDF v3.1-dev-463-g77eae33 2nd stage bootloader�[0m
�[0;32mI (30) boot: compile time 16:47:34�[0m
�[0;32mI (30) boot: Enabling RNG early entropy source...�[0m
�[0;32mI (36) boot: SPI Speed : 40MHz�[0m
�[0;32mI (40) boot: SPI Mode : DIO�[0m
�[0;32mI (44) boot: SPI Flash Size : 4MB�[0m
�[0;32mI (48) boot: Partition Table:�[0m
�[0;32mI (52) boot: ## Label Usage Type ST Offset Length�[0m
�[0;32mI (59) boot: 0 nvs WiFi data 01 02 00009000 00006000�[0m
�[0;32mI (67) boot: 1 phy_init RF data 01 01 0000f000 00001000�[0m
�[0;32mI (74) boot: 2 factory factory app 00 00 00010000 00200000�[0m
�[0;32mI (82) boot: End of partition table�[0m
�[0;32mI (86) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x48468 (296040) map�[0m
�[0;32mI (197) esp_image: segment 1: paddr=0x00058490 vaddr=0x3ffb0000 size=0x041a0 ( 16800) load�[0m
�[0;32mI (204) esp_image: segment 2: paddr=0x0005c638 vaddr=0x40080000 size=0x00400 ( 1024) load�[0m
�[0;32mI (205) esp_image: segment 3: paddr=0x0005ca40 vaddr=0x40080400 size=0x035d0 ( 13776) load�[0m
�[0;32mI (219) esp_image: segment 4: paddr=0x00060018 vaddr=0x400d0018 size=0x67cb8 (425144) map�[0m
�[0;32mI (369) esp_image: segment 5: paddr=0x000c7cd8 vaddr=0x400839d0 size=0x07e94 ( 32404) load�[0m
�[0;32mI (383) esp_image: segment 6: paddr=0x000cfb74 vaddr=0x400c0000 size=0x00000 ( 0) load�[0m
�[0;32mI (391) boot: Loaded app from partition at offset 0x10000�[0m
�[0;32mI (391) boot: Disabling RNG early entropy source...�[0m
�[0;32mI (393) cpu_start: Pro cpu up.�[0m
�[0;32mI (396) cpu_start: Starting app cpu, entry point is 0x400812a8�[0m
�[0;32mI (0) cpu_start: App cpu up.�[0m
�[0;32mI (407) heap_init: Initializing. RAM available for dynamic allocation:�[0m
�[0;32mI (413) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM�[0m
�[0;32mI (419) heap_init: At 3FFBE3A8 len 00021C58 (135 KiB): DRAM�[0m
�[0;32mI (426) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM�[0m
�[0;32mI (432) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM�[0m
�[0;32mI (438) heap_init: At 4008B864 len 0001479C (81 KiB): IRAM�[0m
�[0;32mI (445) cpu_start: Pro cpu start user code�[0m
�[0;32mI (127) cpu_start: Starting scheduler on PRO CPU.�[0m
�[0;32mI (0) cpu_start: Starting scheduler on APP CPU.�[0m
�[0;32mI (129) main: starting app_main()�[0m
�[0;32mI (129) main: RAM left: 253568�[0m
�[0;32mI (159) main: hardware initialized�[0m
�[0;32mI (159) main: Initializing SD card�[0m
�[0;32mI (159) main: Using SPI peripheral�[0m
�[0;32mI (169) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
Name: SD16G
Type: SDHC/SDXC
Speed: default speed
Size: 14832MB
CSD: ver=1, sector_size=512, capacity=30375936 read_bl_len=9
SCR: sd_spec=2, bus_width=5
�[0;32mI (289) playlist: Tracks:�[0m
SomaFM / Illinois Street Lounge - http://ice1.somafm.com/illstreet-128-mp3
SomaFM / Secret Agent - http://ice1.somafm.com/secretagent-128-mp3
SomaFM / Left Coast 70s - http://ice1.somafm.com/seventies-128-mp3
SomaFM / Boot Liquor - http://ice1.somafm.com/bootliquor-128-mp3
�[0;32mI (309) renderer: init I2S mode 2, port 0, 16 bit, 44100 Hz�[0m
�[0;32mI (319) I2S: queue free spaces: 1�[0m
�[0;32mI (319) I2S: DMA Malloc info, datalen=blocksize=256, dma_buf_count=32�[0m
�[0;32mI (329) I2S: PLL_D2: Req RATE: 44100, real rate: 2777.000, BITS: 16, CLKM: 30, BCK: 60, MCLK: 30.234, SCLK: 88864.000000, diva: 64, divb: 14�[0m
�[0;32mI (339) web_radio: web_radio_start
�[0m
�[0;32mI (349) main: RAM left 205480�[0m
�[0;32mI (349) web_radio: play_mp3_file task
�[0m
�[0;32mI (359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (3359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (6359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (9359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (12359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (15359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (18359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (21359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (24359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (27359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (30359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (33359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (36359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (39359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (42359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (45359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (48359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (51359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (54359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (57359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (60359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (63359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (66359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (69359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (72359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (75359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (78359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (81359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (84359) web_radio: play_mp3_file read data succ
�[0m
�[0;32mI (84359) audio_player: RAM left 209848�[0m
�[0;32mI (84359) audio_player: created decoder task: mp3_decoder_task�[0m
�[0;32mI (84359) mad_decoder: decoder start�[0m
�[0;31mE (84369) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84369) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84379) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84389) mad_decoder: dec err 0x0102 (reserved header layer value)�[0m
�[0;31mE (84389) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84399) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84409) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84409) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84419) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84429) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84429) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84439) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84439) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84449) mad_decoder: dec err 0x0101 (lost synchronization)�[0m
�[0;31mE (84459) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84459) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84469) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84469) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84479) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84489) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84489) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84499) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84499) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84509) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84519) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84519) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84529) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84539) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84539) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84549) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84549) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84559) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84569) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84569) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84579) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84579) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84589) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84599) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84599) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84609) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84609) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84619) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84629) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84629) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84639) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84639) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84649) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84659) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84659) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84669) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84679) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84679) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84689) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84689) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84699) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84709) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84709) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84719) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84719) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84729) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84739) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84739) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84749) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84749) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84759) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84769) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84769) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84779) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84779) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84789) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84799) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84799) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84809) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84809) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84819) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84829) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84829) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84839) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84849) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84849) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84859) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84859) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
�[0;31mE (84869) mad_decoder: Buffer underflow, need 2881 bytes.�[0m
Is there any hint or solution for solving this problem?
thank you in advance.
Maybe this is just me being stupid, but where does ini.h come from?
Compiling the latest checkout in master gives me:
ESP32_MP3_Decoder/components/playlist/./playlist.c:19:17: fatal error: ini.h: No such file or directory
Any suggestion is much appreciated!
Maybe this is just me being stupid, but where does ini.h come from?
When I try to build I got this error:
ESP32_MP3_Decoder/components/playlist/./playlist.c:19:17: fatal error: ini.h: No such file or directory
And I have tried: "git submodule init && git submodule update", in the esp-idf directory
Any suggestion is much appreciated! Thanks in advance.
is there any way to use this with the arduino ide?
Hi Michael,
I am in the translation of the following error.
D:/path/to/ESP32_MP3/esp-idf-template/components/playlist/playlist.c: In function 'playlist_load_pls':
D:/path/to/ESP32_MP3/esp-idf-template/components/playlist/playlist.c:146:15: error: implicit declaration of function 'ini_parse_stream' [-Werror=implicit-function-declaration]
int res = ini_parse_stream(pls_ini_reader, &file_start_ptr, pls_ini_handler, playlist->entries_vec);
Is it because I am missing a library?
Thank you!
`MONITOR
--- WARNING: Serial ports accessed as /dev/tty.* will hang gdb if launched.
--- Using /dev/cu.SLAB_USBtoUART instead...
--- idf_monitor on /dev/cu.SLAB_USBtoUART 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:5084
load:0x40078000,len:0
load:0x40078000,len:12652
entry 0x40078f44
I (45) boot: ESP-IDF v3.0-dev-174-g143cdf6a-dirty 2nd stage bootloader
I (45) boot: compile time 10:54:45
I (48) boot: Enabling RNG early entropy source...
I (64) boot: SPI Speed : 40MHz
I (77) boot: SPI Mode : DIO
I (89) boot: SPI Flash Size : 4MB
I (102) boot: Partition Table:
I (113) boot: ## Label Usage Type ST Offset Length
I (136) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (159) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (182) boot: 2 factory factory app 00 00 00010000 00100000
I (206) boot: End of partition table
I (219) boot: Disabling RNG early entropy source...
I (236) boot: Loading app partition at offset 00010000
I (254) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x4d2d4 (316116) map
I (618) esp_image: segment 1: paddr=0x0005d2fc vaddr=0x3ffb0000 size=0x02d14 ( 11540) load
I (633) esp_image: segment 2: paddr=0x00060018 vaddr=0x400d0018 size=0x9a55c (632156) map
0x400d0018: _stext at ??:?
I (1312) esp_image: segment 3: paddr=0x000fa57c vaddr=0x3ffb2d14 size=0x020e4 ( 8420) load
I (1323) esp_image: segment 4: paddr=0x000fc668 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _iram_start at ??:?
I (1335) esp_image: segment 5: paddr=0x000fca70 vaddr=0x40080400 size=0x13f5c ( 81756) load
I (1465) esp_image: segment 6: paddr=0x001109d4 vaddr=0x400c0000 size=0x00000 ( 0) load
E (1466) esp_image: Image length 1051136 doesn't fit in partition length 1048576
E (1483) boot: Failed to verify app image @ 0x10000 (8194)
user code done`
I update the latest version and find that there is something wrong.It shows that image overflows.
ESP32_MP3_Decoder can play mp3 and acc files on my ESP32.
I want to run ESP32_MP3_Decoder in mongoose-os for ESP32.
I do some code migration, Codes can be copmlied and linked with no errors.
Mp3/MAD part works well.
But AAC/fdk-aac part always reports E (5264) fdkaac_decoder: malloc failed 90
when running.
In the code
/* create decoder instance */
handle = aacDecoder_Open(TT_MP4_ADTS, /* num layers */1);
if (handle == NULL) {
ESP_LOGE(TAG, "malloc failed %d", __LINE__);
goto cleanup;
}
aacDecoder_Open always return NULL.
In file accdecoder.cpp
LINKSPEC_CPP HANDLE_AACDECODER CAacDecoder_Open(TRANSPORT_TYPE bsFormat) /*!< bitstream format (adif,adts,loas,...). */
{
HANDLE_AACDECODER self;
self = GetAacDecoder();
if (self == NULL) {
ESP_LOGE(TAG, "GetAacDecoder failed");
goto bail;
}
.....
}
self = GetAacDecoder() is always NULL.
Can you give me some help?
Note: not an actual issue.
It would be nice to have a wiki showing up various compatible hardwares and project derived from your code.
Right now I am building a breakout for the TAS5733L because the MAX chip is very limited. Will it work with this code? I have no idea. Theoretically it should, but having a clear wiki that says "YES" would be a great resource.
Cheers,
Tony
Hi there,
Would very appreciate if you could render some help there. I compiled the code successfully, however, when I tried to connect/pair it. It failed. Any idea why? Here are the message.
I (241) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (521) phy: phy_version: 366.0, ba9923d, Dec 29 2017, 14:25:06, 0, 0
I (591) renderer: init I2S mode 0, port 0, 16 bit, 44100 Hz
I (591) I2S: queue free spaces: 1
I (601) I2S: DMA Malloc info, datalen=blocksize=256, dma_buf_count=32
I (601) I2S: PLL_D2: Req RATE: 44100, real rate: 44642.000, BITS: 16, CLKM: 14, BCK: 8, MCLK: 11289966.924, SCLK: 1428544.000000, diva: 64, divb: 11
I (611) main: RAM left 119532
I (611) bt_speaker: starting "ESP32_BLE_SPEAKER"
E (11661) BT: btm_sec_conn_req
E (11671) BT: btm_sec_connected
Hello guys,
i just flashed my esp32 with this great Software, but I want to use it with Hifiberry Digi (WM 8804 SPDIF IC). The I2S transmission seems to work as far as I can See with my oscilloscope, but I don't get SPDIF Signals. The WM8804 board work quite good with my Raspberry Pi, but not with the ESP. Do you know if i need to configure something else? Please help me...
Very cool project!
I was able to build the project and flash it onto the sparkfun esp32 thing board. I can play an MP3 stream with the built in DAC, but I can't enable the bluetooth in the menuconfig. Any idea why the bluetooth is not an option?
in main/wifi.c on line 34, 38, 42, 46, 50 and 54 there seems to be missing the trailing ;
when I added them, the compile ran successful.
I am using this project as bluetooth speaker. After connect my phone to ESP32, when I am making a call, the player keep repeating same sound until I stop calling.
The solution is call renderer_stop
on a2dp receiving status 0.
Right now there is another problem. When renderer_start
called, there's some noise before playing the audio. I am looking for a way to deal with that.
Hi BuddyCasino,
I was wondering you could point-out where would be the right place to start for displaying playing song when in Bluetooth Speaker mode.
Thank you
Constantly getting buffer underflow.... Im using ESP Wroom 32 module. Do i need Wrover with PSram to run this app?
(164423) mad_decoder: Buffer underflow, need 2471 bytes
Hi MrBuddyCasino,
Would it be possible to read broadcasted mp3 data from UDP port?
I have 80 devices with ESP32 modules in single wifi network, I would like to setup a Linux server that will stream 16 channels to broadcast address on different port and I would like ESP modules to connect to one of 16 channels. The idea is to have lower wifi usage (16 UDP streams) instead of 80 TCP/IP simultaneous connections.
Best Regards
Marek
It would be nice if it was possible to use ESP32 as bluetooth/wifi speaker. So i can stream audio to it not only using bt, but also over wifi. From my Linux box, using pulseaudio.
The setting options for bluetooth are missing.
Experiencing the error and used the command grep -rnw '.' -e 'mdns_server_t' to find the definition but not found. Very strange! Any advice? please
I have an error like below when I start aac decoder.
I (47596) audio_player: created decoder task: fdkaac_decoder_task
E (47596) fdkaac_decoder: malloc failed 88
I (47606) fdkaac_decoder: aac decoder finished
Hello,
Can you give any hints on what circuit I need to amplify the PDM output?
Thanks!
hi
Can i use this library to play MP3 file from SD card?
is possible ?
my sdcard already connected to ESP32.
WebRadio doesn't play in DAC and PDM modes when apll_use=1 (in PDM mode it is very slow, in DAC mode - some cracks). When set apll_use=0 radio works. Nothing changed except apll_use.
Output from I2S PDM APLL=1 (desn't work):
I (3756) renderer: init I2S mode 3, port 0, 16 bit, 44100 Hz
I (3756) renderer: chip revision 1, enabling APLL
...
I (3776) I2S: APLL: Req RATE: 44100, real rate: 44099.020, BITS: 16, CLKM: 1, BC K: 8, MCLK: 5.669, SCLK: 1411168.625000, diva: 1, divb: 0
Output from I2S PDM APLL=0 (sound a little bit slower than needed which leads to server stops the connection after some time):
I (3296) I2S: PLL_D2: Req RATE: 44100, real rate: 200000.000, BITS: 16, CLKM: 5, BCK: 5, MCLK: 5.669, SCLK: 6400000.000000, diva: 64, divb: 42
Output from I2S DAC APLL=1 (not work):
I2S: APLL: Req RATE: 44100, real rate: 44099.020, BITS: 16, CLKM: 1, BCK: 8, MCLK: 30.234, SCLK: 1411168.625000, diva: 1, divb: 0
Output from I2S DAC APLL=0 (radio works for a long time, sound is not clear):
I (4286) I2S: PLL_D2: Req RATE: 44100, real rate: 2777.000, BITS: 16, CLKM: 30, BCK: 60, MCLK: 30.234, SCLK: 88864.000000, diva: 64, divb: 14
Per https://cast.readme.io/v1.0/docs/icy if header contains Icy-MetaData: 1
server can send back some metadata which typically includes song title.
After adding Icy-MetaData: 1 to headers ESP32 player plays ok and then goes mad and starts to blame with decoder errors:
Buffer underflow
lost synchronization
Metadata feature could be great to show played track title on oled display.
Stream with metadata: http://live.pieci.lv/live19-hq.mp3
I think it is better to add some lines like these:
void audio_player_start()
{
renderer_start();
//added--------------
player_instance->media_stream->eof = false;
//----------------------
player_instance->command = CMD_START;
player_status = RUNNING;
}
void audio_player_stop()
{
renderer_stop();
player_instance->command = CMD_STOP;
//added---------------
player_instance->media_stream->eof = true;
//------------------------------------
player_status = STOPPED;
}
Otherwise the decoder is not halted if media_stream->eof is not set .
I don't use web_radio.c. (that's why;-)
minicom shows the audio data in transit, but there is no volume. My din gain pin is not connected, and my module is max98357A
minicom:
E (94116) BT: BTA_AV_START_EVT status 0, suspending 0, init 0
I (94116) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x1
I (94126) BT_AV: a2dp audio_state_cb state 2
E (96146) BT_AV: audio data pkt cnt 100
E (98146) BT_AV: audio data pkt cnt 200
E (100146) BT_AV: audio data pkt cnt 300
E (102156) BT_AV: audio data pkt cnt 400
E (104166) BT_AV: audio data pkt cnt 500
E (106166) BT_AV: audio data pkt cnt 600
E (108166) BT_AV: audio data pkt cnt 700
Thanks for making this available!
When testing, I had to make the following changes:
In aacdecoder.cpp in fdk-aac lib,
CAacDecoder_Open() call GetAacDecoder() function.
GetAacDecoder() is not declared and defined, but can execute well.
Where is GetAacDecoder() declared and defined?
Running without the I2S codec can be activated by uncommenting "#define USE_DAC", but this does not currently work.
If anyone has experience using I2S_MODE_DAC_BUILT_IN, please have a look!
So I've been playing with the code mostly using web radio. Today I wanted to try the bluetooth speaker. I downloaded a fresh copy of the code and got this message:
ESP32_MP3_Decoder_clean/components/bt_speaker/bt_speaker.c:93:9: error: implicit declaration of function 'esp_a2d_sink_register_data_callback' [-Werror=implicit-function-declaration]
esp_a2d_sink_register_data_callback(bt_app_a2d_data_cb);
^
cc1.exe: some warnings being treated as errors
make[1]: *** [/home/tony/esp/esp-idf-v3.0/make/component_wrapper.mk:274: bt_speaker.o] Error 1
make: *** [C:/msys32/home/tony/esp/esp-idf-v3.0/make/project.mk:450: component-bt_speaker-build] Error 2
Seems like you can't compile the code anymore with just "make" you have to change the default esp-idf config (under make/project.mk) and set the following gcc flag:
-Wno-error=implicit-function-declaration
And this is a pretty scary flag to include!
When pressing the IO0 in the mode of the web radio,the chip will reboot.
` (6564) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:1
I (6574) main: RAM left 78588
I (6584) http_client: DNS lookup succeeded. IP=113.107.191.21
I (6584) http_client: ... allocated socket
I (9234) http_client: ... connected
I (9234) http_client: requesting GET /resource/n1/2009/12/31/655859227.mp3 HTTP/1.0
Host: win.web.ra01.sycdn.kuwo.cn
I (9244) http_client: ... socket send success
I (9354) audio_player: Buffer fill 33%, 15851 bytes
I (9444) audio_player: Buffer fill 65%, 31508 bytes
I (9494) audio_player: RAM left 80764
I (9494) audio_player: created decoder task: mp3_decoder_task
I (9494) mad_decoder: decoder start
I (9514) audio_player: Buffer fill 92%, 44270 bytes
I (10254) audio_player: Buffer fill 99%, 47764 bytes
I (11344) audio_player: Buffer fill 96%, 46337 bytes
I (12284) audio_player: Buffer fill 98%, 47416 bytes
I (13384) audio_player: Buffer fill 95%, 45948 bytes
I (14324) audio_player: Buffer fill 97%, 47029 bytes
I (15264) wifi: pm start, type:0
I (15414) audio_player: Buffer fill 94%, 45543 bytes
I (16364) audio_player: Buffer fill 97%, 46624 bytes
I (17304) audio_player: Buffer fill 99%, 47661 bytes
I (18394) audio_player: Buffer fill 96%, 46234 bytes
I (19344) audio_player: Buffer fill 98%, 47259 bytes
I (20434) audio_player: Buffer fill 95%, 45833 bytes
I (21374) audio_player: Buffer fill 97%, 46800 bytes
I (22324) audio_player: Buffer fill 99%, 47882 bytes
I (22814) web_radio: GPIO[0] intr, val: 1
I (22814) web_radio: RAM left 52092
W (22814) web_radio: next track: SomaFM / Secret Agent
I (22834) mad_decoder: decoder stopped
Untested FreeRTOS function uxTaskGetStackHighWaterMark
/Users/sky/esp/esp-idf/components/freertos/./tasks.c:3752 (uxTaskGetStackHighWaterMark)- assert failed!
abort() was called at PC 0x400853d2 on core 1
0x400853d2: uxTaskGetStackHighWaterMark at /Users/sky/esp/esp-idf/components/freertos/./tasks.c:3442
Backtrace: 0x40087688:0x3ffeed20 0x40087787:0x3ffeed40 0x400853d2:0x3ffeed60 0x4011e886:0x3ffeed80
0x40087688: invoke_abort at /Users/sky/esp/esp-idf/components/esp32/./panic.c:519
0x40087787: abort at /Users/sky/esp/esp-idf/components/esp32/./panic.c:519
0x400853d2: uxTaskGetStackHighWaterMark at /Users/sky/esp/esp-idf/components/freertos/./tasks.c:3442
0x4011e886: mp3_decoder_task at /Users/sky/esp/esp_demo/ESP32_MP3_Decoder/components/mp3_decoder/./mp3_decoder.c:181
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:4404
load:0x40078000,len:11080
load:0x40080000,len:252
0x40080000: _iram_start at ??:?
entry 0x40080034
0x40080034: _iram_start at ??:?
I (47) boot: ESP-IDF v2.0-rc1-1089-g3bd3640d-dirty 2nd stage bootloader
I (48) boot: compile time 17:23:18
I (60) boot: Enabling RNG early entropy source...
I (110) boot: SPI Speed : 40MHz
I (149) boot: SPI Mode : DIO
I (187) boot: SPI Flash Size : 4MB
I (225) boot: Partition Table:
I (259) boot: ## Label Usage Type ST Offset Length
I (327) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (397) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (466) boot: 2 factory factory app 00 00 00010000 00100000
I (536) boot: End of partition table
I (575) boot: Disabling RNG early entropy source...
I (627) boot: Loading app partition at offset 00010000
I (3130) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (3131) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x49b08 (301832) map
I (3181) boot: segment 2: paddr=0x00069b18 vaddr=0x3ffc0000 size=0x04ad4 ( 19156) load
I (3283) boot: segment 3: paddr=0x0006e5f4 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _iram_start at ??:?
I (3341) boot: segment 4: paddr=0x0006e9fc vaddr=0x40080400 size=0x13bc0 ( 80832) load
I (3518) boot: segment 5: paddr=0x000825c4 vaddr=0x400c0000 size=0x00000 ( 0) load
I (3519) boot: segment 6: paddr=0x000825cc vaddr=0x00000000 size=0x0da3c ( 55868)
I (3575) boot: segment 7: paddr=0x00090010 vaddr=0x400d0018 size=0x976fc (620284) map
0x400d0018: _stext at ??:?
I (3654) cpu_start: Pro cpu up.
I (3688) cpu_start: Starting app cpu, entry point is 0x40080f08
0x40080f08: call_start_cpu1 at /Users/sky/esp/esp-idf/components/esp32/./cpu_start.c:186
I (3749) cpu_start: App cpu up.
I (3787) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (3856) heap_alloc_caps: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (3918) heap_alloc_caps: At 3FFD73D0 len 00008C30 (35 KiB): DRAM
I (3981) heap_alloc_caps: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (4045) heap_alloc_caps: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (4110) heap_alloc_caps: At 40093FC0 len 0000C040 (48 KiB): IRAM
I (4172) cpu_start: Pro cpu start user code
I (4332) cpu_start: Starting scheduler on PRO CPU.
I (4334) cpu_start: Starting scheduler on APP CPU.
I (4334) main: starting app_main()
I (4334) main: RAM left: 148020
I (4354) main: hardware initialized
I (4354) main: starting network
I (4364) wifi: wifi firmware version: bf86460
I (4364) wifi: config NVS flash: enabled
I (4364) wifi: config nano formating: disabled
I (4364) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (4374) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (4404) wifi: Init dynamic tx buffer num: 32
I (4404) wifi: Init dynamic rx buffer num: 32
I (4404) wifi: wifi driver task: 3ffdfb08, prio:23, stack:4096
I (4404) wifi: Init static rx buffer num: 10
I (4404) wifi: Init dynamic rx buffer num: 32
I (4414) wifi: Init rx ampdu len mblock:7
I (4414) wifi: Init lldesc rx ampdu entry mblock:4
I (4424) wifi: wifi power manager task: 0x3ffe56c4 prio: 21 stack: 2560
I (4424) wifi: wifi timer task: 3ffe672c, prio:22, stack:3584
I (4454) phy: phy_version: 355.1, 59464c5, Jun 14 2017, 20:25:06, 0, 0
I (4454) wifi: mode : sta (24:0a:c4:05:94:88)
I (4454) wifi: received wifi event 2
I (4464) wifi: connected successfully
I (4584) wifi: n:6 2, o:1 0, ap:255 255, sta:6 2, prof:1
I (5234) wifi: state: init -> auth (b0)
I (5244) wifi: state: auth -> assoc (0)
I (5264) wifi: state: assoc -> run (10)
I (5374) wifi: connected with TP-LINK_42AD, channel 6
I (5384) wifi: received wifi event 4
`
Sir, hello. Because my pin is not a lot, my GPIO 22 used other functions, so DATA can not be connected. I really wanted to implement Bluetooth music, but I did not find a way to change the pin's code. I hope to get your help, thank you very much. Wish you a Happy New Year!
Hi Michael:
i encounter a link error when i use your web audio decoder demo with esp32, the error report is as blow, and i am puzzle, dont know why, can you give me some hints? appreciate for you help.
LD mp3_decoder.elf
/home/zilong/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio/build/http/libhttp.a(http.o):(.literal.http_client_get+0x48): undefined reference to **http_parser_init**' /home/zilong/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio/build/http/libhttp.a(http.o):(.literal.http_client_get+0x4c): undefined reference to
http_parser_execute'
/home/zilong/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio/build/http/libhttp.a(http.o): In function http_client_get': /home/zilong/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio/components/http/./http.c:93: undefined reference to
http_parser_init'
/home/zilong/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio/components/http/./http.c:105: undefined reference to http_parser_execute' /home/zilong/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio/build/url_parser/liburl_parser.a(url_parser.o):(.literal.url_create+0x10): undefined reference to
http_parser_parse_url'
/home/zilong/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio/build/url_parser/liburl_parser.a(url_parser.o): In function url_create': /home/zilong/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio/components/url_parser/./url_parser.c:113: undefined reference to
http_parser_parse_url'
collect2: error: ld returned 1 exit status
make: *** [/home/zilong/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio/build/mp3_decoder.elf] 错误 1
zilong@PCZiLong:~/WorkSpace/IOT/esp32/esp32audio/esp32-projects/web_radio$
Sir I can not run your demo
ERROR:/ESP32_MP3_Decoder/components/playlist/./playlist.c:19:17: fatal error: ini.h: No such file or directory
And I want decode MP3 file in SD card but the stack overflow ,I'd appreciate for your help
Here is part of my code :
static enum mad_flow input(void *data, struct mad_stream *stream)
{
printf("input data \n");
mp3_file *mp3fp;
int ret_code;
int unproc_data_size; /the unprocessed data's size/
int copy_size;
mp3fp = (mp3_file *)data;
if(mp3fp->fpos < mp3fp->flen){
unproc_data_size = stream->bufend - stream->next_frame;
memcpy(mp3fp->fbuf, mp3fp->fbuf + mp3fp->fbsize - unproc_data_size, unproc_data_size);
copy_size = BUFSIZE - unproc_data_size;
if(mp3fp->fpos + copy_size > mp3fp->flen){
copy_size = mp3fp->flen - mp3fp->fpos;
}
printf("copy_size=%d \n",copy_size);
fread(mp3fp->fbuf+unproc_data_size, 1, copy_size, mp3fp->fp);
mp3fp->fbsize = unproc_data_size + copy_size;
mp3fp->fpos += copy_size;
mad_stream_buffer(stream, mp3fp->fbuf, mp3fp->fbsize);
ret_code = MAD_FLOW_CONTINUE;
}else{
ret_code = MAD_FLOW_STOP;
}
return (mad_flow)ret_code;
}
static int decode(mp3_file mp3fp)
{
struct mad_decoder decoder;
int result;
/ configure input, output, and error functions /
mad_decoder_init(&decoder, mp3fp,
input, 0 / header /, 0 / filter /, output,
error, 0 / message */);
/* start decoding */
result = mad_decoder_run(&decoder, MAD_DECODER_MODE_SYNC);
/* release the decoder */
mad_decoder_finish(&decoder);
return result;
}
I want to use this with my esp8266. It has onboard wifi, but no bluetooth. I just want to stream music to a wired speaker. Is that possible?
not issue, nice project!
can be this code somehow "translated" to esp32?
Hi Michael,
I reviewed the history, and think it should work for Built-In DAC case, but when I tried to run the latest code with latest ESP-IDF, I failed.
It seems that it's the version of ESP-IDF that does not match with this code. To be more specific, it's the version of I2S driver of ESP-IDF that does not match. In the latest I2S driver, it does not support the 8 bit width per sample.
I don't know why and how, could you tell me which version of ESP-IDF you are using? Or could you have a check at the latest ESP-IDF?
The version of ESP-IDF I'm using is 07b61d5 (2017-04-28)
Thanks & Best Regards,
Tidy Jiang.
I have the code running on a ESP-WROOM-32 with a PCM5102A connected as follows:
ESP32 <-------> PCM5102A
GPIO 22 DIN
GPIO 25 LCK
GPIO 26 BCK
FLT, DMP, SCL, FMT on the PCM5102A are on GND
XMT to VCC or other positive voltage, see below.
XMT hooked up to VCC as well I tried with a 4k/1k voltage divder to roughly 2.7V as I've seen in this schematic
Also tried powering the entire audio module with eighter 3.3V or 5V and adding a capacitor for voltage stabilisation, but with no effect in the errorneuos behavior.
Problem is, that after streaming via bluetooth fine for roughly 30s-2min, the ESP32 is crashing:
Tasks currently running:
CPU 0: BtcMediaT
CPU 1: IDLE
ASSERT_ERR((EM_BT_RXDESC_OFFSET + ld_env.curr_rxdesc_index * REG_EM_BT_RXDESC_SIZE) == bt_et_currentrxdescptr_currentrxdescptr_getf()), in ld_acl.c at line 1900ets Jun 8 2016 00:22:57
Steaming has done from an iphone as well as from a mac with showing the same behaviour.
ld_acl.c
seems to be part of the espressif BT implementation, but I couldn't the code to get an idea whats going wrong. I am pretty clueless what might be the issue. Any suggestions?
I am aware, that this issue is obviously not in the ESP32_MP3_Decoder code but I hope that someone here has an idea in what direction to look.
Any help is much appreciated! :-D
See the entire serial log here:
⸮)�⸮⸮z�⸮!`��⸮⸮⸮
�T!⸮9(⸮⸮⸮⸮ʄ⸮1 ⸮ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5740
load:0x40078000,len:0
load:0x40078000,len:13760
entry 0x40079020
�[0;32mI (69) boot: Detected ESP32�[0m
�[0;32mI (32) boot: ESP-IDF v3.0-dev-1123-g0ee9d93 2nd stage bootloader�[0m
�[0;32mI (32) boot: compile time 16:39:17�[0m
�[0;32mI (32) boot: Enabling RNG early entropy source...�[0m
�[0;32mI (38) boot: SPI Speed : 40MHz�[0m
�[0;32mI (42) boot: SPI Mode : DIO�[0m
�[0;32mI (46) boot: SPI Flash Size : 4MB�[0m
�[0;32mI (50) boot: Partition Table:�[0m
�[0;32mI (54) boot: ## Label Usage Type ST Offset Length�[0m
�[0;32mI (61) boot: 0 nvs WiFi data 01 02 00009000 00006000�[0m
�[0;32mI (69) boot: 1 phy_init RF data 01 01 0000f000 00001000�[0m
�[0;32mI (76) boot: 2 factory factory app 00 00 00010000 00200000�[0m
�[0;32mI (84) boot: End of partition table�[0m
�[0;32mI (88) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x3e0cc (254156) map�[0m
�[0;32mI (185) esp_image: segment 1: paddr=0x0004e0f4 vaddr=0x3ffc0000 size=0x01f1c ( 7964) load�[0m
�[0;32mI (188) esp_image: segment 2: paddr=0x00050018 vaddr=0x400d0018 size=0x8eaf0 (584432) map�[0m
�[0;32mI (394) esp_image: segment 3: paddr=0x000deb10 vaddr=0x3ffc1f1c size=0x00b44 ( 2884) load�[0m
�[0;32mI (396) esp_image: segment 4: paddr=0x000df65c vaddr=0x40080000 size=0x00400 ( 1024) load�[0m
�[0;32mI (402) esp_image: segment 5: paddr=0x000dfa64 vaddr=0x40080400 size=0x13574 ( 79220) load�[0m
�[0;32mI (443) esp_image: segment 6: paddr=0x000f2fe0 vaddr=0x400c0000 size=0x00000 ( 0) load�[0m
�[0;32mI (454) boot: Loaded app from partition at offset 0x10000�[0m
�[0;32mI (454) boot: Disabling RNG early entropy source...�[0m
�[0;32mI (455) cpu_start: Pro cpu up.�[0m
�[0;32mI (458) cpu_start: Starting app cpu, entry point is 0x40080fac�[0m
�[0;32mI (0) cpu_start: App cpu up.�[0m
�[0;32mI (469) heap_init: Initializing. RAM available for dynamic allocation:�[0m
�[0;32mI (476) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM�[0m
�[0;32mI (482) heap_init: At 3FFCFFF8 len 00010008 (64 KiB): DRAM�[0m
�[0;32mI (488) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM�[0m
�[0;32mI (494) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM�[0m
�[0;32mI (501) heap_init: At 40093974 len 0000C68C (49 KiB): IRAM�[0m
�[0;32mI (507) cpu_start: Pro cpu start user code�[0m
�[0;32mI (189) cpu_start: Starting scheduler on PRO CPU.�[0m
�[0;32mI (0) cpu_start: Starting scheduler on APP CPU.�[0m
�[0;32mI (190) main: starting app_main()�[0m
�[0;32mI (190) main: RAM left: 173440�[0m
�[0;32mI (210) main: hardware initialized�[0m
�[0;32mI (210) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
�[0;32mI (510) phy: phy_version: 366.0, ba9923d, Oct 31 2017, 18:06:17, 0, 0�[0m
�[0;32mI (550) renderer: init I2S mode 0, port 0, 16 bit, 44100 Hz�[0m
�[0;32mI (550) I2S: queue free spaces: 1�[0m
�[0;32mI (550) I2S: DMA Malloc info, datalen=blocksize=256, dma_buf_count=32�[0m
�[0;32mI (560) I2S: PLL_D2: Req RATE: 44100, real rate: 44642.000, BITS: 16, CLKM: 14, BCK: 8, MCLK: 11289966.924, SCLK: 1428544.000000, diva: 64, divb: 11�[0m
�[0;32mI (570) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0�[0m
�[0;32mI (570) main: RAM left 131368�[0m
�[0;32mI (580) bt_speaker: starting "B00mB0X"�[0m
�[0;31mE (14220) BT: btm_sec_conn_req
�[0m
�[0;31mE (14240) BT: btm_sec_connected
�[0m
�[0;32mI (14500) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0�[0m
�[0;32mI (14500) BT_AV: a2dp conn_state_cb, state 1�[0m
�[0;32mI (14650) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x2�[0m
�[0;32mI (14650) BT_AV: a2dp audio_cfg_cb , codec type 0�[0m
�[0;32mI (14650) BT_AV: audio player configured�[0m
�[0;31mE (14710) BT: bta_dm_rm_cback:0, status:0�[0m
�[0;32mI (14720) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0�[0m
�[0;32mI (14720) BT_AV: a2dp conn_state_cb, state 2�[0m
�[0;31mE (14760) BT: process_service_search_attr_rsp
�[0m
�[0;31mE (14800) BT: bta_av_rc_opened allow incoming AVRCP connections:1�[0m
�[0;31mE (14800) BT: bta_av_rc_opened rcb[0] shdl:1 lidx:1/0�[0m
�[0;32mI (14800) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0�[0m
�[0;32mI (14810) BT_AV: avrc conn_state evt: state 1, feature 0x249, [d8:a2:5e:80:bc:58]�[0m
�[0;31mE (15080) BT: bta_av_proc_stream_evt: p_data is null�[0m
�[0;31mE (15080) BT: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x8202
�[0m
�[0;31mE (15080) BT: bta_dm_rm_cback:0, status:0�[0m
�[0;31mE (15090) BT: bta_dm_rm_cback:0, status:7�[0m
�[0;31mE (15100) BT: BTA_AV_START_EVT status 0, suspending 0, init 0
�[0m
�[0;32mI (15100) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x1�[0m
�[0;32mI (15110) BT_AV: a2dp audio_state_cb state 2�[0m
�[0;31mE (17800) BT_AV: audio data pkt cnt 100�[0m
�[0;31mE (20120) BT_AV: audio data pkt cnt 200�[0m
Task watchdog got triggered. The following tasks did not feed the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: BtcMediaT
CPU 1: IDLE
�[0;31mE (22440) BT_AV: audio data pkt cnt 300�[0m
�[0;31mE (24760) BT_AV: audio data pkt cnt 400�[0m
�[0;31mE (27090) BT_AV: audio data pkt cnt 500�[0m
Task watchdog got triggered. The following tasks did not feed the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: BtcMediaT
CPU 1: IDLE
ASSERT_ERR((EM_BT_RXDESC_OFFSET + ld_env.curr_rxdesc_index * REG_EM_BT_RXDESC_SIZE) == bt_et_currentrxdescptr_currentrxdescptr_getf()), in ld_acl.c at line 1900
I use the I2S mode, but only left channel works, right channel outputs nothing.
My DAC is es9018K2M chip.
Hi,
I am having some trouble in my windows 10 pc to compile this code .Whenever i am doing make , i am getting below result .Which i have no clue .How can i resolve it . Thank you in advance .
make[1]: *** No rule to make target 'C:/msys32/home/ravi_/esp/esp-idf/examples/get-started/ESP32_MP3_Decoder/components/MerusAudio/MerusAudio.c', needed by 'MerusAudio.o'. Stop.
make: *** [C:\msys32\home\ravi_\esp\esp-idf/make/project.mk:468: component-MerusAudio-build] Error 2
i was trying to play http://lr1mp1.latvijasradio.lv:8012 but it seems it requires "Icy-MetaData:1" header in GET. Stream plays ok in vlc and another players.
Codec: MPEG Audio layer 1/2 (mpga)
Sample rate: 44100 Hz
Bitrate: 128 kb/s
content type is not returned as audio/mpeg type so there must be another way to catch stream
Everything works as expected in master mode,
but if I try to set up Slave mode, in audio_render.c:
i2s_mode_t mode = I2S_MODE_SLAVE | I2S_MODE_TX;
Esp32 is correctly not generating clock but waiting for it and replying with data,
hovewer the generated data is full of noise even if it's correctly synchronized.
I've replicated this excellent project using an ESP32 Dev Board and Adafruit MAX98357A Breakout #3006 such that continuous music streamed from my Android phone to ESP_SPEAKER sounds fine.
My issue, however, is that short, intermittent sound clips from the phone are initially somewhat truncated e.g. "Welcome to Android" might be heard "come to Android." The same audio thru the phone's native speaker is not truncated.
So, judging wake up lag to be at fault, I might prime the Bluetooth audio path by sending brief silence before each sound clip. This seems kludgy though and I'm hoping for deeper understanding and perhaps a better solution. Any thoughts?
Thanks!
After getting it to work(note: cmd is not gnd...), I was playing around with it and I can't get it to play over bluetooth when the audio mode is set to pdm. It gives the error below:
I (2549) main: RAM left 134032
E (21349) BT: btm_sec_conn_req
E (21369) BT: btm_sec_connected
I (21879) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0
I (21879) BT_AV: a2dp conn_state_cb, state 1
I (22369) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x2
I (22369) BT_AV: a2dp audio_cfg_cb , codec type 0
I (22369) BT_AV: audio player configured
E (22899) BT: bta_dm_rm_cback:0, status:0
I (22899) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0
I (22899) BT_AV: a2dp conn_state_cb, state 2
E (23809) BT: process_service_search_attr_rsp
E (23959) BT: bta_av_rc_opened allow incoming AVRCP connections:1
E (23959) BT: bta_av_rc_opened rcb[0] shdl:1 lidx:1/0
I (23969) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0
I (23969) BT_AV: avrc conn_state evt: state 1, feature 0x259, [9c:2a:83:2c:d5:d6
]
E (29339) BT: bta_av_proc_stream_evt: p_data is null
E (29339) BT: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:
x8202
E (29339) BT: bta_dm_rm_cback:0, status:0
E (29339) BT: bta_dm_rm_cback:0, status:7
E (29349) BT: BTA_AV_START_EVT status 0, suspending 0, init 0
I (29349) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x1
I (29359) BT_AV: a2dp audio_state_cb state 2
E (31539) BT_AV: audio data pkt cnt 100
and just sounds like it repeats the same sample over and over.
It doesn't have this issue when streaming over wifi.
I can connect but when I start streaming the speaker just makes white noise as if I'm just playing a blank audio file. Tried on both android and iphone with same result.
I am using WROOM32 with an I2S speaker. I've had it working before but I'm on a different computer and won't be back to that one for a couple days.
Any idea what is going on?
I (548) bt_speaker: starting "ESP_SPEAKER"
E (15728) BT: btm_sec_conn_reqE (15808) BT: btm_sec_connected
E (18758) BT: for SMP over BR max_key_size: 0x10, local_i_key: 0x07, local_r_key: 0x07
E (19028) BT: bta_av_rc_create ACP handle exist for shdl:0
I (19028) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0
I (19028) BT_AV: a2dp conn_state_cb, state 1
E (21028) BT: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x0 bits:2 features:x824bI (22708) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x2
I (22718) BT_AV: a2dp audio_cfg_cb , codec type 0
I (22718) BT_AV: audio player configured
E (22738) BT: process_service_search_attr_rspE (27718) BT: bta_dm_rm_cback:0, status:0
I (27718) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0
I (27718) BT_AV: a2dp conn_state_cb, state 2
E (32338) BT: process_service_search_attr_rspE (32358) BT: bta_av_rc_opened allow incoming AVRCP connections:1
E (32358) BT: bta_av_rc_opened rcb[1] shdl:1 lidx:1/0
I (32368) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0
I (32368) BT_AV: avrc conn_state evt: state 1, feature 0x4b, [ac:cf:85:2a:7f:18]
E (35418) BT: bta_av_proc_stream_evt: p_data is null
E (35418) BT: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824bE (35428) BT: bta_dm_rm_cback:0, status:0
E (35428) BT: bta_dm_rm_cback:0, status:7
E (35438) BT: BTA_AV_START_EVT status 0, suspending 0, init 0I (35438) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x1
I (35448) BT_AV: a2dp audio_state_cb state 2
E (37788) BT_AV: audio data pkt cnt 100
E (39788) BT_AV: audio data pkt cnt 200
E (41788) BT_AV: audio data pkt cnt 300
E (43788) BT_AV: audio data pkt cnt 400
E (45788) BT_AV: audio data pkt cnt 500
E (47788) BT_AV: audio data pkt cnt 600
E (49788) BT_AV: audio data pkt cnt 700
E (51788) BT_AV: audio data pkt cnt 800
E (53788) BT_AV: audio data pkt cnt 900
E (55588) BT: bta_av_proc_stream_evt: p_data is null
E (55588) BT: bta_dm_rm_cback:0, status:6
E (55588) BT: BTA_AV_SUSPEND_EVT status 0, init 0I (55588) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x1
I (55598) BT_AV: a2dp audio_state_cb state 0
Most notably deprecated functions:
Deprecated functions:
C:/msys32/home/tony/esp/ESP32_MP3_Decoder/components/audio_renderer/audio_renderer.c:133:13: warning: 'i2s_write_bytes' is deprecated [-Wdeprecated-declarations]
bytes_written = i2s_write_bytes(renderer_instance->i2s_num, buf, bytes_left, 0);
C:/msys32/home/tony/esp/ESP32_MP3_Decoder/components/audio_renderer/audio_renderer.c:182:13: warning: 'i2s_push_sample' is deprecated [-Wdeprecated-declarations]
bytes_pushed = i2s_push_sample(renderer_instance->i2s_num, (const char*) &sample, max_wait);
But also a tons of other things: https://pastebin.com/HJuW5efB
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.