feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

Playing a embedded audio file

Open ChrisOboe opened this issue 9 months ago • 3 comments

Describe the problem you have/What new integration you would like

Currently media player is only able to play media from an url. I'd like to play media from an embedded file (e.g. in a byte array).

Please describe your use case for this integration and alternatives you've tried:

I've built a door bell based on esphome with i2s_audio and media player and and amplifier. It works fine as long as the device has network connection. But i need a fallback, to play a sound even if there is no network connection.

As a workarround i will try to use speaker play to play raw audio. But in that case i assume i will loose the codec support of media player. So the audio will propably be very limited by the space available.

Additional context

ChrisOboe avatar Apr 28 '24 09:04 ChrisOboe

A config similar to img would be useful, referencing a file to be embedded in the binary.

nagyrobi avatar Apr 29 '24 18:04 nagyrobi

definetly need embedding sounds for my projects. the actual uses of dfplayer seems obsolete for low bitrate sounds / just a fancy bip or startup sound. It's thing i've done on old ATTINY85 so it could work on a esp ^^ I have a quack.h sound i would love to embed in my esphome projects with buzzers/speakers

docteurzoidberg avatar May 26 '24 10:05 docteurzoidberg

Try @jesserockz 's custom component for this purpose: https://github.com/jesserockz/esphome-components/tree/main/components/file

Maybe it would be worth including it in the main code...

nagyrobi avatar Jun 14 '24 09:06 nagyrobi

But this can not be used with the media_player component, only with a speaker component. There can be cases where no speaker but a media_player is configured, for example with esphome_audio.

jhbruhn avatar Jul 18 '24 21:07 jhbruhn