Playing MP3 on raspberry pi

Oh sure, sorry, if you just wanna play sounds on your Pi through your TV. I need to learn to read the whole thread :cry:

ok, I got it partially working. In the VCL things driver, if I use the PlayTrack button, it works fine. But in a Notifier, when I enter the same mp3 file under Music device, I get an error in the Log.

groovy.lang.MissingMethodException: No signature of method: user_driver_statusbits_VLC_Thing_519.playTrack() is applicable for argument types: (java.lang.String, java.lang.Long) values: [Music/arrive.mp3, 50]
Possible solutions: playTrack(java.lang.Object), nextTrack() (playTrack)

I tried to insert several debug trace in the driver, but I cant seem to catch this.

Ok, this VCL thing need some work. It take way too much power on both, the HE and the pi.
I see that I’m not the only one with this kind of problem.
I don’t see why it has to poll the webserver every minute. May be to keep it alive? But still.... too heavy on the traffic. Sometime, it takes several seconds before the keystrokes appears on the pi while this thing is running.

And as for your app @Cobra I don’t quit understand the relation with a webserver. Your app triggers an mp3 to be sent to a music device. Nothing related to a webserver the way I see this. Am I missing something?

The webserver is used to ‘host’ the mp3’s as you cannot store them on the hub.
I apologise, I had assumed that you already had working speakers on your hub and just wanted a way to play mp3’s

2 Likes

Have you considered using Node-RED for this? Your post made me curious, so I did a quick search and found that there are at least a couple of node modules for playing mp3 files. I've yet to try it out, but it looks like it should be very easy.

If you've never tried Node-RED, it might sound complicated at first, or unnecessary for such a simple task, but it's actually extremely to install on a Pi. If you'd like to explore this option, and you're not familiar with Node-RED, I'd be happy to offer more help.

Thanks. I see also @april.brandt mentioned that I should try none red. Funny that in another post, people were saying that you need internet to use node red. May be I’ll try this later.

For now, I am almost done using python and writing the driver in Hubitat. I’m adding config file so other people may adjust it to their needs.

See this from another post:

aaiyarAmbassador

27d

Absolutely not. However, you will need an external permanently-on computer that runs Node-RED. Something like a Raspberry Pi would be adequate.

Ooops. I forgot that April had already suggested it. I'm pretty sure she's right; This should be easy with Node-RED, and I'm pretty sure it doesn't require an Internet connection, unless you want to connect it to cloud-based services.

It's definitely possible. My Google home plays "I am your father" mp3 when I get within our geofence. I found someone else's example online and tweaked it for my use. The mp3 is saved on the RPi.

1 Like

Hehe. Now we’re far from being local: the geofencing, the google home, the iPhone. Lol. This is totally the opposite of me. But... I’ve been there... it is very nice but... it’s no longer my need.

I will come back and check on that node red later. I got my local mp3 now so I’m pleased. I will share this later when it’s cleaned up properly.

Would you mind sharing your final solution? I would also like to use a Pi to play pre-recorded MP3 announcements using HE. Did you end up using the VLC integration to trigger and play the MP3 on the Pi? I see that you mentioned writing a custom driver for your solution. Would you please share it with us? Thanks!

This is how I play a mp3 on a raspberry I use the exec node, I’m sure they’re are other ways of doing it.

2 Likes

This is a great idea! Especially since I just finished setting up Node-Red :slight_smile: Thanks!

I'm assuming that Node-Red is running locally on the Pi? Is that how you're able to run the command with the Exec node?

1 Like

Yes

1 Like

Ok, thanks.

Thanks for posting that - very interesting. Have you seen/played around with this node?

Also came across this node which looks cool and is sort of related.. wonder how you would implement it though.. plays audio in "the browser" - so the UI? Dashboard? dunno.

I haven't, but I will look into it. I think that I've figured out a better way though.... Chromecast integration. I have a couple of Chromecast Audio's collecting dust. They are about to get repurposed!

1 Like

... I was answering your messages to the NO REPLY address LOL

OK, for me, I'm using everything 100% local, and extremely light. no node red, and no chromecast. I wrote the device for hubitat, and I wrote a tiny application in the RPi that cat as a TCP server. If your solution doesn't suit you, let me know.

Will do, thanks! Your solution sounds perfect, but my Chromecast Audio with Hubitat’s TTS is working perfectly. The audio out on the Pi produced a light buzzing sound, where the Chromecast Audio doesn’t do that and the voice sounds good. I haven’t tried it without internet, so that may be the downfall to my method; although I don’t use internet often.

If I remember right, there was a conflict with the TTS message while you are listening musing on the chromecast. Either the music stopped and didn't restart, or the volume changed... I can't remember the exact problem at the time.
Of course, I can't use TTS in local mode. I have to create every phrase I want in MP3.