ESP32 Webradio

kami_ESP32
Posts: 2
Joined: Wed Sep 20, 2017 11:38 am

Re: ESP32 Webradio

Postby kami_ESP32 » Sat Sep 30, 2017 8:53 pm

Hello,

currently I try to install and make the "ESP32 webradio streamer" from here: https://github.com/MrBuddyCasino/ESP32_MP3_Decoder
but I get the following error:

Code: Select all

Toshiba@Michael MINGW32 /c/esp/mp3
$ make
CC build/playlist/playlist.o
C:/esp/mp3/components/playlist/playlist.c:19:17: fatal error: ini.h: No such file or directory
compilation terminated.
make[1]: *** [/c/esp/esp-idf/make/component_wrapper.mk:243: playlist.o] Fehler 1
make: *** [C:/esp/esp-idf/make/project.mk:421: component-playlist-build] Fehler 2


I use Windows 8 and installed the Windows all-in-one toolchain & MSYS2 zip file from dl.espressif.com: https://dl.espressif.com/dl/esp32_win32 ... 170918.zip

After installation I switched back to release 5.2.0:

Code: Select all

cd ~/esp
git clone https://github.com/espressif/esp-idf.git esp-idf-v5.2.0
cd esp-idf-v5.2.0/
git checkout v5.2.0
git submodule update --init --recursive


The command

Code: Select all

git checkout v5.2.0
does not work.

What is the course of the make problem? I tried the

Code: Select all

git submodule init && git submodule update
but nothing happens. :shock:
My input console is MINGW64 from MSYS2 folder of Espressif installation.

Please help.
Best regards, Micha

ESP_Sprite
Posts: 1171
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 Webradio

Postby ESP_Sprite » Sun Oct 01, 2017 2:35 am

Where did you get the 5.2.0 version number for esp-idf? At the moment, we're up to 2.1, working on 3.0; to succesfully switch to 5.2.0 you'd need a time machine :)

User avatar
loboris
Posts: 254
Joined: Wed Dec 21, 2016 7:40 pm

Re: ESP32 Webradio

Postby loboris » Sun Oct 01, 2017 8:09 am

If you execute

Code: Select all

git clone https://github.com/espressif/esp-idf.git esp-idf-v5.2.0

the esp-idf master will be cloned to the local directory esp-idf-v5.2.0

https://git-scm.com/docs/git-clone
https://git-scm.com/docs/git-checkout

karawin
Posts: 2
Joined: Sat Oct 07, 2017 3:07 pm

Re: ESP32 Webradio

Postby karawin » Sat Oct 07, 2017 3:17 pm

Hi all
I made a little change on the soft to add a volume control.
Karadio32 is based on your soft and KaraDio for esp8266.
The volume control is from 0 to 256.

Check in https://github.com/karawin/Ka-Radio32

in audio_renderer.c
//KaraDio32
void renderer_volume(uint32_t vol)
{
if (vol >256) vol = 256;
renderer_instance->volume = vol<<8; // *256
}

and

//KaraDio32 Volume control
register uint32_t mult = renderer_instance->volume;
if (mult!= 0x10000) // need voluem?
{
int16_t *psample;
psample = (int16_t*)buf;
for (int i = 0; i < num_samples*buf_desc->num_channels; i++)
{
int temp = psample[i] * mult;
psample[i] = temp>>16 & 0xFFFF;
}
}

Works pretty well!
But still unable to play aac stations. Not enough heap i suppose.

pad_52
Posts: 1
Joined: Tue Oct 10, 2017 8:10 pm

Re: ESP32 Webradio

Postby pad_52 » Tue Oct 10, 2017 8:30 pm

Dear Folks,
First of all - Thank you for this great code!

In Master mode - everything works well as expected but I cannot find the way to use it in I2S Slave Mode with my ADAU1701.

Configuration is simple: 44100 Khz, 16bit depth, Standard I2S.

I first change this flag to:

Code: Select all

