Airfoil

Airfoil is a great application from Rogue Amoeba that allows you to stream sound and video from your Mac across the network to a bunch of different devices - and it keeps it all in sync. Many Indigo users use it in conjunction with Apple TVs, Airport Expresses, and other computers to create whole-house audio systems, all streaming from your Mac server running iTunes or other music applications.

The Airfoil plugin included with Indigo 5 and 6 allows you to control the local (to the IndigoServer) your copy of the Airfoil application and trigger based on various events. Note: you must be running Airfoil on the same Mac as the IndigoServer.

Note: Indigo 7 includes a new Airfoil Pro plugin that uses a new API from Rogue Amoeba and allows you to also control instances of Airfoil running on other Macs on your network. This legacy plugin is also available from our Github repository for those that might want to try it with Indigo 7 (it may not work).

Actions

The Airfoil plugin provides the following actions:

Speaker Actions

  • Connect to Speaker - tell Airfoil to begin transmitting to the selected speaker.
  • Disconnect from Speaker - tell Airfoil to stop transmitting to the selected speaker.
  • Toggle Speaker - tell Airfoil to disconnect if it's connected and vice versa.
  • Save Current Speaker State - save each speaker and it's current connected/disconnected state. You can then use the next action to restore every speaker back to this state. So, for instance, if you wanted to temporarily change what speakers were connected (maybe to play a verbal announcement in some specific parts of your house), then you could use this to save the state of all speakers, set the speakers to what you need and play the announcement, then restore the previous set.
  • Restore Saved Speaker State - this is the opposite action from the one above. Use it to restore a previously saved set.

Source Actions

  • Change Audio Source - change the source of the audio that Airfoil is broadcasting to it's connected speakers.
  • Save Current Source - much like the “Save Current Speaker State”, this will save the current source so you can restore it later.
  • Restore Saved Source - the opposite action to the one above. Use it to restore a previously saved source.

Volume

  • Set Volume - set the volume of the selected speaker(s) to a specific value (on a scale of 0 to 100).
  • Increase Volume - increase the volume of the selected speaker(s) by the amount specified (0 to 100).
  • Decrease Volume - decrease the volume of the selected speaker(s) by the amount specified (0 to 100).

Events

  • Airfoil Becomes Available - fires when Airfoil starts up.
  • Airfoil Becomes Unavailable - fires when Airfoil shuts down.
  • Speaker State Changes - watches for the selected speaker's state to change in up to 4 different ways:
    • Becomes Connected - when the speaker begins to receive broadcasts from Airfoil.
    • Becomes Disconnected - when the speaker stops receiving broadcasts from Airfoil.
    • Becomes Available - when a speaker comes online (i.e. when an Apple TV starts up).
    • Becomes Unavailable - when a speaker goes offline (i.e. when you quit Airfoil Speakers running on another computer or iOS device).
  • Audio Source Changes - fires when the audio source that Airfoil is broadcasting changes.

Optional Variables

In the Plugin Configuration dialog you have the option of having the plugin create variables for each speaker that holds it's current state: unavailable, connected, disconnected. Note - because variable names are restricted to certain characters, we substitute spaces with underscores (“_”) and remove any other invalid characters.

You can also have a variable called “CurrentSource” created that holds the name of the current audio source. These variables will be created in a folder named “Airfoil”. Once it's created, you can rename it if you like. However, note that if you turn off both checkboxes the variable folder and all it's contents will be deleted.

Scripting Support

As with all plugins, actions defined by this plugin may be executed by Python scripts. Here's the information you need to script the actions in this plugin.

Plugin ID: com.perceptiveautomation.indigoplugin.Airfoil

Action specific properties

Connect to Speaker

Action id: connectToSpeaker

Properties for scripting:

speaker the string key of the speaker to use - select “Show Speaker List in Event Log” from the Airfoil plugin menu to have a list of available speakers and their associated IDs displayed in the Event Log - most look like numbers although they are really strings - the one representing the local speaker is obviously a string (“com.rogueamoeba.airfoil.LocalSpeaker”)

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("connectToSpeaker", props={'speaker':"0017F2F8BE78"})

Disconnect from Speaker

Action id: disconnectFromSpeaker

Properties for scripting:

