karawin / Ka-Radio32

esp32 version of Ka-Radio (https://github.com/karawin/Ka-Radio) by jp Cocatrix
523 stars 155 forks source link

Sound problem in new version 1.3R1 #44

Closed pilnikov closed 5 years ago

pilnikov commented 5 years ago

if i use the version 1.3r1 with pcm5102 & ili9341 the sound is not clean. The problem appears with the dynamics on the screen (e.g. the seconds of the clock change). When displaying a static picture (number & name of stations)- everything is ok! I solve the problem only by turning off the screen (set sys.lcd("0")). I think there is not enough memory at the same time to output to the screen and to decode the sound. In older versions of such a problem was not. A few more users of the specialized Russian forum confirm this problem.

karawin commented 5 years ago

Yes found it. A problem with spi when the output is i2s. Corrected now in revision 2 available.

pilnikov commented 5 years ago

Tnx. I check it ASAP

pilnikov commented 5 years ago

I do not use the rotary encoder. In "stock" config sound is good, but system send warning about button3 (no encoder button) com_good p_20180913_145739

if i comment encoder handler - the warning goes away, the picture on the screen changes, and I get a problem with the sound com_poor prog_poor p_20180913_150305

karawin commented 5 years ago

It is not a warning, it is a debug message. Send sys.logw To the interface to change the log level to warning.

pilnikov commented 5 years ago

com_poor

no warning - sound bad - ~ once time per second "TRR"

pilnikov commented 5 years ago

I found the source of the problem - addonucg.c, function drawFrameUcg addonucg If comment lines as in the screenshot - with the sound all ok! only time does not draw

P.S. also helps commenting the line markDrawUcg(TIME); time is drawing, but freeze

karawin commented 5 years ago

Try void drawLinesUcg() { setfont(text); for (int i=0;i<LINES;i++) { taskYIELD(); if (mline[i]) draw(i); } }

pilnikov commented 5 years ago

Also uncorrect drawing (on screen) symbols russian "ё" & "Ё" (code 1105 & 1025) - incomplete font conversion

pilnikov commented 5 years ago

taskYIELD();

no effect

karawin commented 5 years ago

And a lot of other char. The used font is not complete utf8To1251_t utf8To1251[UTF8TO1251] = {{0x401,0x45/0xa8/},{0x402,0x80},{0x403,0x81},{0x404,0xaa},{0x405,0xbd},{0x406,0x49/0xb2/},{0x407,0xaf},{0x408,0xa3}, {0x409,0x8a},{0x40a,0x8c},{0x40b,0x8e},{0x40c,0x8d},{0x40e,0xa1},{0x40f,0x8f},{0x452,0x90},{0x451,0x65/0xb8/}, {0x453,0x83},{0x454,0xba},{0x455,0xbe},{0x456,0x69/0xb3/},{0x457,0xbf},{0x458,0x6a/0xbc/},{0x459,0x9a},{0x45a,0x9c}, {0x45b,0x9e},{0x45c,0x9d},{0x45f,0x9f},{0x490,0xa5},{0x491,0xb4}, {0,0}}; uint8_t to1251(uint16_t utf8) { int i; if (utf8 > 0x491) return 0x1f; for (i = 0; i<UTF8TO1251;i++) { if (utf8 == utf8To1251[i].utf8) { // printf("to1251: utf8: %x, ret: %x\n",utf8,utf8To1251[i].c1251); return utf8To1251[i].c1251; } }

// printf("to1251: utf8: %x, ret: %x\n",utf8,(utf8 - 0x350)& 0xff); return ((utf8 - 0x350)& 0xff ); }

pilnikov commented 5 years ago

i comment ucg_DrawString(&ucg,0,yy - 30,0,strtime); in void draw(int i) time not drawing - sound ok, but ... any dynamics on the screen (long titles - they need scrolling) - everything! the sound broke.

karawin commented 5 years ago

Ok, So in app_main.c line 981 replace xTaskCreatePinnedToCore (task_addon, "task_addon", 2600, NULL, 10, &pxCreatedTask,1); //high priority for the spi else too slow due to ucglib by xTaskCreatePinnedToCore (task_addon, "task_addon", 2600, NULL, 2, &pxCreatedTask,1);

A test i forgot to remove....

pilnikov commented 5 years ago

main The sound is excellent only if the priority of the task "addons" is the lowest. The screen is very slow, updating approximately once time every 4 seconds

karawin commented 5 years ago

I don't understand why your config is so slow. I tested a lcd 194 ili9341 with a dac output with and without a rotary, without problem with the last modification. I cannot test with a PCM5102. I will order one to test it.

karawin commented 5 years ago

Try level 4 please

pilnikov commented 5 years ago

Bad idea Good, only if level is 1 (but slooooowly)

karawin commented 5 years ago

I have modified audio_renderer.c in order to improve the dma transfert. Please take it (not yet finished but work well) at http://karadio.karawin.fr/test/audio_renderer.c and put it in \esp\Ka-Radio32\components\audio_renderer It may improve a lot the problem.

pilnikov commented 5 years ago

The sound quality became much better (priority 4). Artifacts appear once every few(15-20) seconds. Sometimes floats the playback speed (not much) both in + and -. P.S. Artifacts remained with "long titles" (scrolling)

karawin commented 5 years ago

Take the new 1.3R3 release.

pilnikov commented 5 years ago

close?

pilnikov commented 5 years ago

upgrade to 1.3r3 - sound is agreeable

karawin commented 5 years ago

ok, Good, i close it Thanks.