How can I play an MP3 file on Sonos?

I searched the forum (subject was "Audio announcements") and found a post with an example of playing an audio file using RM4 something like this:

playtrackandrestore http://192.xxx.xxx.xxx/ on Sonos

I don't see "playtrackandrestore" as an option, so I tried "playtrack", which doesn't work. I had uploaded the audio file to the hub, and it was placed in the "local" directory, so the exact command I used is:

playtrack http://192.xxx.xxx.xxx/local/audio_file.mp3

Can anyone help with this? Text to speech works well, so I know the speaker itself is fine. I thought this would be easy.

Thanks.

@Cobra used to have an app for that. Not sure if it's still available. You simply need to request access to his site.

https://cobra-apps.co.uk/

1 Like

I donā€™t know how the Sonos integration works when playing a file but I would try to use port 8080 on the http request just to see if that works.

I'm using the playTrack() command with a locally hosted file and it works fine for me:

Screenshot: "Play Track" custom command with Sonos device in Rule Machine

I didn't even use port 8080 like I probably should have. :slight_smile: I'm not sure why yours isn't working, but I'd probably start by leaving Rule Machine out of the picture and seeing what works if you try running the command with this parameter (or another appropriately formatted command) from the device page directly.

When you find something that works, bringing into RM should be easy, but this would at least rule out RM as a source of the problem. It works for me both ways, and the only difference I can find from your description is that I'm using a WAV and not an MP3. I don't really know what formats are supported, but I suppose that's something else you could experiment with.

On a related note I followed this post which inspired me.

Which led me to a Vacation mode that uses a specific song in Sonos (sources from SoundCloud I believe)

I'd imagine you could replace with a local .mp3 file

Per this thread your .mp3 file could also be the problem:

And people have had success with HE local files here:

1 Like

It is still available, though not actively developed

Andy

1 Like

:+1:

1 Like

Thanks all for the help. I finally got it to work with MP3 files. I had been trying WAV files as well and I've read that sometimes those don't work, depending on how they were created. I used playtrack and supplied the URL as described previously. Not sure why MP3's didn't work for me earlier.

1 Like

Awesome, did you narrow down what your issue was?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.