Skip to content
CLI tool to play mp3 files or URLs on a Sonos speaker
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


sonosplay is a CLI tool to play an mp3 file or URL on a Sonos speaker


Requirements: Python 3

git clone
cd sonosplay/
pip install .

How It Works

It creates a streaming HTTP service for the chosen mp3 file and sends a command to a Sonos speaker in your LAN to play the stream. If an URL is passed instead of file name, then no HTTP service is launched and the URL is played right away.

SoCo library is used to communicate with Sonos devices.


Once you've installed the tool you can play a file on a Sonos speaker in the network you are connected to:

sonosplay /path/to/my.mp3

Optionally you might specify IP address/port for the sonosplay streaming service or a certain Sonos speaker to play with:

sonosplay /path/to/my.mp3 --ip --port 8080 --player MyKitchenSpeaker

You might also play URL directly without launching a streaming service



Currently the streaming service works forever until a manual stop. Probably we could have some sophisticated logic in further versions to detect when the Speaker finished playing and exit.



You can’t perform that action at this time.