Use MKCHROMECAST

Mkchromecast is a program to cast audio and video from your macOS or Linux desktop to your Google Cast devices or Sonos speakers. It is written in Python and comes with packages for both Debian and Ubuntu. If your repositories are up to date, you can open a terminal and type: It’s also available in Ubuntu Software and can be installed with a click. After the installation, you will find Mkchromecast in your Applications folder. Launch it and you should see the service icon appear in the top right of your screen. By default, the icon is not set up to match Ubuntu’s dark theme, but you can change to a lighter icon set. Click the icon and choose Preferences. There are three options for icon colors. Pick the one you prefer and close the window. Surprisingly, nothing happens, but if you click the icon again and select “Search for Media Streaming Devices,” the change will take effect. Select “Search for Media Streaming Devices” to see everything accessible on your network. It may take a minute or so for all your devices to be displayed. You can now select your destination from the list of available devices and the icon changes to include a small play head. This means the device is ready to take a stream. We did notice that, by default, Mkchromecast set the device volume to 0, so it’s a good idea to select the Volume option and set it to something reasonable.

Pulse Audio Control to manage the pipes

To pipe the audio to the correct device, we’re opting to use a second piece of software, called Pulse Audio Software Control (search for “pavucontrol”), available from Ubuntu Software. This has five tabs across the top. Begin under “Output Devices” to make sure that Mkchromecast is listed and active. You will also see your standard output speakers as a Hardware Device. There is a volume slider to change the volume and a lock button to sync streams to multiple devices, though we’re outputting one at a time. Next you need a source. We’re using MPV Media Player for local playback. Launch the source and add a file such as an MP3 or wav. Under Pulse Audio’s Playback in a tab, you should now see an entry for system sounds and the media player. By default, the media player will be set for playback on your standard output. Select the button next to the media player and choose Mkchromecast. Now when you hit Play in the media player, the sound will come out of your selected device. You can go back into the Mkchromecast system tray app and select different devices, and the audio should switch.

Stream local files from Chrome

The second option is perhaps the simplest but also uses more system resources because it’s running inside Chrome or the open-source Chromium browser. Chrome has its own native casting system, so you can open a web radio station or a web app like Spotify, then go into the menu and select Cast to see a list of available devices. Select the device, and the sound will begin playback. You can also select a device, click into the Sources list at the bottom, and select “Cast file” if you want to listen to a local file. A file selector will appear, and you can choose a track to begin playback. The problem with this is that it’s all or nothing – there’s no real control over playback or pause and no chance to adjust the volume, except on the device itself. A good alternative is the Local Audio Player extension, available from the Chrome Web Store. This allows you to select a file for playback, adjust the volume or set a sleep timer to switch off after a certain period of time. This is brilliant for audio books! This extension needs one small adjustment before use, so once installed, go to “Menu -> Extensions,” select Local Audio Player and click the Details button. Half way down the page you’ll see a switch to “Allow access to file URLs.” You can now drag a local file into the browser, and a player will launch. You can do “Menu -> Cast” and select your device and then hit Play. Again, you can select different devices, and the audio should move to the correct location. Now you can enjoy sound in any part of your house where you can plug in a Google Home or Chromecast device. Maybe you even want to enhance the experience with some PulseEffects to even out some of the dynamics in your music or crank up the bass. If you don’t have a Chromecast, you can also build it yourself using a Raspberry Pi. Here’s another way to cast audio in Linux without a Chromecast.