How to create a (virtual) audio (output) device on Mac OS stacks?

Due to restrictions of the virtualization solution we use (VMware vSphere), which is primarily aimed for high performance server virtualization, where sound outputs are pretty useless, there’s no built in audio output on the Mac stacks.

This doesn’t cause any issue in most cases, but some projects or tools might actually require an audio output. For example QuickTime refuses to play any video when there’s no audio output of any kind.

The solution is fortunately pretty simple, you can simply add a virtual audio output device if you need it. There are a few options to do this, probably the easiest is to install soundflower, which is a tool used for manipulating / piping audio between different tools, and it installs and uses a virtual (actually two) audio output to achieve the functionality.

As the virtual audio drivers are installed as part of the soundflower installation, all you have to do is add a Script step to your workflow, any point before you’d use the audio output (can be the very first step of the workflow), with the following content:

set -ex
brew install Caskroom/cask/soundflower

That’s all. When brew installs soundflower it’ll also install two virtual audio devices, and macOS will recognize these as normal audio output (and input) devices.


Thanks, great tip - this really helped us as we are building audio applications for iOS

Another tool that we needed to get our tests running is switchaudio-osx

brew install switchaudio-osx

This allows you to choose which soundflower input/output device you want to use as the default soundflower device seemed to be 64ch which is incompatible with our applications

Select the input device (e.g. 2ch) using

SwitchAudioSource -s "Soundflower (2ch)" -t input

and the output device using

SwitchAudioSource -s "Soundflower (2ch)" -t output

1 Like

Awesome, thank you @ben.dunn for sharing! :slight_smile:

Could this be why my audio playback tests fail on Bitrise? I play an audio and check to see that the current time progresses for 5 seconds, and that I consider to be a successful playback. Under Bitrise the playback tests all fail. Under Xcode testing, they all succeed. I’m looking for why testing audio playback is failing on Bitrise.

Did you create the virtual audio device explained above? Did you check ben’s comment too How to create a (virtual) audio (output) device on Mac OS stacks?

You can also try to remote desktop / VNC into the build VM and see what the issue is:

Not yet. I was trying to understand whether this was a possible issue before I started installing the virtual audio device.

Let us know how it goes, or if you have any questions @mzabetian! :wink:

It worked! Thank you.

I basically just added the following code to a workflow, and my audio tests which use FFMPEG and AVPlayer, both work.

I was also impressed that the time it takes to do a brew install of Soundflower is about 3 seconds.

1 Like

Glad to hear, thanks for reporting! :wink:

SoundFlower often fails installation on macOS 10.15 (Catalina) due to quarantining.

The tool Blackhole gets around this limitation:

set -ex
brew cask install blackhole
brew install switchaudio-osx

SwitchAudioSource -s "BlackHole 16ch" -t input
SwitchAudioSource -s "BlackHole 16ch" -t output