speaker the string key of the speaker to use - select “Show Speaker List in Event Log” from the Airfoil plugin menu to have a list of available speakers and their associated IDs displayed in the Event Log - most look like numbers although they are really strings - the one representing the local speaker is obviously a string (“com.rogueamoeba.airfoil.LocalSpeaker”)

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("disconnectFromSpeaker", props={'speaker':"0017F2F8BE78"})

Toggle Speaker

Action id: toggleSpeaker

Properties for scripting:

speaker the string key of the speaker to use - select “Show Speaker List in Event Log” from the Airfoil plugin menu to have a list of available speakers and their associated IDs displayed in the Event Log - most look like numbers although they are really strings - the one representing the local speaker is obviously a string (“com.rogueamoeba.airfoil.LocalSpeaker”)

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("toggleSpeaker", props={'speaker':"0017F2F8BE78"})

Save Speaker Set

Action id: saveSpeakerSet

No properties needed for scripting.

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("saveSpeakerSet")

Restore Speaker Set

Action id: restoreSpeakerSet

No properties needed for scripting.

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("restoreSpeakerSet")

Change Audio Source

Action id: changeAudioSource

Properties for scripting:

sourceType the string key of the type of audio source to change to - must be one of: “application”, “device”, or “system”
appSource if sourceType is “application”, the name string of the application as it shows in the Airfoil UI (i.e. “Adium”, “IndigoServer”, etc.)
devSource if sourceType is “device”, the name string of the audio device as it shows in the Airfoil UI (i.e. “Default System Input”, etc.)

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	# set the source to the IndigoServer
	airfoilPlugin.executeAction("changeAudioSource", props={'sourceType':"application", 'appSource':'IndigoServer'})
	# set the source to the default system input
	airfoilPlugin.executeAction("changeAudioSource", props={'sourceType':"device", 'devSource':'Default System Input'}) 
	# set the source to all system audio via soundflower
	airfoilPlugin.executeAction("changeAudioSource", props={'sourceType':"system"})

Save Source

Action id: saveSource

No properties needed for scripting.

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("saveSource")

Restore Source

Action id: restoreSource

No properties needed for scripting.

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("restoreSource")

Set Volume

Action id: setVolume

Properties for scripting:

volume a number from 0 to 100 representing the absolute volume
speakerIds a list of speaker ID strings to change - select “Show Speaker List in Event Log” from the Airfoil plugin menu to have a list of available speakers and their associated IDs displayed in the Event Log - most look like numbers although they are really strings - the one representing the local speaker is obviously a string (“com.rogueamoeba.airfoil.LocalSpeaker”)

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("setVolume", props={'volume':"75", 'speakerIds':["0017F2F8BE78","5855CA5E94F9"]})

Increase Volume

Action id: increaseVolume

Properties for scripting:

volume a number from 0 to 100 representing the amount to increase - so if a speaker is currently at 50, and volume is set to 25, the volume will end up being 75
speakerIds a list of speaker ID strings to change - select “Show Speaker List in Event Log” from the Airfoil plugin menu to have a list of available speakers and their associated IDs displayed in the Event Log - most look like numbers although they are really strings - the one representing the local speaker is obviously a string (“com.rogueamoeba.airfoil.LocalSpeaker”)

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("increaseVolume", props={'volume':"25", 'speakerIds':["0017F2F8BE78","5855CA5E94F9"]})

Decrease Volume

Action id: decreaseVolume

Properties for scripting:

volume a number from 0 to 100 representing the amount to increase - so if a speaker is currently at 50, and volume is set to 25, the volume will end up being 25
speakerIds a list of speaker ID strings to change - select “Show Speaker List in Event Log” from the Airfoil plugin menu to have a list of available speakers and their associated IDs displayed in the Event Log - most look like numbers although they are really strings - the one representing the local speaker is obviously a string (“com.rogueamoeba.airfoil.LocalSpeaker”)

Example:

airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Airfoil")
if airfoilPlugin.isEnabled():
	airfoilPlugin.executeAction("decreaseVolume", props={'volume':"25", 'speakerIds':["0017F2F8BE78","5855CA5E94F9"]})

Support and Troubleshooting

For usage or troubleshooting tips discuss this plugin on our forum.

plugins/airfoil.txt · Last modified: 2019/01/26 00:10 (external edit)
 

© Perceptive Automation, LLC. · Privacy