karawin / Ka-Radio32

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

New feature requests #12

Open sparx266 opened 6 years ago

sparx266 commented 6 years ago

Awesome radio project here!

My infra red remote is doing funny things but is working, will have to look at that. Would be great to have a power off/on via IR, but what would be brilliant is to have MP3 files either from SD card or USB stick via a host board playable as well as the radio.

Bluetooth speaker would be really cool too.

Once again, this is great, thanks for doing it.

karawin commented 6 years ago

Thanks, What is a power off/on from the software point of view? I can ask the processor to go to sleep, but cannot control lcd, vs1053 etc power. Sure it can read from a sd card, but we are in 2017. mount a local SHOUTcast server and make your own radio. A must. Bluetooth speaker: I tried but not enough sram for both.

marcinmaster999 commented 6 years ago

ok. a2dp source as server bluetooth?

karawin commented 6 years ago

Good try but... https://github.com/espressif/esp-idf/issues/580 ;-)

sparx266 commented 6 years ago

Fair point, what about a standby mode then? Display could show the time? VS1053 should be silent, volume 0?

Not sure a local shoutcast server is for me. Reading MP3's off a USB drive would be better, ie more convenient for playing locally stored MP3's. But most/many VS1053 boards already have an SD card slot built in?

Pity about the Bluetooth speaker, is there any way around that?

ARMOR888 commented 5 years ago

Can you add the ability to read playlists on the network without specifying the port? I have a network storage with music. I make a playlist accessible via the link \192.168.1.1\MyNAS\Music\MyPlaylist.m3u This link succesfully opens in a music player, for example MPC-HC or VLC, but KaRadio can't open this link right now. It would be very very nice if i could open and save not only radio stations, but also such playlists in the same station list. In truth, this is exactly what I need to listen to my music library without turn on large devices like SmartTV or PC.

emax73 commented 5 years ago

Reading .of *.m3u8 playlists very usefull feature anywere

karawin commented 5 years ago

'' Can you add the ability to read playlists on the network without specifying the port? I have a network storage with music. I make a playlist accessible via the link \192.168.1.1\MyNAS\Music\MyPlaylist.m3u '' It is not a port problem but a network protocol problem. Your pc is not an html server and smb is not implemented in esp32. Another solution is to write a little soft to convert the playlist in a txt file uinderstandable by KaRadio. But it doesn't work for local pc files. They must be on a html server.

karawin commented 5 years ago

m3u8 is more or less a HTTP Live Streaming and is difficult to decode because it basically breaks the stream down into multiple files. Only the first found is played.

emax73 commented 5 years ago

I mean import radiostations list from m3u8 file

karawin commented 5 years ago

Done a while ago. The list of format is char *t0 = strstr(clientPath, ".m3u"); if (t0 == NULL) t0 = strstr(clientPath, ".pls"); if (t0 == NULL) t0 = strstr(clientPath, ".xspf");
if (t0 == NULL) t0 = strstr(clientPath, ".m3u8");
if (t0 == NULL) t0 = strstr(clientPath, ".asx");
if (t0 != NULL) // a playlist asked But only the first is read

emax73 commented 5 years ago

Probably, small need "import/export m3u8" button at Edit tab of web page

karawin commented 5 years ago

The web page is only a cached view of the esp32 data with some facilities.

emax73 commented 5 years ago

Now I import m3u8 playlist made for AIMP3 windows player by custom php script, I see, that jet one man created php script for convert m3u8 playlist to WebStations.txt internal KaRadio32 format

karawin commented 5 years ago

The internal format is a simple json text {"Name":"RTL","URL":"streaming.radio.rtl.fr","File":"/rtl-1-48-192","Port":"80","ovol":"-4"} For historical reason, the path is named File. ovol is the relative offset volume.

No php allowed (it must run on the esp32 for that, but...). Just javascript on the browser.

emax73 commented 5 years ago

PHP selected as well known language and run once at PC, May be any open source javascript parser with convert to internal json, or RegularExpression js parser? Station list has 254 items - not big work for client side js

karawin commented 5 years ago

The PHP run on the server side.

