Setting the Volume on Homepods

I have two Homepods (one regular, the other mini) and I use Airfoil to route music playing on the iMac to both of the pods. The problem is the volume is almost never balanced between the iMac, HomePod and mini. I'm always telling the pods using Siri to "make it louder" or "set the volume to 30". How can I create a macro to adjust the volumes of the two pods independent of the system volume?

Never mind.

I realized that Airfoil is scriptable so I'm going to use AppleScript to set the pod volume individually like this:

tell application "Airfoil"
   set (volume of first speaker) to 1.0
   set (volume of every speaker whose name is "Bedroom Pod") to 0.5
   set (volume of every speaker whose name is "Living Room") to 0.7
end tell
2 Likes

Paging Chris @cyoungers
I found this post via Google. Could you provide a script to tell Airfoil to route the sound to specific HomePod? Pretty please? I wish I knew AppleScript.

Here is a link to the Rouge Amoeba site on scripting Airfoil. You should look at this and try to understand what the Airfoil AppleScript does.

Here is a AppleScript that tells Airfoil to set up a new audio source from Safari. It disconnects from any outputs should they be enabled, then connects the Safari audio to my kitchen HomePod.

tell application "Airfoil"
  
  --Find Safari
  set pathToApp to (POSIX path of (path to application "Safari"))
  
  --Create a new source and set it to Safari
  set newSource to make new application source
  set application file of newSource to pathToApp
  
  --Set the source
  set (current audio source) to newSource
  
  --Set the speaker volumes
  set (volume of every speaker whose name is "Kitchen") to 0.5
  
  -- In case Airfoil happens to be routing audio to other sources, disable output
  disconnect from every speaker
  delay 2.0 --Alwow time for Airfoil to disconnect
  
  --And finally start transmitting
  connect to (every speaker whose name is "Kitchen")
  
end tell

Just curious: why are you using Airfoil rather than Airplay?

No reason other than I already had the app. I suspect everything the app does could be accomplished in AppleScript but long ago I was not too swift in AS and the app gave me easy access to the functions.

The reason I ask is that if you Airplay to devices, you can use your existing volume controls, with no scripting necessary.

I have several HomePods/Minis and each need a different volume offset depending on the room.

1 Like

Ok, sounds like you're happy with scripting Airfoil. If you decide you'd like to try Airplay instead, you can use Apple Shortcuts (with KM if you want more control) to set the volumes of your various devices independently.

Airplay works fine but I'm interested the Apple Shortcuts method. One thing I like in Airplay is to have the ability to advance or delay each feed individually. If I don't do this, the delay in hearing a speaker in another room drives me nuts. Airplay allows you to control account for the latency. I suspect there is a way to do that in Shortcuts but have not looked.

I think there's a bit of confusion.

The screenshot you just sent is from Airfoil, not Airplay.

I was suggesting that, if you wanted to, you could control the volume of Airplay-connected devices via the Shortcuts app individually. However, I'm not aware of native delay compensation options for Airplay, so it sounds like you're better off sticking with Airfoil.

Oops.