static void init_i2s(renderer_config_t *config)
{
    i2s_mode_t mode = I2S_MODE_SLAVE | I2S_MODE_TX;


This wasn't enough: The output on the I2S Data channel wasn't a standard I2S (I cannot see zeroes between Left and Right Channel);
In fact I read:

Code: Select all

const char samp32[4] = {ptr_l[0], ptr_l[1], ptr_r[0], ptr_r[1]};
                    bytes_pushed = i2s_push_sample(renderer_instance->i2s_num, (const char*) &samp32, max_wait);


I can get this fixed setting the rate at 32 bit depth like the Merus Audio kind of output.
In this mode I can see the zeroes in:

Code: Select all

const char samp64[8] = {0, 0, ptr_l[0], ptr_l[1], 0, 0, ptr_r[0], ptr_r[1]};
                    bytes_pushed = i2s_push_sample(renderer_instance->i2s_num, (const char*) &samp64, max_wait);


I imagine that I'm doing some confusion between I2S Frame lenght and Data Lenght (in 32bit of space i need to put 16bit of zeroes)...
I cannot understand so well where this could be set in my esp32...

Now I can get some audio - but really distorted.
Uncommenting the following:

Code: Select all

// takes too long
    i2s_event_t evt = {0};
    if(xQueueReceive(i2s_event_queue, &evt, 0)) {
        if(evt.type == I2S_EVENT_TX_DONE) {
            ESP_LOGE(TAG, "DMA Buffer Underflow");
        }
    }


Throw me DMA Buffer Underflow - could this be the problem?

Any help will be really appreciated!

pad52

--
It does not matter how slowly you go as long as you do not stop. - Confucio

unkown
Posts: 2
Joined: Tue Oct 10, 2017 9:08 pm

Re: ESP32 Webradio

Postby unkown » Tue Oct 10, 2017 9:34 pm

Hi,
got compiler-error and cant get missing ini.h with git submodule init && git submodule update .
My solution is download https://github.com/benhoyt/inih.git and put only content in
ESP32_MP3_Decoder-master/components/inih_port/inih/

I modified sdkconfig CONFIG_FREERTOS_HZ=10 cause ESP32 make Interrupt every
100ms for 8µs . With 1000Hz this can disturb timings. Lets try give feetback.

I use I2S with ES9023 and works. With PDM and DAC I hear good Sound with Crackling
have to check why.
Thx for ESP32 Webradio.

unkown
Posts: 2
Joined: Tue Oct 10, 2017 9:08 pm

Re: ESP32 Webradio

Postby unkown » Tue Oct 10, 2017 11:10 pm

hi again,
after CONFIG_FREERTOS_HZ=10 ,I got problems with my playlist change channels.
With CONFIG_FREERTOS_HZ=100 no problems.
So please be carefull with this option.

AlexanderK
Posts: 2
Joined: Sun Nov 05, 2017 9:41 pm

Re: ESP32 Webradio

Postby AlexanderK » Mon Nov 06, 2017 8:53 pm

Hi Buddy,
I'm studying your project and I have a problem with playing music in APLL mode with PDM. First I compiled the sources without any change and start radio with APPL + PDM. And the problem is that output play very-very-very slow - actually even I can't understand what is playing. I've tried without APLL - it plays OK (but not a long time).

Below is the output for APLL and non-APLL modes. For APLL It looks good except XTAL 35MHz. Could you please advice what is the problem? Maybe for APLL I need another configuration of HW?

>>> Output for APLL
...
I (66) boot: Detected ESP32
W (68) rtc_clk: Potentially bogus XTAL frequency: 35 MHz, guessing 40 MHz
...

I (3756) renderer: init I2S mode 3, port 0, 16 bit, 44100 Hz
I (3756) renderer: chip revision 1, enabling APLL
I (3766) I2S: queue free spaces: 1
I (3766) I2S: DMA Malloc info, datalen=blocksize=256, dma_buf_count=32
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
I (3786) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldo wn: 0| Intr:1
I (3796) main: RAM left 170588
....
I (4226) audio_player: Buffer fill 50%, 16012 bytes
I (4316) audio_player: RAM left 170968
I (4316) audio_player: created decoder task: mp3_decoder_task
I (4316) mad_decoder: decoder start
E (4316) mad_decoder: dec err 0x0235 (bad main_data_begin pointer)
E (4326) mad_decoder: dec err 0x0235 (bad main_data_begin pointer)
I (4326) audio_player: Buffer fill 91%, 29134 bytes
I (4516) wifi: pm start, type:0

I (8016) audio_player: Buffer fill 94%, 30123 bytes
I (12126) audio_player: Buffer fill 96%, 30985 bytes
...
I (51116) audio_player: Buffer fill 99%, 31832 bytes
I (53846) http_client: ... done reading from socket. Last read return=0 errno=12 8
I (53846) http_client: socket closed
I (53846) web_radio: http_client_get completed
I (63186) mad_decoder: decoder stopped
I (63186) mad_decoder: MAD decoder stack: 540


>>> Output for non-APLL
I (3276) renderer: init I2S mode 3, port 0, 16 bit, 44100 Hz
I (3276) renderer: chip revision 1, enabling APLL
I (3286) I2S: queue free spaces: 1
I (3286) I2S: DMA Malloc info, datalen=blocksize=256, dma_buf_count=32
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
....
For me it is strange digits i I2S output here. Playing is OK, but not a long time as it plays lower rate than in browser and I suppose output buffer of server finished. Thank for help in advance.

BuddyCasino
Posts: 230
Joined: Sun Jun 19, 2016 12:00 am

Re: ESP32 Webradio

Postby BuddyCasino » Tue Nov 07, 2017 9:05 am

I simply didn't test APLL + PDM, assuming it would work the same as I2S. Can you open an issue on Github please?

AlexanderK
Posts: 2
Joined: Sun Nov 05, 2017 9:41 pm

Re: ESP32 Webradio

Postby AlexanderK » Tue Nov 07, 2017 11:58 am

Yes of course. Done. DAC APLL=1 also doesn't work also. I wrote it also. Thank you!

Who is online

Users browsing this forum: BlackEdder and 1 guest