emax73 commented 5 years ago

I have php server at my PC

karawin commented 5 years ago

and? Explain what you want to do.

karawin commented 5 years ago

It must be an easy solution for all users

emax73 commented 5 years ago

Usefull feature will been take well known m3u8 playlist and loaded to KaRadio32 station lists instread of internal not using nowhere WebStations.txt

karawin commented 5 years ago

Ok do it

emax73 commented 5 years ago

Its optional suggestion, will can been useful at your free time

karawin commented 5 years ago

;-) But we loose the ovol.

emax73 commented 5 years ago

ovol can still at WebStations.txt, at m3u8 ovol = 0 unfortunally

ARMOR888 commented 5 years ago

It is not a port problem but a network protocol problem. Your pc is not an html server and smb is not implemented in esp32. Another solution is to write a little soft to convert the playlist in a txt file uinderstandable by KaRadio. But it doesn't work for local pc files. They must be on a html server.

I mean to add the ability to play not only streaming, but also directly reading files over the network. I understand that this is a another protocol. I just tried to explain my use case. As i know this feature implemented in Edzelf ESP32-Radio https://github.com/Edzelf/ESP32-Radio but not sure

karawin commented 5 years ago

ARMOR888 I don't think. Probably a mp3 file on a sd card.

Tonymac32 commented 5 years ago

I've got a board I'm launching that uses the RPi form factor. This gives me a unique situation where I2S needs to be on alternate pins to hardware DAC. No issue there, I can assign the pins and it works beautifully, then select the DAC and it works too, from the TRS jack in the expected RPi position. The issue is trying to use PDM in this configuration, it comes out the I2S pins of course.

Is it possible to allow for the definition of a "P_PDM_L" and "P_PDM_R" pins in the hardware file? Since reboot is necessary between audio outlets, this would support situations where an I2S and an analog both exist in one system.

https://twitter.com/TonyMac_32/status/1124079867828559872

karawin commented 5 years ago

Not sure. I wonder if DAC and PCM can be configured with GPIO not equal to (GPIO25 & GPIO26) It works for I2S but for DAC or PCM the pin's config must be : pin: I2S Pin structure, or NULL to set 2-channel 8-bit internal DAC pin configuration (GPIO25 & GPIO26) https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/i2s.html By the way, the board seems very interesting.

Tonymac32 commented 5 years ago

The onboard DAC works irrespective of pin assignments (analog output to pins 25 and 26 no matter what, I could compare quality though just in case). PDM comes through the defined I2S pins, being an I2S mode, which is my only real issue, hence the thought to be able to define the I2S pins differently for that mode (and maybe onboard DAC as well).

karawin commented 5 years ago

Checked. Only DAC output are static GPIO's. I will add your suggestion in next release "P_PDM_L" and "P_PDM_R"

karawin commented 5 years ago

Checked the software. The pdm pin are wrongly not assigned in the source. So output are in the default pins. The documentation is not very clear for the PDM mode. I can change the soft to use the i2s definitions for i2s and pdm output. So "P_PDM_L" and "P_PDM_R" are not needed. Only the mode is enough. For the pdm mode, i think that the output is PDM_CLK and PDM_DATA like image

Is it ok or am i wrong?

Tonymac32 commented 5 years ago

Hmmm, that explains some odd behaviors I was seeing, like only getting output on "warm" reset and not on a full power cycle...

As to the format of the output, I will have to do some checking, I don't think any demuxing was necessary.

Tonymac32 commented 5 years ago

OK, for Mono output no demuxing is required (only LPF), but for stereo it is, which requires a proper amplifier to handle the data/clock signal. My mistake, the documentation is not the easiest to find... Some info on the topic: https://translate.google.com/translate?hl=en&sl=ja&u=http://blog-yama.a-quest.com/%3Feid%3D970192&prev=search

I agree splitting the paths doesn't make a lot of sense at that point, it can be kept with the I2S

karawin commented 5 years ago

You can try the sys.prerelease available.

bazooka07 commented 4 years ago

For importing playlists in .m3u or .pls format follow this link : https://bazooka07.github.io/Ka-Radio32/