gnumpi / esphome_audio

Custom audio components for ESPHome
Other
20 stars 8 forks source link

Multiple Audio Formats and m3u (Playlist) files #35

Open rwrozelle opened 4 weeks ago

rwrozelle commented 4 weeks ago

Added multiple audio formats (via file extensions) including ability to play an m3u file. Only tested with the ESP32-S3-DEVKITC, PCM5102 DAC, media-player (keep_pipeline_alive: false), and m3u files containing full URLs to non secure web-server of flac files. Added to be able to play m3u files from Media panel in HA.

gnumpi commented 4 weeks ago

ahhh nice features, thanks for contributing. I will have a look at it! I had to re-write some parts of the adf-pipeline for supporting announcements that interrupt a running audio stream. I will check how to merge both branches ...

gnumpi commented 4 weeks ago

We should make it configurable which decoders are supported, we don't want to loose support for low memory devices like the atom echo. But let's try to get it running with the dev-next branch after I merged #34 first .

rwrozelle commented 4 weeks ago

Configurable makes sense, like a list of allowed codecs. I commented out some of your settings to get good audio at the speaker, you may have had them for lower memory chips, so may need configuration also. I can provide about 4 hours a week to this. I’ve not done development using GitHub, so not familiar with DevOps capability like the automated testing

gnumpi commented 4 weeks ago

nice, thanks a lot. Yeah the reason while the compiling failed is probably because one of the tests still includes a customised version of the voice assistant component which is not compatible with the newest version of esphome anymore. So, probably not related to your code. I already addressed this issue in the next-dev branch.

rwrozelle commented 1 week ago

I changed over to using this: https://github.com/espressif/esp-adf-libs/blob/master/esp_codec/include/codec/esp_decoder.h Picks the decoder for you and now I don't need to destroy pipeline to switch to another format.

gnumpi commented 1 week ago

Thanks a lot for the work! I did quite a few changes to adf_media_player.cpp in the dev-next branch. Probably, I will try to merge the esp_decoder first and leave the playlist support for a next step. We should also try to make it compatible with HA and MA playlist support like supporting the enqueuing command etc.

rwrozelle commented 1 week ago

My expectation is that you would use the pull request directionally and not explicitly. I would cancel it after you used the pieces that you wanted in your code set, and rebuild what I needed after you promoted dev-next to the master branch. I'm after a very specific use case (making my old stereo smart) and haven't looked at many of the more general needs. The main issue with HA and playlists is the security token that is sent with the URL string. It expires after a small time period. I know why they do this since HA works beyond the home firewall, but it is a something that would need to be addressed with a long lived playlist, I suspect that the ESP client would have to send a separate API call to request a new token at the start of each individual url that was going to be played from the playlist. Also, my adding the playlist functionality at the media player is because I just can't figure out how to get the esp-adf http_stream playlist functionality working. So it may not be needed if that was all working at the adf_audio_sources level. It still may have to be at the media-player level if features such as clear, enqueue, repeat and shuffle are added.

rwrozelle commented 6 days ago

I took a look at Enqueue, Repeat, and Shuffle. I have code changes both on my fork for esphome_audio and at https://github.com/rwrozelle/core https://github.com/rwrozelle/esphome https://github.com/rwrozelle/aioesphomeapi Again, my hope is that when you finish out your upgrades and including announcements, that you look at my stuff directionally. I'm going to look at extraction of properties out of mp3, flac, etc. I want to display the Album, Artist information on Media card.